diff --git a/.github/Dockerfile b/.github/Dockerfile index 3a1907b8e5..91436a344b 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -4,26 +4,21 @@ FROM amazoncorretto:21-alpine-jdk COPY ./ldes-server-application/target/ldes-server-application.jar ./ -COPY ./ldes-server-infra-postgres/postgres-ingest-repository/target/postgres-ingest-repository-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-infra-postgres/postgres-retention-repository/target/postgres-retention-repository-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-infra-postgres/postgres-fragmentation-repository/target/postgres-fragmentation-repository-jar-with-dependencies.jar ./lib/ +# Postgres Implementations COPY ./ldes-server-infra-postgres/postgres-pagination-repository/target/postgres-pagination-repository-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-infra-postgres/postgres-admin-repository/target/postgres-admin-repository-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-infra-postgres/postgres-liquibase/target/postgres-liquibase-jar-with-dependencies.jar ./lib/ - -COPY ./ldes-server-port-ingest-rest/target/ldes-server-port-ingest-rest-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-port-ingest/target/ldes-server-port-ingest-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-port-fetch/target/ldes-server-port-fetch-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-port-fetch-rest/target/ldes-server-port-fetch-rest-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-admin/target/ldes-server-admin-jar-with-dependencies.jar ./lib/ -COPY ./ldes-fragmentisers/ldes-fragmentisers-common/target/ldes-fragmentisers-common-jar-with-dependencies.jar ./lib/ -COPY ./ldes-fragmentisers/ldes-fragmentisers-geospatial/target/ldes-fragmentisers-geospatial-jar-with-dependencies.jar ./lib/ -COPY ./ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/target/ldes-fragmentisers-timebased-hierarchical-jar-with-dependencies.jar ./lib/ -COPY ./ldes-fragmentisers/ldes-fragmentisers-reference/target/ldes-fragmentisers-reference-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-pagination/target/ldes-server-pagination-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-retention/target/ldes-server-retention-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-compaction/target/ldes-server-compaction-jar-with-dependencies.jar ./lib/ -COPY ./ldes-server-instrumentation/target/ldes-server-instrumentation-jar-with-dependencies.jar ./lib/ +COPY ./ldes-server-infra-postgres/postgres-maintenance-repository/target/postgres-maintenance-repository-jar-with-dependencies.jar ./lib/ +COPY ./ldes-server-infra-postgres/postgres-fetch-repository/target/postgres-fetch-repository-jar-with-dependencies.jar ./lib/ +COPY ./ldes-server-infra-postgres/postgres-ingest-repository/target/postgres-ingest-repository-jar-with-dependencies.jar ./lib/ + +# Interfaces +COPY ./ldes-server-ingest/ldes-server-ingest-rest/target/ldes-server-ingest-rest-jar-with-dependencies.jar ./lib/ +COPY ./ldes-server-fetch/ldes-server-fetch-rest/target/ldes-server-fetch-rest-jar-with-dependencies.jar ./lib/ +COPY ./ldes-server-admin/ldes-server-admin-rest/target/ldes-server-admin-rest-jar-with-dependencies.jar ./lib/ + +# Plugin Fragmentations +COPY ./ldes-server-fragmentation/ldes-server-fragmentation-geospatial/target/ldes-server-fragmentation-geospatial-jar-with-dependencies.jar ./lib/ +COPY ./ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/target/ldes-server-fragmentation-timebased-hierarchical-jar-with-dependencies.jar ./lib/ +COPY ./ldes-server-fragmentation/ldes-server-fragmentation-reference/target/ldes-server-fragmentation-reference-jar-with-dependencies.jar ./lib/ ## Dependency for pyroscope RUN apk --no-cache add libstdc++ diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index 0def98f3af..6ad874275d 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -6,7 +6,7 @@ name: Build Docs on: push: branches: - - master + - main - develop workflow_dispatch: @@ -51,7 +51,7 @@ jobs: with: node-version: 16 registry-url: https://npm.pkg.github.com/ - - run: npm i -g @koumoul/gh-pages-multi + - run: npm i -g @yalz/gh-pages-multi - run: | git config --global user.email "vsds@noreply.com" git config --global user.name "VSDS CI" @@ -59,6 +59,6 @@ jobs: env: PAT: ${{secrets.DEPLOY_DOCS_PAT}} - run: | - gh-pages-multi deploy --title ${{env.title}} -t ${{steps.version.outputs.version}} -s docs/_site + gh-pages-multi deploy --title "${{env.title}}" -t ${{steps.version.outputs.version}} -s docs/_site env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/README.md b/README.md index 0e7b049051..34749faa0a 100644 --- a/README.md +++ b/README.md @@ -11,56 +11,69 @@ open data. ## Table Of Contents - [LDES Server](#ldes-server) - * [Table Of Contents](#table-of-contents) - * [Set-up of the LDES Server](#set-up-of-the-ldes-server) - * [How To Run](#how-to-run) - + [Locally](#locally) - - [Maven](#maven) - - [Profiles](#profiles) - + [Docker Setup](#docker-setup) - - [Docker-compose](#docker-compose) - - [The Config Files](#the-config-files) - - [The docker compose File](#the-docker-compose-file) - - [Starting the Dockerized Application](#starting-the-dockerized-application) - * [Developer Information](#developer-information) - + [How To Build](#how-to-build) - + [How To Test and View Coverage](#how-to-test-and-view-coverage) + - [Table Of Contents](#table-of-contents) + - [Structure of the application](#structure-of-the-application) + - [How To Run](#how-to-run) + - [Maven](#maven) + - [Developer Information](#developer-information) + - [How To Build](#how-to-build) + - [How To Test and View Coverage](#how-to-test-and-view-coverage) - [Unit and Integration Tests](#unit-and-integration-tests) - [Only Unit Tests](#only-unit-tests) - [Only Integration Tests](#only-integration-tests) - - [Auto-Configurable Modules](#auto-configurable-modules) - + [Tracing and Metrics](#tracing-and-metrics) + - [Tracing and Metrics](#tracing-and-metrics) - [Local Tracing and Metrics](#local-tracing-and-metrics) + - [Pyroscope instrumentation](#pyroscope-instrumentation) - [Using Docker](#using-docker) - + [Health and Info](#health-and-info) + - [Health and Info](#health-and-info) - [Local Health and Info](#local-health-and-info) - [Docker](#docker) - + [Logging](#logging) + - [Exposing of details](#exposing-of-details) + - [Logging](#logging) - [Logging configuration](#logging-configuration) -## Set-up of the LDES Server +## Structure of the application -The current implementation consists of the following modules: +LDES Server Dependency Graph With All Profiles Activated: +![LDES Server Dependency Graph With All Profiles Activated](./content/ldes-server-graph.png) +Above is a dependency graph of the LDES server with all the profiles activated. +The graph is color-coded as follows: +- **Orange**: Main functionalities +- **Blue**: Interfaces +- **Lavender**: Plugin fragmentations -- `ldes-server-application` which starts the spring boot application -- `ldes-server-domain` which contains the domain logic of the ldes server -- `ldes-server-infra-mongo` which allows to store ldes members and fragments in a mongoDB -- `ldes-server-port-ingest` which allows to ingest ldes members -- `ldes-server-port-fetch-rest` which allows to retrieve fragments via HTTP -- `ldes-fragmentisers` which support different types of fragmentations +The `ldes-server-domain` is the core domain module of the LDES server and is always loaded in. +To keep the graph clean, it is not shown. +Next to that, the `postgres-liquibase` module will always be loaded in to assure correct database creation. -The modules `ldes-server-infra-mongo` is built so -that it can be replaced by other implementations without the need for code changes in ldes-server-domain. -## How To Run +The LDES server is built using the Spring Boot framework and is structured as a multi-module Maven project. +Each maven profile represents a different functionality of the LDES server that can be toggled. +The default exported image contains all the profiles, but a custom image can be created with only the needed +dependencies. + +| Profile | Dependencies | Description | +|----------------------------|--------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------| +| `fragmentation` | `postgres-pagination-repository` | Allows basic fragmentation (pagination) | +| `maintenance` | `postgres-maintenance-repository` | Allows the LDES server to perform maintenance operations on its Event Streams and Members: compaction, retention, deletion. | +| **Interfaces** | | | +| `http-admin` | `ldes-server-admin-rest`,`postgres-admin-repository`* | Gives access to REST API to create and manage Event Streams and Views. | +| `http-ingest` | `ldes-server-ingest-rest`,`postgres-ingest-repository` | Gives access to REST API to ingest members into the LDES. | +| `http-fetch` | `ldes-server-fetch-rest`,`postgres-fetch-repository` | Gives access to REST API to fetch Event Streams, its Views and pages. | +| **Plugin Fragmentations** | | | +| `fragmentation-timebased` | `ldes-server-fragmentation-timebased-hierarchical` | Allows fragmentation in based on a timebased property. | +| `fragmentation-geospatial` | `ldes-server-fragmentation-geospatial` | Allows fragmentation in based on a geospatial property. | +| `fragmentation-reference` | `ldes-server-fragmentation-reference` | Allows fragmentation in based on a textual property. | + -We'll show you how to set up your own LDES server both locally and via Docker using a mongo db for storage and a rest -endpoint for ingestion and fetch. -Afterwards, you can change storage, ingestion and fetch options by plugging in other components. +*: The `postgres-admin-repository`, as shown by the dependency graph, will be loaded in by the other above-mentioned functionality profiles. +But when used separately, it needs to be loaded in manually. -### Locally +## How To Run + +To run the LDES server, we refer to the versioned documentation available [here](https://informatievlaanderen.github.io/VSDS-LDESServer4J/). -#### Maven +### Maven To locally run the LDES server in Maven, move to the `ldes-server-application` directory and run the Spring Boot application. @@ -80,139 +93,7 @@ cd ldes-server-application mvn spring-boot:run -P{profiles (comma separated with no spaces) } ``` -for example: - -```mvn -mvn spring-boot:run -P{fragmentation-pagination,http-fetch,http-ingest,queue-none,storage-mongo} -``` - -To enrich the server, certain Maven profiles can be activated: - -#### Profiles - -| Profile Group | Profile Name | Description | Parameters | Further Info | -|------------------------------------------|--------------------------------------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------| -| **HTTP Endpoints (Fetch/Ingestion)** | http-ingest | Enables a HTTP endpoint to insert LDES members. | [HTTP configuration](#example-http-ingest-fetch-configuration) | Endpoint:

- URL: /{ldes.collection-name}
- Request type: POST
- Accept: "application/n-quads", "application/n-triples" | -| **HTTP Endpoints (Fetch/Ingestion)** | http-fetch | Enables a HTTP endpoint to retrieve LDES fragments | [Example Views Configuration](#example-views-configuration) | Endpoint:
- URL: /{views.name}

- Request type: GET
- Accept: "application/n-quads", "application/ld+json" | -| **Storage** | storage-mongo | Allows the LDES server to read and write from a mongo database. | [Mongo configuration](#example-mongo-configuration) | | -| **Timebased Fragmentation[DEPRECATED]** | fragmentation-timebased | Supports timebased fragmentation. | [Timebased fragmentation configuration](#example-timebased-fragmentation) | | -| **Geospatial Fragmentation** | fragmentation-geospatial | Supports geospatial fragmentation. | [Geospatial fragmentation configuration](#example-geospatial-fragmentation) | | -| **Pagination Fragmentation** | fragmentation-pagination | Supports pagination. | [Pagination configuration](#example-pagination) | The pagenumbers start with pagenumber 1 | -| **Hierarchical Timebased Fragmentation** | fragmentation-timebased-hierarchical | Supports hierarchical timebased fragmentation. | [Timebased fragmentation configuration](#example-hierarchical-timebased-fragmentation) | | -| **Ldes-queues** | queue-none | Members are fragmented immediately. | N/A activating the profile is enough | | -| **Ldes-queues** | queue-in-memory | Members are queued in memory before fragmentation. | N/A activating the profile is enough | | -| **HTTP Endpoints (Admin)** | http-admin | Enables HTTP endpoints. These will be used later to configure different streams | | | -| **Instrumentation** | instrumentation | Enables pyroscope to collect data for instrumentation. | [Pyroscope configuration](#Pyroscope instrumentation) | | - -The main functionalities of the server are ingesting and fetching, these profiles depend on other supporting profiles to -function properly: - -- http-ingest: requires at least one queue, one fragmentation and one storage profile. -- http-fetch: requires at least one storage profile - -#### Config - -To run the server, some properties must be configured. The minimal config can be -found [here](ldes-server-application/examples/minimal-config-application.yml) - -##### Overview server config - - ```yaml -ldes-server: - host-name: "http://localhost:8080" - use-relative-url: true - ``` - -| Property | Description | Required | Default | Example | Supported values | -|:---------------------------|:--------------------------------------------------------------------------------------------------------------------|:---------|:---------------------|:----------------------|:--------------------------| -| host-name | The host name of the server, used as a prefix for resources hosted on the server. | Yes | N/A | http://localhost:8080 | HTTP and HTTPS urls | -| use-relative-url | Determines if the resources hosted on the server are constructed with a relative URI | No | false | true, false | true, false | -| max-jsonld-cache-capacity | A cache is used when fetching json-ld contexts. The number of cached contexts can be configured with this property. | No | 100 | 50 | Integer | -| admin.port | Determines the port on which the admin api will be available | No | value of server.port | 8080 | any available port number | -| fetch.port | Determines the port on which the fetch api will be available | No | value of server.port | 8080 | any available port number | -| ingest.port | Determines the port on which the ingest api will be available | No | value of server.port | 8080 | any available port number | - -##### Example Serving Static Content - - ```yaml -spring: - mvc: - static-path-pattern: { pattern used in url for static content, e.g. /content/** for serving on http://localhost:8080/content/ } - web: - resources: - static-locations: { source folder of static content, e.g. file:/opt/files } - ``` - -##### Example Serving DCAT Metadata - -Supported file formats: .ttl, .rdf, .nq and .jsonld -Templates for configuring the DCAT metadata can be found [here](templates/dcat) -A detailed explanation on how to manage and retrieve the DCAT metadata can be -found [here](ldes-server-admin/README.md#dcat-endpoints). - -##### Relative urls - -To enable relative urls on the server, set the following property: - - ```yaml -ldes-server: - use-relative-url: true - ``` - -When fetching any page using relative urls, any resource hosted on the server will have a URI relative to the requested -page. - -> **Note**: When using relative urls, GET requests can not be performed with N-quads or triples as accept-type. -> This is because these types don't support resolving the relative URI's - -##### Port bindings - -To change the ports of the diffrent API's, use the following config: - ```yaml -ldes-server: - admin: - port: 8080 - fetch: - port: 8081 - ingest: - port: 8082 - ``` - -Any combination of these ports can be the same of completely omitted. -When no port number is given, the default server port will be used. - -### Docker Setup - -#### Docker-compose - -There are 2 files where you can configure the dockerized application: - -- [The config files](#the-config-files) -- [The docker compose file](#the-docker-compose-file) - -#### The Config Files - -Runtime settings can be defined in the configuration files. Use [config.env](docker-compose/config.env) for a public -setup and be sure not to commit this file, as it contains secrets. For a local setup, -use [config.local.env](docker-compose/config.local.env). - -#### The docker compose File - -Change the `env_file` to `config.env` or `config.local.env` in [compose.yml](docker-compose.yml) according to -your needs. - -#### Starting the Dockerized Application - -Run the following commands to start the containers: - -```bash -COMPOSE_DOCKER_CLI_BUILD=1 docker-compose build -docker-compose up -``` - -> **Note**: Using Docker Desktop might fail because of incorrect environment variable interpretation. -> -> ```unexpected character "-" in variable name near ...``` +The needed profiles can be found in the Structure of the application section. ## Developer Information @@ -256,16 +137,6 @@ For running the integration tests of the project, execute the following command mvn clean verify -Dunittestskip=true ``` -#### Auto-Configurable Modules - -- ldes-server-infra-mongo -- ldes-server-port-ingest -- ldes-server-port-publication-rest -- ldes-fragmentisers-timebased-hierarchical -- ldes-fragmentisers-geospatial -- ldes-fragmentisers-pagination -- ldes-fragmentisers-reference - ### Tracing and Metrics Additionally, it is possible to keep track of metrics and tracings of the LDES Server. diff --git a/content/c4.mermaid b/content/c4.mermaid new file mode 100644 index 0000000000..a9b0fe7cdb --- /dev/null +++ b/content/c4.mermaid @@ -0,0 +1,52 @@ +C4Context + title LDES Server Context Diagram + + + Person(user, "User", "A user of the LDES Server") + + SystemDb(db, "Postgres Database", "A PostgreSQL database used by the LDES Server") + + Boundary(ldesApp, "LDES Server Application", "Java Spring Boot Application") { + + Boundary(interfaces, "LDES Server Interfaces", "") { + Container(ldesIngestRest, "Ingest REST API", "Java", "Handles data ingestion") + Container(ldesFetchRest, "Fetch REST API", "Java", "Handles data fetching") + Container(ldesAdminRest, "Admin REST API", "Java", "Provides administrative functionalities") + } + + Boundary(implementations, "Postgres Implementations", "") { + Container(postgresIngestRepo, "Postgres Ingest Implementation", "Ingest data implementation") + Container(postgresFetchRepo, "Postgres Fetch Implementation", "Fetch data implementation") + Container(postgresAdminRepo, "Postgres Admin Implementation", "Admin data implementation") + Container(postgresPaginationRepo, "Postgres Pagination Implementation", "Pagination data implementation") + Container(postgresMaintenanceRepo, "Postgres Maintenance Implementation", "Maintenance data implementation") + Container(postgresFragmentationRepo, "Postgres Fragmentation Implementation", "Fragmentation data implementation") + } + + Boundary(plugins, "Fragmentation Plugins") { + Container(ldesFragmentationGeospatial, "Geospatial Fragmentation", "Java", "Geospatial fragmentation logic") + Container(ldesFragmentationTimebased, "Time-based Fragmentation", "Java", "Time-based fragmentation logic") + Container(ldesFragmentationReference, "Reference Fragmentation", "Java", "Reference fragmentation logic") + } + + } + + Rel(user, ldesAdminRest, "Uses") + Rel(user, ldesIngestRest, "Uses") + Rel(user, ldesFetchRest, "Uses") + Rel(ldesAdminRest, postgresAdminRepo, "Reads/Writes") + Rel(ldesIngestRest, postgresIngestRepo, "Reads/Writes") + Rel(ldesFetchRest, postgresFetchRepo, "Reads/Writes") + Rel(ldesFragmentationGeospatial, postgresFragmentationRepo, "Reads/Writes") + Rel(ldesFragmentationTimebased, postgresFragmentationRepo, "Reads/Writes") + Rel(ldesFragmentationReference, postgresFragmentationRepo, "Reads/Writes") + + Rel(postgresIngestRepo, db, "Reads/Writes") + Rel(postgresFetchRepo, db, "Reads/Writes") + Rel(postgresAdminRepo, db, "Reads/Writes") + Rel(postgresPaginationRepo, db, "Reads/Writes") + Rel(postgresMaintenanceRepo, db, "Reads/Writes") + Rel(postgresFragmentationRepo, db, "Reads/Writes") + + + UpdateLayoutConfig($c4ShapeInRow="6", $c4BoundaryInRow="3") \ No newline at end of file diff --git a/content/dependency-graph.dot b/content/dependency-graph.dot new file mode 100644 index 0000000000..e7a0e1f7e5 --- /dev/null +++ b/content/dependency-graph.dot @@ -0,0 +1,63 @@ +digraph "ldes-server" { + node [shape="box",style="rounded",fontname="Helvetica",fontsize="14"] + edge [fontsize="10",fontname="Helvetica"] + + // Node Definitions: + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-pagination:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-common:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-geospatial:jar:compile"[label=, fillcolor="#E6E6FA", style="filled"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-timebased-hierarchical:jar:compile"[label=, fillcolor="#E6E6FA", style="filled"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-reference:jar:compile"[label=, fillcolor="#E6E6FA", style="filled"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-admin-rest:jar:compile"[label=, fillcolor="#87CEFA", style="filled"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-admin-common:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-ingest-rest:jar:compile"[label=, fillcolor="#87CEFA", style="filled"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-ingest-common:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fetch-rest:jar:compile"[label=, fillcolor="#87CEFA", style="filled"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fetch-common:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-retention:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-maintenance-common:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-compaction:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:postgres-admin-repository:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:postgres-ingest-repository:jar:compile"[label=, fillcolor="#FFDAB9", style="filled"] + "be.vlaanderen.informatievlaanderen.vsds:postgres-fragmentation-repository:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:postgres-maintenance-repository:jar:compile"[label=, fillcolor="#FFDAB9", style="filled"] + "be.vlaanderen.informatievlaanderen.vsds:postgres-pagination-repository:jar:compile"[label=, fillcolor="#FFDAB9", style="filled"] + "be.vlaanderen.informatievlaanderen.vsds:postgres-fetch-repository:jar:compile"[label=, fillcolor="#FFDAB9", style="filled"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile"[label=] + "be.vlaanderen.informatievlaanderen.vsds:postgres-liquibase:jar:compile"[label=] + + // Edge Definitions: + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-pagination:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-geospatial:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-timebased-hierarchical:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-reference:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-admin-rest:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-admin-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-ingest-rest:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-ingest-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fetch-rest:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fetch-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fetch-rest:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-admin-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-retention:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-maintenance-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-compaction:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-maintenance-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-admin-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-admin-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-ingest-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-ingest-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-ingest-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:postgres-admin-repository:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-fragmentation-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-fragmentation-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:postgres-admin-repository:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-maintenance-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-retention:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-maintenance-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-compaction:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-maintenance-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:postgres-admin-repository:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-pagination-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-pagination:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-pagination-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:postgres-fragmentation-repository:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-fetch-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fetch-common:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:postgres-fetch-repository:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:postgres-admin-repository:jar:compile" + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:postgres-liquibase:jar:compile" [label="Database Changes"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-ingest-rest:jar:compile" [label="Ingest REST API"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:postgres-ingest-repository:jar:compile" [label="Ingest Implementation"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fetch-rest:jar:compile" [label="Fetch REST API"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:postgres-fetch-repository:jar:compile" [label="Fetch Implementation"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:postgres-pagination-repository:jar:compile" [label="Basic Fragmentation Implementation"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-geospatial:jar:compile" [label="Plugin Fragmentation"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-timebased-hierarchical:jar:compile" [label="Plugin Fragmentation"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-fragmentation-reference:jar:compile" [label="Plugin Fragmentation"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:ldes-server-admin-rest:jar:compile" [label="Admin REST API"] + "be.vlaanderen.informatievlaanderen.vsds:ldes-server-application:jar:compile" -> "be.vlaanderen.informatievlaanderen.vsds:postgres-maintenance-repository:jar:compile" [label="Maintenance Implementation"] +} \ No newline at end of file diff --git a/content/ldes-server-graph.png b/content/ldes-server-graph.png new file mode 100644 index 0000000000..8ea0f4d5c8 Binary files /dev/null and b/content/ldes-server-graph.png differ diff --git a/docs/_configuration/event-stream.md b/docs/_configuration/event-stream.md index 60918dbfd8..6b3fe92f66 100644 --- a/docs/_configuration/event-stream.md +++ b/docs/_configuration/event-stream.md @@ -18,20 +18,26 @@ An Event Stream config needs to contain a couple of items: policies. This property also indicates which state object your version object is a snapshot of. * `ldes:createVersions` object that defines whether the LDES should create version objects, indicating the LDES can - ingest state objects. + ingest state objects. \ The default value of this object is `false` and the property can be omitted. + * `ldes:versionDelimiter` object that defines how the version object id will be constructed. (versionOf + + delimiter + dateObserved) \ + The default value of this object is `/` and the property can be omitted. * `ldes:eventSource` object that defines which members are to be retained in the event stream. - When omitted, all members are retained. More info on this can be found [here](./event-stream#configuring-member-deletion-on-an-event-stream) - * `ldes:skolemizationDomain` object that defines the [skolemization](../features/skolemization) domain. - Using `"http://example.com"` as domain will result in all blank nodes being transformed to `http://example.org/.well-known/genid/{unique_id}`. + When omitted, all members are retained. More info on this can be + found [here](./event-stream#configuring-member-deletion-on-an-event-stream) + * `ldes:skolemizationDomain` object that defines the [skolemization](../features/skolemization) domain. + Using `"http://example.com"` as domain will result in all blank nodes being transformed to + `http://example.org/.well-known/genid/{unique_id}`. * For more info, visit the [Swagger API documentation.](./admin-api) ### Create version objects vs ingest version objects Until version `2.11.0`, only version objects could be ingested. But from version `2.12.0`, either version objects or -state objects could be ingested in an event stream. This results in a slightly other meaning for both the `ldes:timestampPath` -and `ldes:versionOfPath` properties. +state objects could be ingested in an event stream. This results in a slightly other meaning for both the +`ldes:timestampPath` +and `ldes:versionOfPath` properties. In case of **version ingestion**, those properties are used to extract the information of the member. \ In case of **version creation**, those properties are used to append information to the member on fetching. @@ -110,25 +116,36 @@ For more info, visit the [Swagger API documentation.](./admin-api) ## Configuring member deletion on an Event Stream -To determine which members should be permanently deleted from the Event Stream, it is necessary to set one or more retention policies on the event source of the Event Stream. +To determine which members should be permanently deleted from the Event Stream, it is necessary to set one or more +retention policies on the event source of the Event Stream. Definition of event source: -> In Linked Data Event Streams, the ldes:EventSource class is designed to be the source for all derived views. The Linked Data Event Streams specification can also further elaborate on the ViewDescription by for example describing a retention policy on top of it. +> In Linked Data Event Streams, the ldes:EventSource class is designed to be the source for all derived views. The +> Linked Data Event Streams specification can also further elaborate on the ViewDescription by for example describing a +> retention policy on top of it. -By default, no retention policy is set on the event source meaning that no data is removed from the Event Stream. Even when all views are deleted, the members will not be deleted from the Event Stream. +By default, no retention policy is set on the event source meaning that no data is removed from the Event Stream. Even +when all views are deleted, the members will not be deleted from the Event Stream. -When a retention policy is set on the event source of an Event Stream, every member that is not part of any view and which falls outside of the retention policy will be removed from the Event Stream. +When a retention policy is set on the event source of an Event Stream, every member that is not part of any view and +which falls outside of the retention policy will be removed from the Event Stream. More information on which retention policies can be used can be found [here](./retention-policies/index). -The event source is automatically created when creating an Event Stream but does not contain a retention policy by default. -To add retention policies to the event source, the admin API can be used. More info on this can be found [here](./admin-api). +The event source is automatically created when creating an Event Stream but does not contain a retention policy by +default. +To add retention policies to the event source, the admin API can be used. More info on this can be +found [here](./admin-api). It is only possible to add or edit retention policies of an event source, other properties cannot be changed. -Before introduction of the event source in the LDES Server, members were directly deleted when they weren't part of any view anymore. -With the event source, it is possible to delete all views of an Event Stream without losing members so that you can create new views without having to ingest data again. -If members need to be deleted directly from the Event Stream when they aren't part of any view, a timebased retention policy of a few seconds can be set on the event source of the Event Stream. +Before introduction of the event source in the LDES Server, members were directly deleted when they weren't part of any +view anymore. +With the event source, it is possible to delete all views of an Event Stream without losing members so that you can +create new views without having to ingest data again. +If members need to be deleted directly from the Event Stream when they aren't part of any view, a timebased retention +policy of a few seconds can be set on the event source of the Event Stream. ### Example: + ````turtle @prefix ldes: . diff --git a/docs/_configuration/openapi.json b/docs/_configuration/openapi.json index 4ac137eab2..5ac5de2c73 100644 --- a/docs/_configuration/openapi.json +++ b/docs/_configuration/openapi.json @@ -3,7 +3,7 @@ "info": { "title": "LDES Server Admin API", "description": "This API makes it possible to manage an LDES Server", - "version": "3.1.0" + "version": "3.5.0" }, "servers": [ { @@ -383,7 +383,7 @@ "schema": { "type": "string" }, - "example": "@prefix ldes: .\n@prefix dcterms: .\n@prefix tree: .\n\n<> a ldes:EventSource ;\n ldes:retentionPolicy [\n a ldes:DurationAgoPolicy ;\n tree:value \"PT5S\"^^ ;\n ] .\n" + "example": "@prefix ldes: .\n@prefix dcterms: .\n@prefix tree: .\n\n<> a ldes:EventSource ;\n\tldes:retentionPolicy [\n\t\ta ldes:DurationAgoPolicy ;\n\t\ttree:value \"PT5S\"^^ ;\n\t] .\n" }, "application/n-quads": { "schema": { @@ -854,24 +854,126 @@ "schema": { "type": "string" }, - "example": "@prefix ldes: .\n@prefix dcterms: .\n@prefix tree: .\n@prefix sh: .\n@prefix server: .\n@prefix xsd: .\n@prefix event-stream: .\n\nserver:event-stream a ldes:EventStream ;\n\tldes:timestampPath dcterms:created ;\n\tldes:versionOfPath dcterms:isVersionOf ;\n\ttree:shape event-stream:shape .\n\nevent-stream:shape a sh:NodeShape .\n" + "examples": { + "Version Objects ingestion": { + "description": "An event stream that ingests version objects", + "value": "@prefix ldes: .\n@prefix dcterms: .\n@prefix prov: .\n@prefix tree: .\n@prefix sh: .\n@prefix server: .\n@prefix xsd: .\n@prefix event-stream: .\n\nserver:event-stream a ldes:EventStream ;\n\tldes:timestampPath dcterms:created ;\n\tldes:versionOfPath dcterms:isVersionOf ;\n\ttree:shape event-stream:shape .\n\nevent-stream:shape a sh:NodeShape .\n" + }, + "State Objects ingestion": { + "description": "An event stream that ingests state objects", + "value": "@prefix ldes: .\n@prefix dcterms: .\n@prefix prov: .\n@prefix tree: .\n@prefix sh: .\n@prefix server: .\n@prefix xsd: .\n@prefix event-stream: .\n\nserver:event-stream a ldes:EventStream ;\n\tldes:timestampPath dcterms:created ;\n\tldes:versionOfPath dcterms:isVersionOf ;\n\tldes:createVersions true ;\n\ttree:shape event-stream:shape .\n\nevent-stream:shape a sh:NodeShape .\n" + }, + "State Objects ingestion with custom delimiter": { + "description": "An event stream that ingests state objects with a custom version delimiter", + "value": "@prefix ldes: .\n@prefix dcterms: .\n@prefix prov: .\n@prefix tree: .\n@prefix sh: .\n@prefix server: .\n@prefix xsd: .\n@prefix event-stream: .\n\nserver:event-stream a ldes:EventStream ;\n\tldes:timestampPath dcterms:created ;\n\tldes:versionOfPath dcterms:isVersionOf ;\n\tldes:createVersions true ;\n\tldes:versionDelimiter \"&version=\" ;\n\ttree:shape event-stream:shape .\n\nevent-stream:shape a sh:NodeShape .\n" + } + } }, "application/n-quads": { "schema": { "type": "string" }, - "example": " .\n .\n .\n .\n .\n" + "examples": { + "Version Objects ingestion": { + "description": "An event stream that ingests version objects", + "value": " .\n .\n .\n .\n .\n" + }, + "State Objects ingestion": { + "description": "An event stream that ingests state objects", + "value": " .\n .\n .\n \"true\"^^ .\n .\n .\n" + }, + "State Objects ingestion with custom delimiter": { + "description": "An event stream that ingests state objects with a custom version delimiter", + "value": " .\n .\n .\n \"true\"^^ .\n \"&version=\"^^ .\n .\n .\n" + } + } }, "application/ld+json": { "schema": { "type": "string" }, - "example": "[{\"@id\":\"http://localhost:8080/event-stream\",\"@type\":[\"https://w3id.org/ldes#EventStream\"],\"https://w3id.org/ldes#timestampPath\":[{\"@id\":\"http://purl.org/dc/terms/created\"}],\"https://w3id.org/ldes#versionOfPath\":[{\"@id\":\"http://purl.org/dc/terms/isVersionOf\"}],\"https://w3id.org/tree#shape\":[{\"@id\":\"http://localhost:8080/event-stream/shape\"}]},{\"@id\":\"http://localhost:8080/event-stream/shape\",\"@type\":[\"http://www.w3.org/ns/shacl#NodeShape\"]},{\"@id\":\"http://purl.org/dc/terms/created\"},{\"@id\":\"http://purl.org/dc/terms/isVersionOf\"},{\"@id\":\"http://www.w3.org/ns/shacl#NodeShape\"},{\"@id\":\"https://w3id.org/ldes#EventStream\"}]" + "examples": { + "Version Objects ingestion": { + "description": "An event stream that ingests version objects", + "value": { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } + }, + "State Objects ingestion": { + "description": "An event stream that ingests state objects", + "value": { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "ldes:createVersions": true, + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } + }, + "State Objects ingestion with custom delimiter": { + "description": "An event stream that ingests state objects with a custom version delimiter", + "value": { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "ldes:createVersions": true, + "ldes:versionDelimiter": "&version=", + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } + } + } } }, "required": true }, "responses": { + "400": { + "description": "The provided config is not valid" + }, "201": { "description": "Created", "content": { @@ -879,66 +981,117 @@ "schema": { "type": "string" }, - "example": "@prefix ldes: .\n@prefix dcterms: .\n@prefix tree: .\n@prefix sh: .\n@prefix server: .\n@prefix xsd: .\n@prefix event-stream: .\n\nserver:event-stream a ldes:EventStream ;\n\tldes:timestampPath dcterms:created ;\n\tldes:versionOfPath dcterms:isVersionOf ;\n\tldes:createVersions false ;\n\ttree:shape event-stream:shape .\n\nevent-stream:shape a sh:NodeShape .\n" + "examples": { + "Version Objects ingestion": { + "description": "An event stream that ingests version objects", + "value": "@prefix ldes: .\n@prefix dcterms: .\n@prefix prov: .\n@prefix tree: .\n@prefix sh: .\n@prefix server: .\n@prefix xsd: .\n@prefix event-stream: .\n\nserver:event-stream a ldes:EventStream ;\n\tldes:timestampPath dcterms:created ;\n\tldes:versionOfPath dcterms:isVersionOf ;\n\ttree:shape event-stream:shape .\n\nevent-stream:shape a sh:NodeShape .\n" + }, + "State Objects ingestion": { + "description": "An event stream that ingests state objects", + "value": "@prefix ldes: .\n@prefix dcterms: .\n@prefix prov: .\n@prefix tree: .\n@prefix sh: .\n@prefix server: .\n@prefix xsd: .\n@prefix event-stream: .\n\nserver:event-stream a ldes:EventStream ;\n\tldes:timestampPath dcterms:created ;\n\tldes:versionOfPath dcterms:isVersionOf ;\n\tldes:createVersions true ;\n\ttree:shape event-stream:shape .\n\nevent-stream:shape a sh:NodeShape .\n" + }, + "State Objects ingestion with custom delimiter": { + "description": "An event stream that ingests state objects with a custom version delimiter", + "value": "@prefix ldes: .\n@prefix dcterms: .\n@prefix prov: .\n@prefix tree: .\n@prefix sh: .\n@prefix server: .\n@prefix xsd: .\n@prefix event-stream: .\n\nserver:event-stream a ldes:EventStream ;\n\tldes:timestampPath dcterms:created ;\n\tldes:versionOfPath dcterms:isVersionOf ;\n\tldes:createVersions true ;\n\tldes:versionDelimiter \"&version=\" ;\n\ttree:shape event-stream:shape .\n\nevent-stream:shape a sh:NodeShape .\n" + } + } }, "application/n-quads": { "schema": { "type": "string" }, - "example": " .\n .\n .\n \"false\"^^ .\n .\n .\n" + "examples": { + "Version Objects ingestion": { + "description": "An event stream that ingests version objects", + "value": " .\n .\n .\n .\n .\n" + }, + "State Objects ingestion": { + "description": "An event stream that ingests state objects", + "value": " .\n .\n .\n \"true\"^^ .\n .\n .\n" + }, + "State Objects ingestion with custom delimiter": { + "description": "An event stream that ingests state objects with a custom version delimiter", + "value": " .\n .\n .\n \"true\"^^ .\n \"&version=\"^^ .\n .\n .\n" + } + } }, "application/ld+json": { - "example": [ - { - "@id": "http://localhost:8080/event-stream", - "@type": [ - "https://w3id.org/ldes#EventStream" - ], - "https://w3id.org/ldes#timestampPath": [ - { - "@id": "http://purl.org/dc/terms/created" - } - ], - "https://w3id.org/ldes#versionOfPath": [ - { - "@id": "http://purl.org/dc/terms/isVersionOf" - } - ], - "https://w3id.org/ldes#createVersions": [ - { - "@value": false + "examples": { + "Version Objects ingestion": { + "description": "An event stream that ingests version objects", + "value": { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" } - ], - "https://w3id.org/tree#shape": [ - { - "@id": "http://localhost:8080/event-stream/shape" - } - ] - }, - { - "@id": "http://localhost:8080/event-stream/shape", - "@type": [ - "http://www.w3.org/ns/shacl#NodeShape" - ] - }, - { - "@id": "http://purl.org/dc/terms/created" - }, - { - "@id": "http://purl.org/dc/terms/isVersionOf" + } }, - { - "@id": "http://www.w3.org/ns/shacl#NodeShape" + "State Objects ingestion": { + "description": "An event stream that ingests state objects", + "value": { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "ldes:createVersions": true, + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } }, - { - "@id": "https://w3id.org/ldes#EventStream" + "State Objects ingestion with custom delimiter": { + "description": "An event stream that ingests state objects with a custom version delimiter", + "value": { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "ldes:createVersions": true, + "ldes:versionDelimiter": "&version=", + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } } - ] + } } } - }, - "400": { - "description": "The provided config is not valid" } } } diff --git a/docs/_ingest/http.md b/docs/_ingest/http.md index 3ed13bc129..8cfb395d2c 100644 --- a/docs/_ingest/http.md +++ b/docs/_ingest/http.md @@ -36,7 +36,9 @@ properties, which includes: - the named subject node, which is the versionOf, will be replaced with the member id, which has the following - structure: `{versionOf}/{timestamp}` + structure: `{versionOf}{versionDelimiter}{timestamp}`. By default, the `versionDelimiter` is `/`, but this can be + configured with any string, which then results in the following structure for the named subject node: + `{versionOf}/{timestamp}`. - the following statements will be added: * `<{memberId}> <{timestamp-path-of-the-ldes}> "{timestamp}""^^` * `<{memberId}> <{version-of-path-of-the-ldes}> ` @@ -59,11 +61,15 @@ Every member should conform to certain conditions, depending on the event stream ### Named nodes Every named node is viewed as a member. -Having a named node that is not intended as a member to be ingested on the collection can lead to several validation errors. -Most commonly this will lead to a validation error stating the timestamp path and version-of path are missing, depending on the data itself. +Having a named node that is not intended as a member to be ingested on the collection can lead to several validation +errors. +Most commonly this will lead to a validation error stating the timestamp path and version-of path are missing, depending +on the data itself. If by chance it conforms to the all following validation, it will be treated as any normal member. -To prevent such cases, additional [shacl validation can be configured](../configuration/event-stream#configuring-a-shacl-shape) on the event stream. +To prevent such cases, +additional [shacl validation can be configured](../configuration/event-stream#configuring-a-shacl-shape) on the event +stream. ### Named Graphs @@ -73,7 +79,8 @@ When a named graph is present, the model is rejected. ### Shared or Loose Blank Nodes All blank nodes should be referenced by exactly 1 other subject. -When a blank node is present that is not the object of a statement or the object of 2 or more statements with different subjects, the ingested model is rejected. +When a blank node is present that is not the object of a statement or the object of 2 or more statements with different +subjects, the ingested model is rejected. This also means that the root node of every member should be a named node. @@ -87,16 +94,20 @@ If version creation is enabled, these properties should NOT be present on the me The timestamp defined on the timestamp path should be of the type ``. The timestamp must have this datatype explicitly declared. -ex. ` "1996-03-28T09:58:15.867Z"^^ .` +example: +` "1996-03-28T09:58:15.867Z"^^ .` -The object defined on the versionOf path must be a uri. This uri should represent the state object of which the member is a version. +The object defined on the versionOf path must be a uri. This uri should represent the state object of which the member +is a version. ex. ` .` ### Bulk Ingestion -Depending on if the event stream has version creation enabled, multiple members can be ingested with a single POST request. +Depending on if the event stream has version creation enabled, multiple members can be ingested with a single POST +request. Later this will also be possible without version creation. -For now, a request will be rejected if multiple named nodes are found which are not referenced by any triple. (Without version creation enabled) +For now, a request will be rejected if multiple named nodes are found which are not referenced by any triple. (Without +version creation enabled) ## Duplicate Members diff --git a/docs/how-to-run.md b/docs/how-to-run.md index 8bb59ef91e..d9f4a75fb1 100644 --- a/docs/how-to-run.md +++ b/docs/how-to-run.md @@ -126,28 +126,16 @@ Here is an explanation provided for all the possibilities on how to tweak and co */30 * * * * * Fragment Compaction - - ldes-server.compaction-cron - Defines how often the Compaction Service will check the fragments3 - No - 0 0 0 * * * - ldes-server.compaction-duration Defines how long the redundant compacted fragments will remain on the server No PD7 + Maintenance - ldes-server.deletion-cron - Defines how often the redundant compacted fragments will be checked for deletion3 - No - 0 0 0 * * * - - Retention (Retention Policies) - - ldes-server.retention-cron - Defines how often the Retention Service will check the members3 + ldes-server.maintenance-cron + Defines how often the maintenance job will run, which includes retention, compaction and deletion3 No 0 0 0 * * * diff --git a/ldes-fragmentisers/ldes-fragmentisers-pagination/content/paginationAlgorithm.drawio b/ldes-fragmentisers/ldes-fragmentisers-pagination/content/paginationAlgorithm.drawio deleted file mode 100644 index 5cd8a09e65..0000000000 --- a/ldes-fragmentisers/ldes-fragmentisers-pagination/content/paginationAlgorithm.drawio +++ /dev/null @@ -1 +0,0 @@ -7VtLd5s4FP41XraHp4OXceykp2fcyZksZrpUjGyrA4gIYZv++pFAMiDhR1sMpJ5NYl0kIX33fvflZGQ/hPsnAuLNAvswGFmGvx/Zs5Flea7HfnJBVggc2ykEa4L8QmSWghf0HQqhIaQp8mFSm0gxDiiK68IljiK4pDUZIATv6tNWOKi/NQZrqAleliDQpX8jn27ktYxS/gmi9Ua+2TTEkxDIyUKQbICPdxWRPR/ZDwRjWnwK9w8w4NhJXIp1j0eeHg5GYEQvWrDbIz/7jPxP2/Hz83OSbP8KP/AF+eFoJm8MfQaAGGJCN3iNIxDMS+mU4DTyId/WYKNyzh8Yx0xoMuE3SGkmtAlSiploQ8NAPGUnJtk/fP1HVw6/iu3ywWxfG2VipF9ZoJDglCzhiXtK0wFkDekpPMREDkLlDQLRJ4hDyA7EJhAYAIq2dSsBwtjWh3mlPtgHoZIfUI/YdwuCVLxpAcNXSPi6JD/FEsEtU4WqxLqKdhtE4UsMcoh2jKd1dRyFdQsJhfuTOIin1lhYuaD5nRjuSs6YkgibCl/kstaRs8a3YdjWhYbtDcquLc2uHxFJKHfQBKxDjoKw8CWBgHIDZ6bELEk4bMuIUsEDU9Nz17bvTNya7Zvjvo3/7rew/bM2PW7bpsXSZ4xyAxT6ta26b7NsRW8FScUqRXWHY/y8Nif9arOmy1K1rXuy8bv0ZKb9W3CtNe2Y1qDUM9YCzZ8xjOpxZpXyPR/1OLLB4WuadJM/eYqP8fQY4jWEEO9q+ZN3G17Hu9CurbtB2bWn2fW9z5OkUJYHDNmqkQ8sRbImfadIpl5arUCQQA0qdkNaxwMEaB2xz0uGB8PannIc0BIE9+JBiHy/4ANM0Hfwmm/FgY55ipDfxJ2O3Bnfi1EgKdjAt04owf/CBxxgtu8swhHfZYWCQBG1oRLHOKsSt0EjavLTnkZ6rti68jgyQp4Ppe6gXI48d4UxX+DuVMnWs9M5tOJk67H3usx0NAgpSW/H51hqJdXgc5xOfc6NZDntu5LmUtmx6nHemSiaK5ze1Uplec8KwZ4J3CKcJnVH9QqX7GVciMIwpTlf+vZXag91AP6q59ZDvbg1z9AD7hGtLGOjr5Un5SI++CFKfd76T1m2WLxN1y/zqTl7i98WH9wLo3jr7Ypm5rmuwjyr2yaV1XMfpCtPenFzclh9EEsvd/RGCGNGwlOFYbVCTLfvVoietd1WqWi7ikYaAlOnpaKlh/mbyqOPfiPRVx4tu2MVhcy/zPSIEAQoTuB5NwKSuPhjjhXa8/jQBmjjOwW0DlusjRmE7pKnyEeEXRzxIHiIDThqwydrQDXAebxZpOb1HfrkRux0l1z0PyVieWDDIfsVqT2KvDNayfpb7ZL+Esqu0pJzzQ4LgFNJ7gUwNwNagK2qYGAwH1Ll3mCWfaH3lDwrie3Zb/CP07j9WshQvJU3+ejWNzlSDTWUVca5rY60NO4JAVllmsgfjh9aiemydXL0ZMp8adWlHRYn+Nkqr9lQ3X4NtauGwCXGfbZD4FxIAvc6JDDVVlxrJDiMW6bAWGnYu8ZpCpyZfyUKvKuvqSQFzCoBDnS4OgUujQP/U6ClKCAT8+tSQK/2MphotBhw9f1rxZDSoHIb8sdrVd/N+tD/GiTCN6QOheXO1dTBhuX/axRsKv/pxZ7/Bw== \ No newline at end of file diff --git a/ldes-fragmentisers/ldes-fragmentisers-pagination/content/paginationAlgorithm.png b/ldes-fragmentisers/ldes-fragmentisers-pagination/content/paginationAlgorithm.png deleted file mode 100644 index 7c01fa93fa..0000000000 Binary files a/ldes-fragmentisers/ldes-fragmentisers-pagination/content/paginationAlgorithm.png and /dev/null differ diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/bucketising/ReferenceBucketiserTest.java b/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/bucketising/ReferenceBucketiserTest.java deleted file mode 100644 index 9ac87a25f5..0000000000 --- a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/bucketising/ReferenceBucketiserTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.bucketising; - -import be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.config.ReferenceConfig; -import org.apache.jena.rdf.model.Model; -import org.apache.jena.riot.RDFParser; -import org.apache.jena.vocabulary.RDF; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.ServerConstants.DEFAULT_BUCKET_STRING; -import static org.assertj.core.api.Assertions.assertThat; - -class ReferenceBucketiserTest { - - private final ReferenceConfig config = new ReferenceConfig(RDF.type.getURI()); - private ReferenceBucketiser referenceBucketiser; - - private final String memberId = "https://data.vlaanderen.be/id/perceel/13374D0779-00D003/2022-11-29T11:37:27+01:00"; - - @BeforeEach - void setUp() { - referenceBucketiser = new ReferenceBucketiser(config); - } - - @Test - void shouldReturnSetOfFoundResources() { - Model model = RDFParser.source("member-with-two-types.ttl").toModel(); - - assertThat(referenceBucketiser.createReferences(memberId, model)) - .hasSize(2) - .contains("https://basisregisters.vlaanderen.be/implementatiemodel/gebouwenregister#Perceel") - .contains("https://basisregisters.vlaanderen.be/implementatiemodel/gebouwenregister#Gebouw"); - } - - @Test - void shouldReturnDefaultBucketString() { - Model model = RDFParser.source("member-with-two-types.ttl").toModel(); - - assertThat(referenceBucketiser.createReferences("faulty", model)) - .hasSize(1) - .contains(DEFAULT_BUCKET_STRING); - } - - @Test - void when_MemberHasInvalidURI_Then_ReturnOnlyCorrectBucket() { - Model model = RDFParser.source("member-with-two-types-faulty.ttl").toModel(); - - assertThat(referenceBucketiser.createReferences(memberId, model)) - .hasSize(1) - .contains("https://basisregisters.vlaanderen.be/implementatiemodel/gebouwenregister#Perceel"); - } - - @Test - void shouldSkipResultsThatAreNotUris() { - Model model = RDFParser.source("member-with-string-type.ttl").toModel(); - - assertThat(referenceBucketiser.createReferences(memberId, model)).hasSize(1) - .contains(DEFAULT_BUCKET_STRING); - } - -} \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-common/pom.xml b/ldes-server-admin/ldes-server-admin-common/pom.xml new file mode 100644 index 0000000000..5c19354984 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-common/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + be.vlaanderen.informatievlaanderen.vsds + ldes-server-admin + 3.5.0-SNAPSHOT + + + ldes-server-admin-common + + + + be.vlaanderen.informatievlaanderen.vsds + ldes-server-domain + + + + org.junit.jupiter + junit-jupiter + test + + + org.assertj + assertj-core + test + + + io.cucumber + cucumber-java + + + io.cucumber + cucumber-spring + + + io.cucumber + cucumber-junit-platform-engine + + + org.junit.platform + junit-platform-suite + + + org.awaitility + awaitility + test + + + + + org.jetbrains + annotations + + + com.google.guava + guava + ${google-guava.version} + + + org.mockito + mockito-junit-jupiter + test + + + + + \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/entities/DcatDataset.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/entities/DcatDataset.java new file mode 100644 index 0000000000..0b38f27c75 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/entities/DcatDataset.java @@ -0,0 +1,75 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities; + +import be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants; +import org.apache.jena.rdf.model.*; +import org.apache.jena.util.ResourceUtils; + +import java.util.List; +import java.util.Objects; + +public class DcatDataset { + public static final String DCAT_PREFIX = "http://www.w3.org/ns/dcat#"; + public static final String DATASET_TYPE = DCAT_PREFIX + "Dataset"; + public static final Property TREE_SPECIFICATION = ResourceFactory.createProperty("https://w3id.org/tree/specification"); + public static final Property LDES_SPECIFICATION = ResourceFactory.createProperty("https://w3id.org/ldes/specification"); + + private final String collectionName; + private final Model model; + + public DcatDataset(String collectionName, Model model) { + this.collectionName = collectionName; + this.model = model; + } + + public DcatDataset(String collectionName) { + this(collectionName, ModelFactory.createDefaultModel()); + } + + public String getCollectionName() { + return collectionName; + } + + public Model getModel() { + return model; + } + + public Model getModelWithIdentity(String hostname) { + String datasetIriString = getDatasetIriString(hostname); + Model modelWithIdentity = ModelFactory.createDefaultModel(); + modelWithIdentity.add(model); + modelWithIdentity.listStatements(null, RdfConstants.RDF_SYNTAX_TYPE, ResourceFactory.createResource(DATASET_TYPE)).nextOptional() + .ifPresent(statement -> ResourceUtils.renameResource(statement.getSubject(), datasetIriString)); + modelWithIdentity.add(ResourceFactory.createResource(datasetIriString), RdfConstants.DC_TERMS_IDENTIFIER, + modelWithIdentity.createTypedLiteral(datasetIriString, RdfConstants.RDF_LITERAL)); + modelWithIdentity.add(createConformsToStatements(ResourceFactory.createResource(datasetIriString))); + return modelWithIdentity; + } + + public String getDatasetIriString(String hostName) { + return hostName + "/" + getCollectionName(); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + DcatDataset that = (DcatDataset) o; + return Objects.equals(collectionName, that.getCollectionName()); + } + + @Override + public int hashCode() { + return Objects.hash(collectionName); + } + + private List createConformsToStatements(Resource datasetIri) { + return List.of( + ResourceFactory.createStatement(datasetIri, RdfConstants.DC_CONFORMS_TO, TREE_SPECIFICATION), + ResourceFactory.createStatement(datasetIri, RdfConstants.DC_CONFORMS_TO, LDES_SPECIFICATION), + ResourceFactory.createStatement(TREE_SPECIFICATION, RdfConstants.RDF_SYNTAX_TYPE, RdfConstants.DC_STANDARD), + ResourceFactory.createStatement(LDES_SPECIFICATION, RdfConstants.RDF_SYNTAX_TYPE, RdfConstants.DC_STANDARD) + ); + } +} diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/repository/DcatDatasetRepository.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/repository/DcatDatasetRepository.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/repository/DcatDatasetRepository.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/repository/DcatDatasetRepository.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/services/DcatDatasetService.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/services/DcatDatasetService.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/services/DcatDatasetService.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/services/DcatDatasetService.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/services/DcatDatasetServiceImpl.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/services/DcatDatasetServiceImpl.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/services/DcatDatasetServiceImpl.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/services/DcatDatasetServiceImpl.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/entities/DcatServer.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/entities/DcatServer.java similarity index 69% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/entities/DcatServer.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/entities/DcatServer.java index 221d8e7dfd..a098c95ed2 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/entities/DcatServer.java +++ b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/entities/DcatServer.java @@ -1,24 +1,21 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.entities; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities.DcatDataset; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.DcatView; import org.apache.jena.rdf.model.*; +import org.apache.jena.util.ResourceUtils; import org.apache.jena.vocabulary.RDF; import java.util.ArrayList; import java.util.List; import java.util.Objects; -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.DC_TERMS_IDENTIFIER; -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.RDF_LITERAL; -import static org.apache.jena.rdf.model.ResourceFactory.*; -import static org.apache.jena.util.ResourceUtils.renameResource; - public class DcatServer { - public static final Property DCAT_CATALOG = createProperty("http://www.w3.org/ns/dcat#Catalog"); - public static final Property DCAT_SERVICE = createProperty("http://www.w3.org/ns/dcat#service"); - public static final Property DCAT_DATASET = createProperty("http://www.w3.org/ns/dcat#dataset"); + public static final Property DCAT_CATALOG = ResourceFactory.createProperty("http://www.w3.org/ns/dcat#Catalog"); + public static final Property DCAT_SERVICE = ResourceFactory.createProperty("http://www.w3.org/ns/dcat#service"); + public static final Property DCAT_DATASET = ResourceFactory.createProperty("http://www.w3.org/ns/dcat#dataset"); private final String id; private final Model dcat; @@ -48,14 +45,14 @@ public List getStatementsWithBase(String hostName, List dca private Statement createIdentifierStatement(String hostName) { Resource subject = getServerResource(hostName); - return createStatement(subject, DC_TERMS_IDENTIFIER, dcat.createTypedLiteral(id, RDF_LITERAL)); + return ResourceFactory.createStatement(subject, RdfConstants.DC_TERMS_IDENTIFIER, dcat.createTypedLiteral(id, RdfConstants.RDF_LITERAL)); } private List createCatalogStatements(String hostName) { final Model dcatWithIdentity = ModelFactory.createDefaultModel(); dcatWithIdentity.add(getDcat()); dcatWithIdentity.listStatements(null, RDF.type, DCAT_CATALOG).nextOptional() - .ifPresent(statement -> renameResource(statement.getSubject(), getServerResource(hostName).getURI())); + .ifPresent(statement -> ResourceUtils.renameResource(statement.getSubject(), getServerResource(hostName).getURI())); return dcatWithIdentity.listStatements().toList(); } @@ -63,7 +60,7 @@ private List createDcatServiceStatements(String hostName, List createStatement(serverResource, DCAT_SERVICE, + .map(dcatView -> ResourceFactory.createStatement(serverResource, DCAT_SERVICE, dcatView.getViewDescriptionResource(hostName))) .toList(); } @@ -72,13 +69,13 @@ private List createDcatDataSetStatements(String hostName, List createStatement(serverResource, DCAT_DATASET, - createResource(dataset.getDatasetIriString(hostName)))) + .map(dataset -> ResourceFactory.createStatement(serverResource, DCAT_DATASET, + ResourceFactory.createResource(dataset.getDatasetIriString(hostName)))) .toList(); } public Resource getServerResource(String hostName) { - return createResource(hostName); + return ResourceFactory.createResource(hostName); } @Override diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/repositories/DcatServerRepository.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/repository/DcatServerRepository.java similarity index 93% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/repositories/DcatServerRepository.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/repository/DcatServerRepository.java index defd6c855b..60dbb75041 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/repositories/DcatServerRepository.java +++ b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/repository/DcatServerRepository.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repositories; +package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repository; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.entities.DcatServer; diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/services/DcatServerService.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/services/DcatServerService.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/services/DcatServerService.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/services/DcatServerService.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/services/DcatServerServiceImpl.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/services/DcatServerServiceImpl.java similarity index 98% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/services/DcatServerServiceImpl.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/services/DcatServerServiceImpl.java index 67519200cc..be5ec10333 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/services/DcatServerServiceImpl.java +++ b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatserver/services/DcatServerServiceImpl.java @@ -3,7 +3,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities.DcatDataset; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.services.DcatDatasetService; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.entities.DcatServer; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repositories.DcatServerRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repository.DcatServerRepository; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.validation.DcatShaclValidator; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.validation.ModelValidator; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.view.service.DcatViewService; diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/repository/EventSourceRepository.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/repository/EventSourceRepository.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/repository/EventSourceRepository.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/repository/EventSourceRepository.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceService.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceService.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceService.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceService.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceServiceImpl.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceServiceImpl.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceServiceImpl.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceServiceImpl.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/exceptions/InvalidSkolemisationDomainException.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/exceptions/InvalidSkolemisationDomainException.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/exceptions/InvalidSkolemisationDomainException.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/exceptions/InvalidSkolemisationDomainException.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/exceptions/MissingStatementException.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/exceptions/MissingStatementException.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/exceptions/MissingStatementException.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/exceptions/MissingStatementException.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/repository/EventStreamRepository.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/repository/EventStreamRepository.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/repository/EventStreamRepository.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/repository/EventStreamRepository.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamService.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamService.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamService.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamService.java index d0d081a773..7b777ecdf1 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamService.java +++ b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamService.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.services; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamServiceSpi; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; import org.apache.jena.rdf.model.Model; import java.util.List; diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamServiceImpl.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamServiceImpl.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamServiceImpl.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamServiceImpl.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/entities/ShaclShape.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/entities/ShaclShape.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/entities/ShaclShape.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/entities/ShaclShape.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/repository/ShaclShapeRepository.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/repository/ShaclShapeRepository.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/repository/ShaclShapeRepository.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/repository/ShaclShapeRepository.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeService.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeService.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeService.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeService.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeServiceImpl.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeServiceImpl.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeServiceImpl.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeServiceImpl.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/DcatShaclValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/DcatShaclValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/DcatShaclValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/DcatShaclValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ModelValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ModelValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ModelValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ModelValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ShaclValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ShaclValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ShaclValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ShaclValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ValidatorsConfig.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ValidatorsConfig.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ValidatorsConfig.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ValidatorsConfig.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatCatalogValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatCatalogValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatCatalogValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatCatalogValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatDatasetValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatDatasetValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatDatasetValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatDatasetValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatNodeValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatNodeValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatNodeValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatNodeValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatViewValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatViewValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatViewValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatViewValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/blanknodevalidators/DcatBlankNodeValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/blanknodevalidators/DcatBlankNodeValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/blanknodevalidators/DcatBlankNodeValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/blanknodevalidators/DcatBlankNodeValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainCatalogValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainCatalogValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainCatalogValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainCatalogValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainDatasetValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainDatasetValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainDatasetValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainDatasetValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainRule.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainRule.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainRule.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainRule.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainServiceValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainServiceValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainServiceValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/cannotcontainvalidators/CannotContainServiceValidator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/exception/DuplicateRetentionException.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/exception/DuplicateRetentionException.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/exception/DuplicateRetentionException.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/exception/DuplicateRetentionException.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/exception/ModelToViewConverterException.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/exception/ModelToViewConverterException.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/exception/ModelToViewConverterException.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/exception/ModelToViewConverterException.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/repository/DcatViewRepository.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/repository/DcatViewRepository.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/repository/DcatViewRepository.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/repository/DcatViewRepository.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/repository/ViewRepository.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/repository/ViewRepository.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/repository/ViewRepository.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/repository/ViewRepository.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ConfigFilterPredicate.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ConfigFilterPredicate.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ConfigFilterPredicate.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ConfigFilterPredicate.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewService.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewService.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewService.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewService.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewServiceImpl.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewServiceImpl.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewServiceImpl.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewServiceImpl.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/FragmentationConfigCreationFunction.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/FragmentationConfigCreationFunction.java similarity index 84% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/FragmentationConfigCreationFunction.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/FragmentationConfigCreationFunction.java index 93893ff244..989620d924 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/FragmentationConfigCreationFunction.java +++ b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/FragmentationConfigCreationFunction.java @@ -1,6 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.view.service; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.view.exception.ModelToViewConverterException; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.RdfModelConverter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.FragmentationConfig; import org.apache.jena.rdf.model.ModelFactory; @@ -13,9 +14,6 @@ import java.util.function.Function; import java.util.stream.Collectors; -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.FRAGMENTATION_TYPE; -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.RDF_SYNTAX_TYPE; - public class FragmentationConfigCreationFunction implements Function { public static final String PAGINATION_FRAGMENTATION = "PaginationFragmentation"; @@ -28,7 +26,7 @@ public FragmentationConfig apply(RDFNode rdfNode) { .listStatements(rdfNode.asResource(), null, (RDFNode) null) .toList(); List fragmentationStatements = statements.stream() - .filter(statement -> statement.getPredicate().equals(RDF_SYNTAX_TYPE)).toList(); + .filter(statement -> statement.getPredicate().equals(RdfConstants.RDF_SYNTAX_TYPE)).toList(); validateFragmentationStatements(fragmentationStatements); Map fragmentationPropertiesMap = extractFragmentationProperties(statements, fragmentationStatements); @@ -42,9 +40,9 @@ public FragmentationConfig apply(RDFNode rdfNode) { private void validateFragmentationStatements(List fragmentationStatements) { if (fragmentationStatements.size() != 1) { throw new IllegalArgumentException( - "Cannot Create Fragmentation Config. Expected exactly 1 " + FRAGMENTATION_TYPE - + " statement.\n Found no or multiple statements in :\n" - + RdfModelConverter.toString(ModelFactory.createDefaultModel().add(fragmentationStatements), + "Cannot Create Fragmentation Config. Expected exactly 1 " + RdfConstants.FRAGMENTATION_TYPE + + " statement.\n Found no or multiple statements in :\n" + + RdfModelConverter.toString(ModelFactory.createDefaultModel().add(fragmentationStatements), Lang.TURTLE)); } } @@ -65,7 +63,7 @@ private Map extractFragmentationProperties(List state private String computeFragmentationName(List statements) { final String fragmentationName = statements.stream() - .filter(statement -> statement.getPredicate().equals(RDF_SYNTAX_TYPE)) + .filter(statement -> statement.getPredicate().equals(RdfConstants.RDF_SYNTAX_TYPE)) .findFirst() .orElseThrow(() -> new ModelToViewConverterException("Unable to find fragmentation type")) .getResource() diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewService.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewService.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewService.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewService.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewServiceImpl.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewServiceImpl.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewServiceImpl.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewServiceImpl.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewValidator.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewValidator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewValidator.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewValidator.java diff --git a/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamReader.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamReader.java new file mode 100644 index 0000000000..ea35f30d23 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamReader.java @@ -0,0 +1,115 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.admin.spi; + +import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.exceptions.MissingStatementException; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; +import org.apache.jena.rdf.model.*; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.*; +import static org.apache.jena.rdf.model.ModelFactory.createDefaultModel; +import static org.apache.jena.rdf.model.ResourceFactory.createProperty; +import static org.apache.jena.rdf.model.ResourceFactory.createResource; + +@Component +public class EventStreamReader { + private final ViewSpecificationConverter viewSpecificationConverter; + private final RetentionModelExtractor retentionModelExtractor; + + public EventStreamReader(ViewSpecificationConverter viewSpecificationConverter, RetentionModelExtractor retentionModelExtractor) { + this.viewSpecificationConverter = viewSpecificationConverter; + this.retentionModelExtractor = retentionModelExtractor; + } + + public EventStreamTO read(Model model) { + final String collection = getIdentifier(model, createResource(EVENT_STREAM_TYPE)).map(Resource::getLocalName) + .orElseThrow(() -> new MissingStatementException("Not blank node with type " + EVENT_STREAM_TYPE)); + return new EventStreamTO.Builder() + .withCollection(collection) + .withTimestampPath(getResource(model, LDES_TIMESTAMP_PATH).orElse(null)) + .withVersionOfPath(getResource(model, LDES_VERSION_OF).orElse(null)) + .withVersionDelimiter(getVersionDelimiter(model)) + .withSkolemizationDomain(getResource(model, LDES_SKOLEMIZATION_DOMAIN).orElse(null)) + .withViews(getViews(model, collection)) + .withShacl(getShaclFromModel(model)) + .withEventSourceRetentionPolicies(getEventSourceRetentionPolicies(model)) + .build(); + } + + private Optional getIdentifier(Model model, Resource object) { + Optional stmtOptional = model.listStatements(null, RDF_SYNTAX_TYPE, object).nextOptional(); + return stmtOptional.map(Statement::getSubject); + } + + private Optional getResource(Model model, Property predicate) { + return model.listObjectsOfProperty(predicate) + .filterKeep(RDFNode::isResource) + .nextOptional() + .map(RDFNode::toString); + } + + private String getVersionDelimiter(Model model) { + final boolean versionCreationEnabled = model.listStatements(null, LDES_CREATE_VERSIONS, (Resource) null) + .nextOptional() + .map(statement -> statement.getLiteral().getBoolean()) + .orElse(false); + + if(!versionCreationEnabled) { + return null; + } + return model.listObjectsOfProperty(LDES_VERSION_DELIMITER) + .filterKeep(RDFNode::isLiteral) + .nextOptional() + .map(node -> node.asLiteral().getString()) + .orElse("/"); + } + + private List getViews(Model model, String collection) { + return model.listStatements(null, createProperty(TREE_VIEW_DESCRIPTION), (Resource) null).toList().stream() + .map(statement -> { + List statements = retrieveAllStatements(statement.getObject().asResource(), model); + statements.add(statement); + return statements; + }) + .map(statements -> createDefaultModel().add(statements)) + .map(viewModel -> viewSpecificationConverter.viewFromModel(viewModel, collection)) + .toList(); + } + + private List getEventSourceRetentionPolicies(Model model) { + Optional eventSourceStatement = model.listStatements(null, LDES_EVENT_SOURCE, (RDFNode) null).nextOptional(); + if (eventSourceStatement.isEmpty()) { + return List.of(); + } else { + Model eventSourceModel = ModelFactory.createDefaultModel().add(retrieveAllStatements(eventSourceStatement.get().getResource(), model)); + return retentionModelExtractor.extractRetentionStatements(eventSourceModel); + } + } + + private Model getShaclFromModel(Model model) { + final Model shaclModel = ModelFactory.createDefaultModel(); + model.listStatements(null, TREE_SHAPE, (Resource) null) + .nextOptional() + .ifPresent(statement -> shaclModel.add(retrieveAllStatements(statement.getResource(), model))); + return shaclModel; + } + + private List retrieveAllStatements(Resource resource, Model model) { + StmtIterator iterator = model.listStatements(resource, null, (Resource) null); + List statements = new ArrayList<>(); + + while (iterator.hasNext()) { + Statement statement = iterator.nextStatement(); + statements.add(statement); + + if (statement.getObject().isResource()) { + statements.addAll(retrieveAllStatements(statement.getResource(), model)); + } + } + + return statements; + } +} diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamServiceSpi.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamServiceSpi.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamServiceSpi.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamServiceSpi.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTO.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTO.java similarity index 84% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTO.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTO.java index d06c3859e0..739364a162 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTO.java +++ b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTO.java @@ -3,6 +3,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities.DcatDataset; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.exceptions.InvalidSkolemisationDomainException; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.VersionCreationProperties; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; import org.apache.jena.rdf.model.Model; @@ -16,7 +17,7 @@ public class EventStreamTO { private final String collection; private final String timestampPath; private final String versionOfPath; - private final boolean versionCreationEnabled; + private final VersionCreationProperties versionCreationProperties; private final boolean closed; private final String skolemizationDomain; private final List views; @@ -28,7 +29,7 @@ private EventStreamTO(Builder builder) { collection = builder.collection; timestampPath = builder.timestampPath; versionOfPath = builder.versionOfPath; - versionCreationEnabled = builder.versionCreationEnabled; + versionCreationProperties = builder.versionCreationProperties; closed = builder.closed; skolemizationDomain = builder.skolemizationDomain; views = builder.views; @@ -49,8 +50,12 @@ public String getVersionOfPath() { return versionOfPath; } + public String getVersionDelimiter() { + return versionCreationProperties.getVersionDelimiter(); + } + public boolean isVersionCreationEnabled() { - return versionCreationEnabled; + return versionCreationProperties.isVersionCreationEnabled(); } public boolean isClosed() { @@ -87,7 +92,7 @@ public boolean equals(Object o) { return Objects.equals(collection, that.collection) && Objects.equals(timestampPath, that.timestampPath) && Objects.equals(versionOfPath, that.versionOfPath) && shacl.isIsomorphicWith(that.shacl) - && versionCreationEnabled == that.versionCreationEnabled + && Objects.equals(versionCreationProperties, that.versionCreationProperties) && new HashSet<>(views).containsAll(that.views) && new HashSet<>(that.views).containsAll(views) && Objects.equals(dcatDataset, that.dcatDataset); @@ -95,11 +100,11 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(collection, timestampPath, versionOfPath, versionCreationEnabled, views, shacl, dcatDataset); + return Objects.hash(collection, timestampPath, versionOfPath, versionCreationProperties, views, shacl, dcatDataset); } public EventStream extractEventStreamProperties() { - return new EventStream(collection, timestampPath, versionOfPath, versionCreationEnabled, skolemizationDomain); + return new EventStream(collection, timestampPath, versionOfPath, versionCreationProperties, skolemizationDomain); } @@ -108,7 +113,7 @@ public static final class Builder { private String collection; private String timestampPath; private String versionOfPath; - private boolean versionCreationEnabled = false; + private VersionCreationProperties versionCreationProperties = VersionCreationProperties.disabled(); private boolean closed = false; private String skolemizationDomain; private List views = List.of(); @@ -120,7 +125,7 @@ public Builder withEventStream(EventStream eventStream) { collection = eventStream.getCollection(); timestampPath = eventStream.getTimestampPath(); versionOfPath = eventStream.getVersionOfPath(); - versionCreationEnabled = eventStream.isVersionCreationEnabled(); + versionCreationProperties = eventStream.getVersionCreationProperties(); closed = eventStream.isClosed(); skolemizationDomain = eventStream.getSkolemizationDomain().orElse(null); return this; @@ -141,8 +146,8 @@ public Builder withVersionOfPath(String val) { return this; } - public Builder withVersionCreationEnabled(boolean val) { - versionCreationEnabled = val; + public Builder withVersionDelimiter(String val) { + versionCreationProperties = VersionCreationProperties.ofNullableDelimiter(val); return this; } diff --git a/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamWriter.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamWriter.java new file mode 100644 index 0000000000..e3cc745ada --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamWriter.java @@ -0,0 +1,134 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.admin.spi; + +import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdder; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.rest.PrefixConstructor; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.rdf.model.Resource; +import org.apache.jena.rdf.model.Statement; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.*; +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.RDF_SYNTAX_TYPE; +import static org.apache.commons.lang3.StringUtils.isNotBlank; +import static org.apache.jena.rdf.model.ModelFactory.createDefaultModel; +import static org.apache.jena.rdf.model.ResourceFactory.*; +import static org.apache.jena.rdf.model.ResourceFactory.createResource; + +@Component +public class EventStreamWriter { + private static final String DCAT_PREFIX = "http://www.w3.org/ns/dcat#"; + private static final String DATASET_TYPE = DCAT_PREFIX + "Dataset"; + + private final ViewSpecificationConverter viewSpecificationConverter; + private final PrefixAdder prefixAdder; + private final PrefixConstructor prefixConstructor; + + public EventStreamWriter(ViewSpecificationConverter viewSpecificationConverter, PrefixAdder prefixAdder, PrefixConstructor prefixConstructor) { + this.viewSpecificationConverter = viewSpecificationConverter; + this.prefixAdder = prefixAdder; + this.prefixConstructor = prefixConstructor; + } + + public Model write(EventStreamTO eventStreamTO) { + String prefix = prefixConstructor.buildPrefix(); + final Resource subject = getIRIFromCollectionName(eventStreamTO.getCollection(), prefix); + final Statement collectionNameStmt = createStatement(subject, RDF_SYNTAX_TYPE, createResource(EVENT_STREAM_TYPE)); + final Statement dcatTypeStmt = createStatement(subject, RDF_SYNTAX_TYPE, createResource(DATASET_TYPE)); + final Model dataset = eventStreamTO.getDcatDataset().getModelWithIdentity(prefix); + final List eventSourceStatements = getEventSourceStatements(eventStreamTO.getEventSourceRetentionPolicies(), subject); + + Model eventStreamModel = createDefaultModel() + .add(collectionNameStmt) + .add(dcatTypeStmt) + .add(getVersionOfStatements(subject, eventStreamTO)) + .add(getTimestampPathStatements(subject, eventStreamTO)) + .add(getCreateVersionsStatements(subject, eventStreamTO)) + .add(eventStreamTO.getShacl()) + .add(getViewReferenceStatements(eventStreamTO.getViews(), subject, prefix)) + .add(getViewStatements(eventStreamTO.getViews())) + .add(eventSourceStatements) + .add(dataset); + + Statement shaclStatement = getShaclReferenceStatement(eventStreamTO.getShacl(), subject); + + eventStreamModel.add(shaclStatement); + + return prefixAdder.addPrefixesToModel(eventStreamModel); + } + + private List getTimestampPathStatements(Resource subject, EventStreamTO eventStreamTO) { + if (isNotBlank(eventStreamTO.getVersionOfPath())) { + return List.of(createStatement(subject, LDES_TIMESTAMP_PATH, + createProperty(eventStreamTO.getTimestampPath()))); + } else { + return List.of(); + } + } + + private List getVersionOfStatements(Resource subject, EventStreamTO eventStreamTO) { + if (isNotBlank(eventStreamTO.getVersionOfPath())) { + return List.of(createStatement(subject, LDES_VERSION_OF, + createProperty(eventStreamTO.getVersionOfPath()))); + } else { + return List.of(); + } + } + + private List getCreateVersionsStatements(Resource subject, EventStreamTO eventStreamTO) { + return List.of( + createStatement(subject, LDES_CREATE_VERSIONS, createTypedLiteral(eventStreamTO.isVersionCreationEnabled())) + ); + } + + private List getViewReferenceStatements(List views, Resource subject, String prefix) { + return views.stream() + .map(ViewSpecification::getName) + .map(viewName -> createStatement(subject, createProperty(VIEW), + viewSpecificationConverter.getIRIFromViewName(viewName, prefix))) + .toList(); + } + + private List getViewStatements(List views) { + return views.stream() + .map(viewSpecificationConverter::modelFromView) + .flatMap(model -> model.listStatements().toList().stream()) + .toList(); + } + + private Statement getShaclReferenceStatement(Model shacl, Resource subject) { + return getIdentifier(shacl, createResource(NODE_SHAPE_TYPE)) + .map(resource -> createStatement(subject, TREE_SHAPE, resource)) + .orElse(createStatement(subject, TREE_MEMBER, createResource())); + } + + private List getEventSourceStatements(List eventSourceRetentionModels, Resource subject) { + List statements = new ArrayList<>(); + Resource eventSourceResource = createResource(); + statements.add( + createStatement(subject, LDES_EVENT_SOURCE, eventSourceResource)); + statements.add( + createStatement(eventSourceResource, RDF_SYNTAX_TYPE, createResource(LDES_EVENT_SOURCE_URI))); + eventSourceRetentionModels.forEach(retentionModel -> { + Resource retentionResource = createResource(); + retentionModel.listStatements().forEach(statement -> statements + .add(createStatement(retentionResource, statement.getPredicate(), statement.getObject()))); + statements.add( + createStatement(eventSourceResource, createProperty(RETENTION_TYPE), retentionResource)); + }); + return statements; + } + + private Resource getIRIFromCollectionName(String name, String prefix) { + return createResource(prefix + "/" + name); + } + + private Optional getIdentifier(Model model, Resource object) { + Optional stmtOptional = model.listStatements(null, RDF_SYNTAX_TYPE, object).nextOptional(); + return stmtOptional.map(Statement::getSubject); + } +} diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/FragmentationConfigExtractor.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/FragmentationConfigExtractor.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/FragmentationConfigExtractor.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/FragmentationConfigExtractor.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/RetentionModelExtractor.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/RetentionModelExtractor.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/RetentionModelExtractor.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/RetentionModelExtractor.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/ViewSpecificationConverter.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/ViewSpecificationConverter.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/ViewSpecificationConverter.java rename to ldes-server-admin/ldes-server-admin-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/ViewSpecificationConverter.java diff --git a/ldes-server-admin/ldes-server-admin-common/src/main/java/module-info.java b/ldes-server-admin/ldes-server-admin-common/src/main/java/module-info.java new file mode 100644 index 0000000000..832f2ac6ea --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-common/src/main/java/module-info.java @@ -0,0 +1,45 @@ +open module ldes.admin { + + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.spi; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.repository; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.services; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.entities; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repository; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.services; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventsource.repository; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventsource.services; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.exceptions; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.repository; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.services; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.shacl.entities; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.shacl.repository; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.shacl.services; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.validation; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.validation.dcat; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.view.service; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.view.exception; + exports be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.view.repository; + + // LDES dependencies + requires ldes.domain; + + // external dependencies + requires spring.boot; + requires spring.beans; + requires spring.context; + requires spring.boot.autoconfigure; + requires spring.boot.actuator; + requires spring.boot.actuator.autoconfigure; + requires org.apache.commons.lang3; + requires org.apache.tomcat.embed.core; + requires org.apache.jena.arq; + requires org.apache.jena.core; + requires org.apache.jena.shacl; + requires com.google.common; + requires org.slf4j; + requires org.jetbrains.annotations; + requires micrometer.observation; + requires micrometer.core; + +} \ No newline at end of file diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/entities/DcatDatasetTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/entities/DcatDatasetTest.java similarity index 77% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/entities/DcatDatasetTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/entities/DcatDatasetTest.java index 4e95b6897c..bc1c418f1d 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/entities/DcatDatasetTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/entities/DcatDatasetTest.java @@ -1,17 +1,16 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcatdataset.entities; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities.DcatDataset; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - class DcatDatasetTest { @Test void when_CallingGetDatasetIriString_should_ReturnTheCorrectIriString() { String result = new DcatDataset("collectionName").getDatasetIriString("http://localhost.dev"); - assertEquals("http://localhost.dev/collectionName", result); + Assertions.assertEquals("http://localhost.dev/collectionName", result); } } \ No newline at end of file diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/services/DcatDatasetServiceImplTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/services/DcatDatasetServiceImplTest.java similarity index 63% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/services/DcatDatasetServiceImplTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/services/DcatDatasetServiceImplTest.java index 556d580763..d07165d0da 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/services/DcatDatasetServiceImplTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatdataset/services/DcatDatasetServiceImplTest.java @@ -7,11 +7,13 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.RDFDataMgr; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import java.net.URISyntaxException; @@ -20,10 +22,6 @@ import java.util.Objects; import java.util.Optional; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.*; - @ExtendWith(MockitoExtension.class) class DcatDatasetServiceImplTest { private static final String DATASET_ID = "id"; @@ -44,22 +42,22 @@ void setUp() throws URISyntaxException { class saveDataset { @Test void when_DatasetNotPresent_then_SaveDataset() { - when(repository.retrieveDataset(DATASET_ID)).thenReturn(Optional.empty()); + Mockito.when(repository.retrieveDataset(DATASET_ID)).thenReturn(Optional.empty()); datasetService.saveDataset(dataset); - verify(repository).saveDataset(dataset); + Mockito.verify(repository).saveDataset(dataset); } @Test void when_DatasetPresent_then_ThrowException() { - when(repository.retrieveDataset(DATASET_ID)).thenReturn(Optional.of(dataset)); + Mockito.when(repository.retrieveDataset(DATASET_ID)).thenReturn(Optional.of(dataset)); - Exception e = assertThrows(ExistingResourceException.class, () -> datasetService.saveDataset(dataset)); + Exception e = Assertions.assertThrows(ExistingResourceException.class, () -> datasetService.saveDataset(dataset)); - assertEquals("Resource of type: dcat-dataset with id: " + DATASET_ID + " already exists.", e.getMessage()); - verify(repository).retrieveDataset(DATASET_ID); - verifyNoMoreInteractions(repository); + Assertions.assertEquals("Resource of type: dcat-dataset with id: " + DATASET_ID + " already exists.", e.getMessage()); + Mockito.verify(repository).retrieveDataset(DATASET_ID); + Mockito.verifyNoMoreInteractions(repository); } } @@ -67,23 +65,23 @@ void when_DatasetPresent_then_ThrowException() { class UpdateDataset { @Test void when_DatasetPresent_then_SaveDataset() { - when(repository.retrieveDataset(DATASET_ID)).thenReturn(Optional.of(dataset)); + Mockito.when(repository.retrieveDataset(DATASET_ID)).thenReturn(Optional.of(dataset)); datasetService.updateDataset(dataset); - verify(repository).saveDataset(dataset); + Mockito.verify(repository).saveDataset(dataset); } @Test void when_DatasetNotPresent_then_ThrowException() { - when(repository.retrieveDataset(DATASET_ID)).thenReturn(Optional.empty()); + Mockito.when(repository.retrieveDataset(DATASET_ID)).thenReturn(Optional.empty()); - Exception e = assertThrows(MissingResourceException.class, () -> datasetService.updateDataset(dataset)); + Exception e = Assertions.assertThrows(MissingResourceException.class, () -> datasetService.updateDataset(dataset)); - assertEquals("Resource of type: dcat-dataset with id: " + DATASET_ID + " could not be found.", + Assertions.assertEquals("Resource of type: dcat-dataset with id: " + DATASET_ID + " could not be found.", e.getMessage()); - verify(repository).retrieveDataset(DATASET_ID); - verifyNoMoreInteractions(repository); + Mockito.verify(repository).retrieveDataset(DATASET_ID); + Mockito.verifyNoMoreInteractions(repository); } } @@ -91,20 +89,20 @@ void when_DatasetNotPresent_then_ThrowException() { class RemoveDataset { @Test void removeDataset() { - when(repository.exitsByCollectionName(DATASET_ID)).thenReturn(true); + Mockito.when(repository.exitsByCollectionName(DATASET_ID)).thenReturn(true); datasetService.deleteDataset(DATASET_ID); - verify(repository).deleteDataset(DATASET_ID); + Mockito.verify(repository).deleteDataset(DATASET_ID); } @Test void when_DatasetNotFound_Then_DatasetNotDeleted() { - when(repository.exitsByCollectionName(DATASET_ID)).thenReturn(false); + Mockito.when(repository.exitsByCollectionName(DATASET_ID)).thenReturn(false); datasetService.deleteDataset(DATASET_ID); - verify(repository, never()).deleteDataset(DATASET_ID); + Mockito.verify(repository, Mockito.never()).deleteDataset(DATASET_ID); } } @@ -112,11 +110,11 @@ void when_DatasetNotFound_Then_DatasetNotDeleted() { void should_CallDcatServiceToGetDcat_when_GetComposedDcatIsCalled() { List datasets = new ArrayList<>(); datasets.add(dataset); - when(repository.findAll()).thenReturn(datasets); + Mockito.when(repository.findAll()).thenReturn(datasets); List result = repository.findAll(); - assertEquals(datasets, result); + Assertions.assertEquals(datasets, result); } private Model readModelFromFile(String fileName) throws URISyntaxException { diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/entities/DcatServerTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/entities/DcatServerTest.java similarity index 73% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/entities/DcatServerTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/entities/DcatServerTest.java index bff5313bd6..fb3252018f 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/entities/DcatServerTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/entities/DcatServerTest.java @@ -9,6 +9,7 @@ import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFParser; import org.apache.jena.vocabulary.RDF; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; @@ -20,8 +21,7 @@ import java.util.stream.Stream; import static be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.entities.DcatServer.DCAT_CATALOG; -import static org.apache.jena.rdf.model.ResourceFactory.createProperty; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; class DcatServerTest { private static final String ID = "id"; @@ -33,22 +33,22 @@ void test_equality() { DcatServer other = new DcatServer(ID, DCAT); DcatServer other2 = new DcatServer(ID, ModelFactory.createDefaultModel()); - assertEquals(SERVER_DCAT, SERVER_DCAT); - assertEquals(other, other); - assertEquals(SERVER_DCAT, other); - assertEquals(SERVER_DCAT, other2); - assertEquals(other, other2); + Assertions.assertEquals(SERVER_DCAT, SERVER_DCAT); + Assertions.assertEquals(other, other); + Assertions.assertEquals(SERVER_DCAT, other); + Assertions.assertEquals(SERVER_DCAT, other2); + Assertions.assertEquals(other, other2); - assertEquals(SERVER_DCAT.hashCode(), other.hashCode()); - assertEquals(SERVER_DCAT.hashCode(), other2.hashCode()); + Assertions.assertEquals(SERVER_DCAT.hashCode(), other.hashCode()); + Assertions.assertEquals(SERVER_DCAT.hashCode(), other2.hashCode()); } @ParameterizedTest @ArgumentsSource(ServerDcatArgumentsProvider.class) void test_inequality(Object other) { - assertNotEquals(SERVER_DCAT, other); + Assertions.assertNotEquals(SERVER_DCAT, other); if (other != null) { - assertNotEquals(SERVER_DCAT.hashCode(), other.hashCode()); + Assertions.assertNotEquals(SERVER_DCAT.hashCode(), other.hashCode()); } } @@ -77,7 +77,7 @@ void when_GetViewDescriptionResourceIsCalled_should_ReturnValidResource() { Resource result = dcatServer.getServerResource(host); - assertEquals("http://localhost.dev", result.getURI()); + Assertions.assertEquals("http://localhost.dev", result.getURI()); } @Test @@ -93,11 +93,11 @@ void should_ReturnNamedDcatStatements_when_GetStatementsWithBaseIsCalled() { List result = dcatServer.getStatementsWithBase(host, List.of(dcatView1, dcatView2), List.of(dcatDataset)); - assertEquals(5, result.size()); // 2 from catalog + 2 from views + 1 from dataset/eventstream + Assertions.assertEquals(5, result.size()); // 2 from catalog + 2 from views + 1 from dataset/eventstream Model resultModel = ModelFactory.createDefaultModel(); resultModel.add(result); Resource iri = ResourceFactory.createResource(host); - assertEquals(5, resultModel.listStatements(iri, null, (RDFNode) null).toList().size()); + Assertions.assertEquals(5, resultModel.listStatements(iri, null, (RDFNode) null).toList().size()); assertEquals(DCAT_CATALOG, resultModel.listObjectsOfProperty(iri, RDF.type).next()); assertDataserviceStatements(resultModel, iri); assertDatasetStatements(resultModel, iri); @@ -105,19 +105,19 @@ void should_ReturnNamedDcatStatements_when_GetStatementsWithBaseIsCalled() { private void assertDataserviceStatements(Model resultModel, Resource iri) { List dataServiceUris = resultModel - .listObjectsOfProperty(iri, createProperty("http://www.w3.org/ns/dcat#service")) + .listObjectsOfProperty(iri, ResourceFactory.createProperty("http://www.w3.org/ns/dcat#service")) .mapWith(RDFNode::asResource).mapWith(Resource::getURI).toList(); - assertEquals(2, dataServiceUris.size()); - assertTrue(dataServiceUris.contains("http://localhost.dev/col1/view1/description")); - assertTrue(dataServiceUris.contains("http://localhost.dev/col1/view2/description")); + Assertions.assertEquals(2, dataServiceUris.size()); + Assertions.assertTrue(dataServiceUris.contains("http://localhost.dev/col1/view1/description")); + Assertions.assertTrue(dataServiceUris.contains("http://localhost.dev/col1/view2/description")); } private void assertDatasetStatements(Model resultModel, Resource iri) { List dataServiceUris = resultModel - .listObjectsOfProperty(iri, createProperty("http://www.w3.org/ns/dcat#dataset")) + .listObjectsOfProperty(iri, ResourceFactory.createProperty("http://www.w3.org/ns/dcat#dataset")) .mapWith(RDFNode::asResource).mapWith(Resource::getURI).toList(); - assertEquals(1, dataServiceUris.size()); - assertTrue(dataServiceUris.contains("http://localhost.dev/col1")); + Assertions.assertEquals(1, dataServiceUris.size()); + Assertions.assertTrue(dataServiceUris.contains("http://localhost.dev/col1")); } } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/services/DcatServerServiceImplTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/services/DcatServerServiceImplTest.java similarity index 71% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/services/DcatServerServiceImplTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/services/DcatServerServiceImplTest.java index 4793d6b75c..5f7b2616a6 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/services/DcatServerServiceImplTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcatserver/services/DcatServerServiceImplTest.java @@ -3,7 +3,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities.DcatDataset; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.services.DcatDatasetService; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.entities.DcatServer; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repositories.DcatServerRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repository.DcatServerRepository; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.services.DcatServerService; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.services.DcatServerServiceImpl; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.validation.DcatShaclValidator; @@ -17,10 +17,12 @@ import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFParser; +import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentMatchers; import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; @@ -30,10 +32,6 @@ import java.util.List; import java.util.Optional; -import static org.assertj.core.api.Assertions.*; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; - @ExtendWith(MockitoExtension.class) class DcatServerServiceImplTest { private static final String ID = "2a896d35-8c72-4723-83b3-add9b1be96aa"; @@ -57,38 +55,38 @@ void setUp() { @Test void when_ServerHasNoDcat_and_CreateDcat_then_ReturnIt() { - when(repository.getServerDcat()).thenReturn(List.of()); - when(repository.saveServerDcat(any())).thenReturn(SERVER_DCAT); + Mockito.when(repository.getServerDcat()).thenReturn(List.of()); + Mockito.when(repository.saveServerDcat(ArgumentMatchers.any())).thenReturn(SERVER_DCAT); final DcatServer createdDcat = service.createDcatServer(DCAT); - assertThat(createdDcat).isEqualTo(SERVER_DCAT); + Assertions.assertThat(createdDcat).isEqualTo(SERVER_DCAT); InOrder inOrder = Mockito.inOrder(repository); inOrder.verify(repository).getServerDcat(); - inOrder.verify(repository).saveServerDcat(any()); + inOrder.verify(repository).saveServerDcat(ArgumentMatchers.any()); inOrder.verifyNoMoreInteractions(); } @Test void when_ServerAlreadyHasDcatConfigured_then_ThrowException() { - when(repository.getServerDcat()).thenReturn(List.of(SERVER_DCAT)); + Mockito.when(repository.getServerDcat()).thenReturn(List.of(SERVER_DCAT)); - assertThatThrownBy(() -> service.createDcatServer(DCAT)) + Assertions.assertThatThrownBy(() -> service.createDcatServer(DCAT)) .isInstanceOf(ExistingResourceException.class) .hasMessage("Resource of type: dcat-catalog with id: %s already exists.", ID); - verify(repository).getServerDcat(); - verifyNoMoreInteractions(repository); + Mockito.verify(repository).getServerDcat(); + Mockito.verifyNoMoreInteractions(repository); } @Test void when_UpdateExistingDcat_then_ReturnDcat() { - when(repository.getServerDcatById(ID)).thenReturn(Optional.of(SERVER_DCAT)); - when(repository.saveServerDcat(SERVER_DCAT)).thenReturn(SERVER_DCAT); + Mockito.when(repository.getServerDcatById(ID)).thenReturn(Optional.of(SERVER_DCAT)); + Mockito.when(repository.saveServerDcat(SERVER_DCAT)).thenReturn(SERVER_DCAT); DcatServer updatedDcatServer = service.updateDcatServer(ID, DCAT); - assertThat(updatedDcatServer).isEqualTo(SERVER_DCAT); - InOrder inOrder = inOrder(repository); + Assertions.assertThat(updatedDcatServer).isEqualTo(SERVER_DCAT); + InOrder inOrder = Mockito.inOrder(repository); inOrder.verify(repository).getServerDcatById(ID); inOrder.verify(repository).saveServerDcat(SERVER_DCAT); inOrder.verifyNoMoreInteractions(); @@ -96,65 +94,65 @@ void when_UpdateExistingDcat_then_ReturnDcat() { @Test void when_UpdateNonExistingDcat_then_ThrowException() { - when(repository.getServerDcatById(ID)).thenReturn(Optional.empty()); + Mockito.when(repository.getServerDcatById(ID)).thenReturn(Optional.empty()); - assertThatThrownBy(() -> service.updateDcatServer(ID, DCAT)) + Assertions.assertThatThrownBy(() -> service.updateDcatServer(ID, DCAT)) .isInstanceOf(MissingResourceException.class) .hasMessage("Resource of type: dcat-catalog with id: %s could not be found.", ID); - verify(repository).getServerDcatById(ID); - verifyNoMoreInteractions(repository); + Mockito.verify(repository).getServerDcatById(ID); + Mockito.verifyNoMoreInteractions(repository); } @Test void when_DeleteExistingDcat_then_ReturnVoid() { - assertThatNoException().isThrownBy(() -> service.deleteDcatServer(ID)); - verify(repository).deleteServerDcat(ID); - verifyNoMoreInteractions(repository); + Assertions.assertThatNoException().isThrownBy(() -> service.deleteDcatServer(ID)); + Mockito.verify(repository).deleteServerDcat(ID); + Mockito.verifyNoMoreInteractions(repository); } @Nested class GetComposedDcat { - private final static String COLLECTION_PARCELS = "parcels"; - private final static String COLLECTION_BUILDINGS = "buildings"; - private final static String VIEW_BY_PAGE = "by-page"; - private final static String VIEW_BY_TIME = "by-time"; + private static final String COLLECTION_PARCELS = "parcels"; + private static final String COLLECTION_BUILDINGS = "buildings"; + private static final String VIEW_BY_PAGE = "by-page"; + private static final String VIEW_BY_TIME = "by-time"; @Test void should_ReturnEmptyModel_when_NoServerDcatPresent() { - when(repository.findSingleDcatServer()).thenReturn(Optional.empty()); + Mockito.when(repository.findSingleDcatServer()).thenReturn(Optional.empty()); Model result = service.getComposedDcat(); - assertThat(result).matches(Model::isEmpty); - verify(dcatShaclValidator).validate(any()); + Assertions.assertThat(result).matches(Model::isEmpty); + Mockito.verify(dcatShaclValidator).validate(ArgumentMatchers.any()); } @Test void should_CombineServerAndDataset_when_TheseArePresent_and_ViewsAreNot() { - when(repository.findSingleDcatServer()).thenReturn(createServer()); - when(dcatDatasetService.findAll()).thenReturn(createDatasets()); - when(dcatViewService.findAll()).thenReturn(List.of()); + Mockito.when(repository.findSingleDcatServer()).thenReturn(createServer()); + Mockito.when(dcatDatasetService.findAll()).thenReturn(createDatasets()); + Mockito.when(dcatViewService.findAll()).thenReturn(List.of()); Model result = service.getComposedDcat(); String path = "dcat/dcat-combined-without-views.ttl"; Model expectedResult = RDFParser.source(path).lang(Lang.TURTLE).build().toModel(); - assertThat(result).matches(expectedResult::isIsomorphicWith); + Assertions.assertThat(result).matches(expectedResult::isIsomorphicWith); } @Test void should_CombineServerDatasetAndViews_when_AllArePresent() { - when(repository.findSingleDcatServer()).thenReturn(createServer()); - when(dcatDatasetService.findAll()).thenReturn(createDatasets()); - when(dcatViewService.findAll()).thenReturn(createViews()); + Mockito.when(repository.findSingleDcatServer()).thenReturn(createServer()); + Mockito.when(dcatDatasetService.findAll()).thenReturn(createDatasets()); + Mockito.when(dcatViewService.findAll()).thenReturn(createViews()); Model result = service.getComposedDcat(); String path = "dcat/dcat-combined-all.ttl"; Model expectedResult = RDFParser.source(path).lang(Lang.TURTLE).build().toModel(); - assertThat(result).matches(expectedResult::isIsomorphicWith); + Assertions.assertThat(result).matches(expectedResult::isIsomorphicWith); } private Optional createServer() { diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/events/ShaclChangedEventTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/events/ShaclChangedEventTest.java similarity index 72% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/events/ShaclChangedEventTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/events/ShaclChangedEventTest.java index 599ad37a1a..b133118b96 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/events/ShaclChangedEventTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/events/ShaclChangedEventTest.java @@ -4,6 +4,8 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.ShaclChangedEvent; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; +import org.apache.jena.rdf.model.ResourceFactory; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; @@ -14,9 +16,8 @@ import java.math.BigDecimal; import java.util.stream.Stream; -import static org.apache.jena.rdf.model.ResourceFactory.*; -import static org.apache.jena.rdf.model.ResourceFactory.createResource; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; class ShaclChangedEventTest { @@ -49,7 +50,7 @@ void test_equality() { void test_inequality(Object otherShaclChangedEvent) { ShaclChangedEvent shaclChangedEvent = new ShaclChangedEvent(COLLECTION_NAME, ShaclChangedEventArgumentsProvider.getModel()); - assertNotEquals(shaclChangedEvent, otherShaclChangedEvent); + Assertions.assertNotEquals(shaclChangedEvent, otherShaclChangedEvent); } static class ShaclChangedEventArgumentsProvider implements ArgumentsProvider { @@ -63,19 +64,19 @@ public Stream provideArguments(ExtensionContext context) { public static Model getModel() { Model model = ModelFactory.createDefaultModel(); - model.add(createStatement( - createResource("https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810464"), - createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), - createResource("https://data.vlaanderen.be/ns/mobiliteit#Mobiliteitshinder"))); + model.add(ResourceFactory.createStatement( + ResourceFactory.createResource("https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810464"), + ResourceFactory.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), + ResourceFactory.createResource("https://data.vlaanderen.be/ns/mobiliteit#Mobiliteitshinder"))); return model; } public static Model getOtherModel() { Model model = ModelFactory.createDefaultModel(); - model.add(createStatement( - createResource("https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810463"), - createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), - createResource("https://data.vlaanderen.be/ns/mobiliteit#Mobiliteitshinder"))); + model.add(ResourceFactory.createStatement( + ResourceFactory.createResource("https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810463"), + ResourceFactory.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), + ResourceFactory.createResource("https://data.vlaanderen.be/ns/mobiliteit#Mobiliteitshinder"))); return model; } } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/entities/EventStreamTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/entities/EventStreamTest.java similarity index 71% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/entities/EventStreamTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/entities/EventStreamTest.java index 23fb05c0c9..5974a1e6ac 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/entities/EventStreamTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/entities/EventStreamTest.java @@ -1,6 +1,8 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.entities; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.VersionCreationProperties; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; @@ -17,14 +19,14 @@ class EventStreamTest { private static final String COLLECTION = "collection_name"; private static final String TIMESTAMP_PATH = "generatedAt"; private static final String VERSION_OF_PATH = "isVersionOf"; - private static final boolean VERSION_CREATION_ENABLED = false; + private static final VersionCreationProperties VERSION_CREATION_PROPERTIES = VersionCreationProperties.disabled(); private static final String SKOLEMIZATION_DOMAIN = "http://example.org"; - private static final EventStream EVENT_STREAM = new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_ENABLED, SKOLEMIZATION_DOMAIN); + private static final EventStream EVENT_STREAM = new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_PROPERTIES, SKOLEMIZATION_DOMAIN); @Test void test_inequality() { - final EventStream other = new EventStream("other", TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_ENABLED, SKOLEMIZATION_DOMAIN); + final EventStream other = new EventStream("other", TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_PROPERTIES, SKOLEMIZATION_DOMAIN); assertNotEquals(EVENT_STREAM, other); assertNotEquals(null, EVENT_STREAM); @@ -35,7 +37,7 @@ void test_inequality() { void test_equality(Object other) { assertEquals(EVENT_STREAM, other); if (other != null) { - assertEquals(EVENT_STREAM.hashCode(), other.hashCode()); + Assertions.assertEquals(EVENT_STREAM.hashCode(), other.hashCode()); } } @@ -44,11 +46,11 @@ static class EventStreamArgumentProvider implements ArgumentsProvider { public Stream provideArguments(ExtensionContext extensionContext) throws Exception { return Stream.of( EVENT_STREAM, - new EventStream(COLLECTION, TIMESTAMP_PATH, "other", VERSION_CREATION_ENABLED, SKOLEMIZATION_DOMAIN), - new EventStream(COLLECTION, "other", VERSION_OF_PATH, VERSION_CREATION_ENABLED, SKOLEMIZATION_DOMAIN), - new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, true, SKOLEMIZATION_DOMAIN), - new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_ENABLED, SKOLEMIZATION_DOMAIN), - new EventStream(COLLECTION, "other", "other", VERSION_CREATION_ENABLED, SKOLEMIZATION_DOMAIN)) + new EventStream(COLLECTION, TIMESTAMP_PATH, "other", VERSION_CREATION_PROPERTIES, SKOLEMIZATION_DOMAIN), + new EventStream(COLLECTION, "other", VERSION_OF_PATH, VERSION_CREATION_PROPERTIES, SKOLEMIZATION_DOMAIN), + new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VersionCreationProperties.enabledWithDefault(), SKOLEMIZATION_DOMAIN), + new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_PROPERTIES, SKOLEMIZATION_DOMAIN), + new EventStream(COLLECTION, "other", "other", VERSION_CREATION_PROPERTIES, SKOLEMIZATION_DOMAIN)) .map(Arguments::of); } } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamServiceImplTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamServiceImplTest.java similarity index 75% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamServiceImplTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamServiceImplTest.java index 23629dff9c..b86af54224 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamServiceImplTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamServiceImplTest.java @@ -13,6 +13,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamDeletedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.VersionCreationProperties; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; import org.apache.jena.rdf.model.Model; @@ -33,7 +34,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class EventStreamServiceImplTest { @@ -41,9 +41,9 @@ class EventStreamServiceImplTest { private static final String COLLECTION = "collection"; private static final String TIMESTAMP_PATH = "generatedAt"; private static final String VERSION_OF_PATH = "isVersionOf"; - private static final boolean VERSION_CREATION_ENABLED = false; + private static final VersionCreationProperties VERSION_CREATION_PROPERTIES = VersionCreationProperties.disabled(); private static final boolean CLOSED = false; - private static final EventStream EVENT_STREAM = new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_ENABLED, null); + private static final EventStream EVENT_STREAM = new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_PROPERTIES, null); private static final EventStreamTO.Builder BASE_BUILDER = new EventStreamTO.Builder() .withEventStream(EVENT_STREAM) .withViews(List.of()) @@ -88,7 +88,7 @@ void when_retrieveAllEventStream_then_returnList() { .withCollection(otherCollection) .withTimestampPath("created") .withVersionOfPath("versionOf") - .withVersionCreationEnabled(false) + .withVersionDelimiter(null) .withClosed(CLOSED) .withViews(views) .withShacl(ModelFactory.createDefaultModel()) @@ -96,30 +96,30 @@ void when_retrieveAllEventStream_then_returnList() { .withDcatDataset(dataset) .build(); - when(eventStreamRepository.retrieveAllEventStreamTOs()).thenReturn(List.of(eventStreamTOWithDataset, otherEventStreamTO)); + Mockito.when(eventStreamRepository.retrieveAllEventStreamTOs()).thenReturn(List.of(eventStreamTOWithDataset, otherEventStreamTO)); List eventStreams = service.retrieveAllEventStreams(); assertThat(eventStreams).containsExactlyInAnyOrder(EVENT_STREAM_RESPONSE, otherEventStreamTO); - verify(eventStreamRepository).retrieveAllEventStreamTOs(); - verifyNoInteractions(shaclShapeService, dcatDatasetService); + Mockito.verify(eventStreamRepository).retrieveAllEventStreamTOs(); + Mockito.verifyNoInteractions(shaclShapeService, dcatDatasetService); } @Test void when_collectionExists_then_retrieveEventStream() { - when(eventStreamRepository.retrieveEventStreamTO(COLLECTION)).thenReturn(Optional.of(eventStreamTOWithDataset)); + Mockito.when(eventStreamRepository.retrieveEventStreamTO(COLLECTION)).thenReturn(Optional.of(eventStreamTOWithDataset)); EventStreamTO eventStreamTO = service.retrieveEventStream(COLLECTION); assertThat(eventStreamTO).isEqualTo(EVENT_STREAM_RESPONSE); - verify(eventStreamRepository).retrieveEventStreamTO(COLLECTION); - verifyNoInteractions(shaclShapeService, dcatDatasetService); + Mockito.verify(eventStreamRepository).retrieveEventStreamTO(COLLECTION); + Mockito.verifyNoInteractions(shaclShapeService, dcatDatasetService); } @Test void when_collectionAndDatasetExists_then_retrieveEventStreamWithDataset() { - when(eventStreamRepository.retrieveEventStreamTO(COLLECTION)).thenReturn(Optional.of(eventStreamTOWithDataset)); + Mockito.when(eventStreamRepository.retrieveEventStreamTO(COLLECTION)).thenReturn(Optional.of(eventStreamTOWithDataset)); EventStreamTO eventStreamTO = service.retrieveEventStream(COLLECTION); @@ -128,21 +128,21 @@ void when_collectionAndDatasetExists_then_retrieveEventStreamWithDataset() { @Test void when_collectionDoesNotExist_and_retrieveCollection_then_throwException() { - when(eventStreamRepository.retrieveEventStreamTO(COLLECTION)).thenReturn(Optional.empty()); + Mockito.when(eventStreamRepository.retrieveEventStreamTO(COLLECTION)).thenReturn(Optional.empty()); assertThatThrownBy(() -> service.retrieveEventStream(COLLECTION)) .isInstanceOf(MissingResourceException.class) .hasMessage("Resource of type: eventstream with id: %s could not be found.", COLLECTION); - verify(eventStreamRepository).retrieveEventStreamTO(COLLECTION); - verifyNoInteractions(dcatDatasetService, shaclShapeService); + Mockito.verify(eventStreamRepository).retrieveEventStreamTO(COLLECTION); + Mockito.verifyNoInteractions(dcatDatasetService, shaclShapeService); } @Test void when_collectionExists_then_updateEventSource() { service.updateEventSource(COLLECTION, List.of()); - InOrder inOrder = inOrder(eventSourceService, eventPublisher); + InOrder inOrder = Mockito.inOrder(eventSourceService, eventPublisher); inOrder.verify(eventSourceService).saveEventSource(COLLECTION, List.of()); } @@ -150,7 +150,7 @@ void when_collectionExists_then_updateEventSource() { class CreateEventStream { private static final String TIMESTAMP_PATH = "generatedAt"; private static final String VERSION_OF_PATH = "versionOf"; - private static final EventStream EVENT_STREAM = new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_ENABLED, null); + private static final EventStream EVENT_STREAM = new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_PROPERTIES, null); @Test void given_NonExistingEventStream_when_createEventStream_then_expectCreatedEventStream() { @@ -159,20 +159,20 @@ void given_NonExistingEventStream_when_createEventStream_then_expectCreatedEvent EventStreamTO createdEventStream = service.createEventStream(eventStreamTO); assertThat(createdEventStream).isSameAs(eventStreamTO); - verify(eventStreamRepository).saveEventStream(eventStreamTO); - verifyNoInteractions(shaclShapeService); + Mockito.verify(eventStreamRepository).saveEventStream(eventStreamTO); + Mockito.verifyNoInteractions(shaclShapeService); } @Test void given_ExistingEventStream_when_createEventStreamWithSameName_then_throwException() { - when(eventStreamRepository.retrieveEventStream(COLLECTION)).thenReturn(Optional.of(EVENT_STREAM)); + Mockito.when(eventStreamRepository.retrieveEventStream(COLLECTION)).thenReturn(Optional.of(EVENT_STREAM)); EventStreamTO eventStreamTO = BASE_BUILDER.build(); assertThatThrownBy(() -> service.createEventStream(eventStreamTO)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("This collection already exists!"); - InOrder inOrder = inOrder(eventStreamRepository, shaclShapeService); + InOrder inOrder = Mockito.inOrder(eventStreamRepository, shaclShapeService); inOrder.verify(eventStreamRepository).retrieveEventStream(COLLECTION); inOrder.verifyNoMoreInteractions(); } @@ -181,8 +181,8 @@ void given_ExistingEventStream_when_createEventStreamWithSameName_then_throwExce void given_NonExistingEventStream_when_errorOccursWhileCreation_then_DeleteAgainAndThrowException() { final String byPage = "by-page"; final String byLocation = "by-location"; - when(eventStreamRepository.retrieveEventStream(COLLECTION)).thenReturn(Optional.empty()); - doThrow(DuplicateRetentionException.class).when(viewValidator).validateView(any()); + Mockito.when(eventStreamRepository.retrieveEventStream(COLLECTION)).thenReturn(Optional.empty()); + Mockito.doThrow(DuplicateRetentionException.class).when(viewValidator).validateView(ArgumentMatchers.any()); ViewSpecification byPageView = new ViewSpecification(new ViewName(COLLECTION, byPage), List.of(), List.of(), 100); ViewSpecification byLocationView = new ViewSpecification(new ViewName(COLLECTION, byLocation), List.of(), List.of(), 100); EventStreamTO eventStreamTO = new EventStreamTO.Builder() @@ -194,14 +194,14 @@ void given_NonExistingEventStream_when_errorOccursWhileCreation_then_DeleteAgain assertThatThrownBy(() -> service.createEventStream(eventStreamTO)) .isInstanceOf(DuplicateRetentionException.class); - verify(eventStreamRepository).retrieveEventStream(COLLECTION); + Mockito.verify(eventStreamRepository).retrieveEventStream(COLLECTION); } } @Test void when_collectionDoesNotExists_and_triesToDelete_then_throwException() { - when(eventStreamRepository.deleteEventStream(COLLECTION)).thenReturn(0); + Mockito.when(eventStreamRepository.deleteEventStream(COLLECTION)).thenReturn(0); assertThatThrownBy(() -> service.deleteEventStream(COLLECTION)) .isInstanceOf(MissingResourceException.class) @@ -210,11 +210,11 @@ void when_collectionDoesNotExists_and_triesToDelete_then_throwException() { @Test void when_collectionExists_and_triesToDeleteEventStream_then_throwExceptionWithRetrieval() { - when(eventStreamRepository.deleteEventStream(COLLECTION)).thenReturn(1).thenReturn(0); + Mockito.when(eventStreamRepository.deleteEventStream(COLLECTION)).thenReturn(1).thenReturn(0); service.deleteEventStream(COLLECTION); - InOrder inOrder = inOrder(eventStreamRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(eventStreamRepository, eventPublisher); inOrder.verify(eventStreamRepository).deleteEventStream(COLLECTION); inOrder.verify(eventPublisher).publishEvent(deletedEventArgumentCaptor.capture()); assertThat(deletedEventArgumentCaptor.getValue()).isEqualTo(new EventStreamDeletedEvent(COLLECTION)); @@ -226,38 +226,38 @@ void when_collectionExists_and_triesToDeleteEventStream_then_throwExceptionWithR @Test void when_init() { ((EventStreamServiceImpl) service).initEventStream(); - verify(eventStreamRepository).retrieveAllEventStreams(); + Mockito.verify(eventStreamRepository).retrieveAllEventStreams(); } @Test void should_CallDcatServiceToGetDcat_when_GetComposedDcatIsCalled() { service.getComposedDcat(); - verify(dcatServerService).getComposedDcat(); - verifyNoMoreInteractions(dcatServerService); + Mockito.verify(dcatServerService).getComposedDcat(); + Mockito.verifyNoMoreInteractions(dcatServerService); } @Test void when_closeEventStream_thenPublishEventStreamClosedEvent() { - when(eventStreamRepository.retrieveEventStream(COLLECTION)).thenReturn(Optional.of(EVENT_STREAM)); + Mockito.when(eventStreamRepository.retrieveEventStream(COLLECTION)).thenReturn(Optional.of(EVENT_STREAM)); service.closeEventStream(COLLECTION); - verify(eventStreamRepository).closeEventStream(COLLECTION); - verify(eventStreamRepository).retrieveEventStream(COLLECTION); - verify(eventPublisher).publishEvent(new EventStreamClosedEvent(COLLECTION)); + Mockito.verify(eventStreamRepository).closeEventStream(COLLECTION); + Mockito.verify(eventStreamRepository).retrieveEventStream(COLLECTION); + Mockito.verify(eventPublisher).publishEvent(new EventStreamClosedEvent(COLLECTION)); } @Test void when_closeEventStream_andEventStreamDoesNotExist_thenExceptionIsThrown() { - when(eventStreamRepository.retrieveEventStream(COLLECTION)).thenReturn(Optional.empty()); + Mockito.when(eventStreamRepository.retrieveEventStream(COLLECTION)).thenReturn(Optional.empty()); assertThatThrownBy(() -> service.closeEventStream(COLLECTION)) .isInstanceOf(MissingResourceException.class) .hasMessage("Resource of type: eventstream with id: %s could not be found.", COLLECTION); - verify(eventStreamRepository).retrieveEventStream(COLLECTION); - verify(eventPublisher, never()).publishEvent(new EventStreamClosedEvent(COLLECTION)); + Mockito.verify(eventStreamRepository).retrieveEventStream(COLLECTION); + Mockito.verify(eventPublisher, Mockito.never()).publishEvent(new EventStreamClosedEvent(COLLECTION)); } private Model readModelFromFile(String fileName) throws URISyntaxException { diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceServiceImplTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/services/EventSourceServiceImplTest.java similarity index 76% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceServiceImplTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/services/EventSourceServiceImplTest.java index f9084d5234..0e6a3fc24f 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventsource/services/EventSourceServiceImplTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/services/EventSourceServiceImplTest.java @@ -1,28 +1,23 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventsource.services; +package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.services; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventsource.repository.EventSourceRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventsource.services.EventSourceService; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventsource.services.EventSourceServiceImpl; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.DeletionPolicyChangedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventSource; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; +import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InOrder; -import org.mockito.Mock; +import org.mockito.*; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationEventPublisher; import java.util.List; import java.util.Optional; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.when; - @ExtendWith(MockitoExtension.class) class EventSourceServiceImplTest { private static final String COLLECTION_NAME = "collection"; @@ -47,26 +42,26 @@ void setUp() { void when_SaveEventSource_Then_EventSourceSaved() { eventSourceService.saveEventSource(COLLECTION_NAME, retentionModels); - InOrder inOrder = inOrder(eventSourceRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(eventSourceRepository, eventPublisher); inOrder.verify(eventSourceRepository).saveEventSource(eventSourceArgumentCaptor.capture()); - inOrder.verify(eventPublisher).publishEvent(any(DeletionPolicyChangedEvent.class)); + inOrder.verify(eventPublisher).publishEvent(ArgumentMatchers.any(DeletionPolicyChangedEvent.class)); inOrder.verifyNoMoreInteractions(); - assertThat(eventSourceArgumentCaptor.getValue()) + Assertions.assertThat(eventSourceArgumentCaptor.getValue()) .hasFieldOrPropertyWithValue("collectionName", COLLECTION_NAME) .hasFieldOrPropertyWithValue("retentionPolicies", retentionModels); } @Test void when_GetEventSource_Then_EventSourceIsRetrieved() { - when(eventSourceRepository.getEventSource(COLLECTION_NAME)) + Mockito.when(eventSourceRepository.getEventSource(COLLECTION_NAME)) .thenReturn(Optional.of(eventSource)); Optional actual = eventSourceService.getEventSource(COLLECTION_NAME); - InOrder inOrder = inOrder(eventSourceRepository); + InOrder inOrder = Mockito.inOrder(eventSourceRepository); inOrder.verify(eventSourceRepository).getEventSource(COLLECTION_NAME); inOrder.verifyNoMoreInteractions(); - assertThat(actual.get()) + Assertions.assertThat(actual.get()) .hasFieldOrPropertyWithValue("collectionName", COLLECTION_NAME) .hasFieldOrPropertyWithValue("retentionPolicies", retentionModels); } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/entities/ShaclShapeTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/entities/ShaclShapeTest.java similarity index 96% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/entities/ShaclShapeTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/entities/ShaclShapeTest.java index ed16febea2..ec43b41e8d 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/entities/ShaclShapeTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/entities/ShaclShapeTest.java @@ -12,7 +12,6 @@ import java.util.stream.Stream; import static org.apache.jena.rdf.model.ResourceFactory.*; -import static org.apache.jena.rdf.model.ResourceFactory.createResource; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeServiceImplTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeServiceImplTest.java similarity index 79% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeServiceImplTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeServiceImplTest.java index 00aaadc133..6899e70224 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeServiceImplTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/shacl/services/ShaclShapeServiceImplTest.java @@ -12,8 +12,10 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentMatchers; import org.mockito.InOrder; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationEventPublisher; @@ -24,7 +26,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class ShaclShapeServiceImplTest { @@ -45,36 +46,36 @@ class RetrieveShaclShape { @Test void when_collectionExists_and_hasShapeConfigured_then_retrieveShape() throws URISyntaxException { final Model shape = readModelFromFile("shacl/collection-shape.ttl"); - when(shaclShapeRepository.retrieveShaclShape(COLLECTION_NAME_1)) + Mockito.when(shaclShapeRepository.retrieveShaclShape(COLLECTION_NAME_1)) .thenReturn(Optional.of(new ShaclShape(COLLECTION_NAME_1, shape))); assertEquals(new ShaclShape(COLLECTION_NAME_1, shape), service.retrieveShaclShape(COLLECTION_NAME_1)); - InOrder inOrder = inOrder(shaclShapeRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(shaclShapeRepository, eventPublisher); inOrder.verify(shaclShapeRepository).retrieveShaclShape(COLLECTION_NAME_1); inOrder.verifyNoMoreInteractions(); } @Test void when_collectionExists_and_hasNoShapeConfigured_then_retrieveRelatedShape() { - when(shaclShapeRepository.retrieveShaclShape(COLLECTION_NAME_1)) + Mockito.when(shaclShapeRepository.retrieveShaclShape(COLLECTION_NAME_1)) .thenReturn(Optional.of(new ShaclShape(COLLECTION_NAME_1, null))); assertEquals(new ShaclShape(COLLECTION_NAME_1, null), service.retrieveShaclShape(COLLECTION_NAME_1)); - InOrder inOrder = inOrder(shaclShapeRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(shaclShapeRepository, eventPublisher); inOrder.verify(shaclShapeRepository).retrieveShaclShape(COLLECTION_NAME_1); inOrder.verifyNoMoreInteractions(); } @Test void when_collectionDoesNotExists_then_throwException() { - when(shaclShapeRepository.retrieveShaclShape(COLLECTION_NAME_1)).thenReturn(Optional.empty()); + Mockito.when(shaclShapeRepository.retrieveShaclShape(COLLECTION_NAME_1)).thenReturn(Optional.empty()); assertThatThrownBy(() -> service.retrieveShaclShape(COLLECTION_NAME_1)) .isInstanceOf(MissingResourceException.class) .hasMessage("Resource of type: shacl-shape with id: %s could not be found.", COLLECTION_NAME_1); - InOrder inOrder = inOrder(shaclShapeRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(shaclShapeRepository, eventPublisher); inOrder.verify(shaclShapeRepository).retrieveShaclShape(COLLECTION_NAME_1); inOrder.verifyNoMoreInteractions(); } @@ -90,9 +91,9 @@ void when_collectionExists_and_updateShape_then_expectUpdatedShacl() throws URIS ShaclShape updateShaclShape = service.updateShaclShape(shaclShape); assertEquals(shaclShape, updateShaclShape); - InOrder inOrder = inOrder(shaclShapeRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(shaclShapeRepository, eventPublisher); inOrder.verify(shaclShapeRepository).saveShaclShape(shaclShape); - inOrder.verify(eventPublisher).publishEvent(any(ShaclChangedEvent.class)); + inOrder.verify(eventPublisher).publishEvent(ArgumentMatchers.any(ShaclChangedEvent.class)); inOrder.verifyNoMoreInteractions(); } } @@ -103,9 +104,9 @@ class DeleteShaclShape { void when_collectionExists_and_deleteShape_then_throwExceptionWithRetrieval() { service.deleteShaclShape(COLLECTION_NAME_1); - InOrder inOrder = inOrder(shaclShapeRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(shaclShapeRepository, eventPublisher); inOrder.verify(shaclShapeRepository).deleteShaclShape(COLLECTION_NAME_1); - inOrder.verify(eventPublisher).publishEvent(any(ShaclDeletedEvent.class)); + inOrder.verify(eventPublisher).publishEvent(ArgumentMatchers.any(ShaclDeletedEvent.class)); inOrder.verifyNoMoreInteractions(); } } @@ -117,13 +118,13 @@ void when_ApplicationIsStarted_ShaclChangedEventsAreSentOut() { Model model = ModelFactory.createDefaultModel(); ShaclShape shaclShape = new ShaclShape(COLLECTION_NAME_1, model); ShaclShape shaclShape2 = new ShaclShape("otherCollection", model); - when(shaclShapeRepository.retrieveAllShaclShapes()).thenReturn(List.of(shaclShape, shaclShape2)); + Mockito.when(shaclShapeRepository.retrieveAllShaclShapes()).thenReturn(List.of(shaclShape, shaclShape2)); service.initShapes(); - InOrder inOrder = inOrder(shaclShapeRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(shaclShapeRepository, eventPublisher); inOrder.verify(shaclShapeRepository).retrieveAllShaclShapes(); - inOrder.verify(eventPublisher, times(2)).publishEvent((ShaclChangedEvent) any()); + inOrder.verify(eventPublisher, Mockito.times(2)).publishEvent((ShaclChangedEvent) ArgumentMatchers.any()); inOrder.verifyNoMoreInteractions(); } } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/DcatShaclValidatorTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/DcatShaclValidatorTest.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/DcatShaclValidatorTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/DcatShaclValidatorTest.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/EventStreamValidatorTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/EventStreamValidatorTest.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/EventStreamValidatorTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/EventStreamValidatorTest.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ShaclShapeValidatorTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ShaclShapeValidatorTest.java similarity index 96% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ShaclShapeValidatorTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ShaclShapeValidatorTest.java index 2c7c72f4be..3738a98aa2 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ShaclShapeValidatorTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/ShaclShapeValidatorTest.java @@ -64,7 +64,7 @@ void given_ValidViewWithHierarchicalFragmentation_when_validateView_then_ThrowNo void given_InvalidViewWithHierarchicalFragmentation_when_validateView_then_ThrowNoException() throws IOException { final File file = ResourceUtils.getFile("classpath:view/view-with-hierarchical-timebased-frag.ttl"); final String modelString = FileUtils.readFileToString(file, StandardCharsets.UTF_8).replace("day", "invalid-value"); - final Model model = RDFParser.fromString(modelString).lang(Lang.TURTLE).toModel(); + final Model model = RDFParser.create().fromString(modelString).lang(Lang.TURTLE).toModel(); assertThatThrownBy(() -> validator.validate(model)) .isInstanceOf(ShaclValidationException.class) diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatCatalogValidatorTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatCatalogValidatorTest.java similarity index 95% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatCatalogValidatorTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatCatalogValidatorTest.java index 4e8b273ee5..650031fc57 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatCatalogValidatorTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatCatalogValidatorTest.java @@ -17,7 +17,7 @@ import static org.assertj.core.api.Assertions.*; class DcatCatalogValidatorTest { - private final static String validServerDcat = """ + private static final String validServerDcat = """ @prefix dct: . @prefix dcat: . @@ -45,14 +45,14 @@ void test_support() { @Test void when_Valid_then_ThrowNothing() { - final Model model = RDFParser.fromString(validServerDcat).lang(Lang.TURTLE).build().toModel(); + final Model model = RDFParser.create().fromString(validServerDcat).lang(Lang.TURTLE).build().toModel(); assertThatNoException().isThrownBy(() -> validator.validate(model)); } @ParameterizedTest(name = "Expected message: {0}") @ArgumentsSource(InvalidModelProvider.class) void when_Invalid_then_ThrowIllegalArgumentException(String expectedMessage, String turtleDcatString) { - Model dcat = RDFParser.fromString(turtleDcatString).lang(Lang.TURTLE).build().toModel(); + Model dcat = RDFParser.create().fromString(turtleDcatString).lang(Lang.TURTLE).build().toModel(); assertThatThrownBy(() -> validator.validate(dcat)) .isInstanceOf(IllegalArgumentException.class) diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatDatasetValidatorTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatDatasetValidatorTest.java similarity index 97% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatDatasetValidatorTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatDatasetValidatorTest.java index e6fffb9f99..a796f211af 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatDatasetValidatorTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatDatasetValidatorTest.java @@ -43,7 +43,7 @@ void when_ValidModel_Then_Pass() { @ParameterizedTest(name = "Expected message: {0}") @ArgumentsSource(InvalidArgumentsProvider.class) void when_InvalidModel_Then_throwException(String expectedMessage, String dcatString) { - Model dcat = RDFParser.fromString(dcatString).lang(Lang.TURTLE).toModel(); + Model dcat = RDFParser.create().fromString(dcatString).lang(Lang.TURTLE).toModel(); assertThatThrownBy(() -> validator.validate(dcat)) .isInstanceOf(IllegalArgumentException.class) diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatViewValidatorTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatViewValidatorTest.java similarity index 97% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatViewValidatorTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatViewValidatorTest.java index 42d74a8699..fe69acf15e 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatViewValidatorTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/validation/dcat/DcatViewValidatorTest.java @@ -45,7 +45,7 @@ void should_NotThrowAnything_when_Valid() { @ArgumentsSource(InvalidModelProvider.class) void should_ThrowIllegalArgumentException_when_Invalid(String name, String turtleDcatString) { assertThat(name).isNotNull(); - Model dcat = RDFParser.fromString(turtleDcatString).lang(Lang.TURTLE).build().toModel(); + Model dcat = RDFParser.create().fromString(turtleDcatString).lang(Lang.TURTLE).build().toModel(); assertThatThrownBy(() -> validator.validate(dcat)).isInstanceOf(IllegalArgumentException.class); } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/entity/DcatViewTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/entity/DcatViewTest.java similarity index 71% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/entity/DcatViewTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/entity/DcatViewTest.java index ebefaa467c..ad7ed62fab 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/entity/DcatViewTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/entity/DcatViewTest.java @@ -18,27 +18,23 @@ import java.util.function.BiConsumer; import java.util.stream.Stream; -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.model.DcatView.*; -import static org.apache.jena.rdf.model.ResourceFactory.createProperty; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; class DcatViewTest { - private final static String COLLECTION_NAME = "collectionName"; - private final static String VIEW = "view"; - private final static ViewName VIEW_NAME = new ViewName(COLLECTION_NAME, VIEW); - private final static Model MODEL = ModelFactory.createDefaultModel(); + private static final String COLLECTION_NAME = "collectionName"; + private static final String VIEW = "view"; + private static final ViewName VIEW_NAME = new ViewName(COLLECTION_NAME, VIEW); + private static final Model MODEL = ModelFactory.createDefaultModel(); @Test void test_GetViewName() { - assertEquals(VIEW_NAME, DcatView.from(VIEW_NAME, MODEL).getViewName()); + Assertions.assertEquals(VIEW_NAME, DcatView.from(VIEW_NAME, MODEL).getViewName()); } @Test void test_GetDcat() { - assertEquals(MODEL, DcatView.from(VIEW_NAME, MODEL).getDcat()); + Assertions.assertEquals(MODEL, DcatView.from(VIEW_NAME, MODEL).getDcat()); } @Test @@ -55,22 +51,22 @@ void should_ReturnNamedDcatStatements_when_GetStatementsWithBaseIsCalled() { assertThat(result).hasSize(anon.listStatements().toList().size() + nrOfAdditionalDcatStatements); assertThat(resultModel.listStatements(iri, null, (RDFNode) null).toList()).hasSize(8); - assertThat(resultModel.listObjectsOfProperty(iri, RDF.type).next()).isEqualTo(DCAT_DATA_SERVICE); - assertThat(resultModel.listObjectsOfProperty(createProperty("http://purl.org/dc/terms/license"))).hasNext(); - assertThat(resultModel.listObjectsOfProperty(iri, createProperty("http://purl.org/dc/terms/description")).next().asLiteral().getString()) + assertThat(resultModel.listObjectsOfProperty(iri, RDF.type).next()).isEqualTo(DcatView.DCAT_DATA_SERVICE); + assertThat(resultModel.listObjectsOfProperty(ResourceFactory.createProperty("http://purl.org/dc/terms/license"))).hasNext(); + assertThat(resultModel.listObjectsOfProperty(iri, ResourceFactory.createProperty("http://purl.org/dc/terms/description")).next().asLiteral().getString()) .isEqualTo("Geospatial fragmentation for my LDES"); - assertThat(resultModel.listObjectsOfProperty(iri, createProperty("http://purl.org/dc/terms/title")).next() + assertThat(resultModel.listObjectsOfProperty(iri, ResourceFactory.createProperty("http://purl.org/dc/terms/title")).next() .asLiteral().getString()).isEqualTo("My geo-spatial view"); - assertThat(resultModel.listObjectsOfProperty(iri, DCAT_ENDPOINT_URL).next().asResource().getURI()) + assertThat(resultModel.listObjectsOfProperty(iri, DcatView.DCAT_ENDPOINT_URL).next().asResource().getURI()) .isEqualTo("http://localhost.dev/collectionName/view"); - assertThat(resultModel.listObjectsOfProperty(iri, DCAT_SERVES_DATASET).next().asResource().getURI()) + assertThat(resultModel.listObjectsOfProperty(iri, DcatView.DCAT_SERVES_DATASET).next().asResource().getURI()) .isEqualTo("http://localhost.dev/collectionName"); } @ParameterizedTest @ArgumentsSource(EqualityTestProvider.class) void testEqualsAndHashCode(BiConsumer assertion, DcatView a, DcatView b) { - assertNotNull(assertion); + Assertions.assertNotNull(assertion); assertion.accept(a, b); if (a != null && b != null) { assertion.accept(a.hashCode(), b.hashCode()); @@ -107,11 +103,11 @@ private static BiConsumer notEquals() { @Test void when_GetViewDescriptionResourceIsCalled_should_ReturnValidResource() { - DcatView dcatView = from(VIEW_NAME, MODEL); + DcatView dcatView = DcatView.from(VIEW_NAME, MODEL); String host = "http://localhost.dev"; Resource result = dcatView.getViewDescriptionResource(host); - assertEquals("http://localhost.dev/collectionName/view/description", result.getURI()); + Assertions.assertEquals("http://localhost.dev/collectionName/view/description", result.getURI()); } } \ No newline at end of file diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ConfigFilterPredicateTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ConfigFilterPredicateTest.java similarity index 81% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ConfigFilterPredicateTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ConfigFilterPredicateTest.java index f5a0f11b0e..fe5e6bffb2 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ConfigFilterPredicateTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ConfigFilterPredicateTest.java @@ -1,5 +1,6 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.view.service; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.RDFDataMgr; import org.junit.jupiter.api.Test; @@ -7,8 +8,6 @@ import java.net.URISyntaxException; import java.util.Objects; -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.FRAGMENTATION_OBJECT; -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.RETENTION_TYPE; import static org.junit.jupiter.api.Assertions.assertEquals; class ConfigFilterPredicateTest { @@ -17,8 +16,8 @@ class ConfigFilterPredicateTest { void when_StatementsContainAStatementWithSamePredicateAsConfigFilterPredicate_then_TheseAreExtracted() throws URISyntaxException { Model viewModel = readModelFromFile("view/view_valid.ttl"); - ConfigFilterPredicate retentionFilter = new ConfigFilterPredicate(RETENTION_TYPE); - ConfigFilterPredicate fragmentationFilter = new ConfigFilterPredicate(FRAGMENTATION_OBJECT); + ConfigFilterPredicate retentionFilter = new ConfigFilterPredicate(RdfConstants.RETENTION_TYPE); + ConfigFilterPredicate fragmentationFilter = new ConfigFilterPredicate(RdfConstants.FRAGMENTATION_OBJECT); assertEquals(1, viewModel.listStatements().toList().stream() .filter(retentionFilter) diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewServiceImplTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewServiceImplTest.java similarity index 67% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewServiceImplTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewServiceImplTest.java index afb0c5f896..6659af251a 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewServiceImplTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/DcatViewServiceImplTest.java @@ -11,8 +11,10 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationEventPublisher; @@ -21,7 +23,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class DcatViewServiceImplTest { @@ -44,15 +45,15 @@ class DcatViewServiceImplTest { void should_CallRepositoryWithDcatView_when_CreateIsCalled() { dcatViewService.create(VIEW_NAME, MODEL); - verify(eventPublisher).publishEvent(any(DcatViewSavedEvent.class)); - verify(dcatViewRepository).save(DcatView.from(VIEW_NAME, MODEL)); - verifyNoMoreInteractions(dcatViewRepository); + Mockito.verify(eventPublisher).publishEvent(ArgumentMatchers.any(DcatViewSavedEvent.class)); + Mockito.verify(dcatViewRepository).save(DcatView.from(VIEW_NAME, MODEL)); + Mockito.verifyNoMoreInteractions(dcatViewRepository); } @Test void should_GetDcatViewFromRepository_when_FindByViewIsCalled() { DcatView dcatView = DcatView.from(VIEW_NAME, MODEL); - when(dcatViewRepository.findByViewName(VIEW_NAME)).thenReturn(Optional.of(dcatView)); + Mockito.when(dcatViewRepository.findByViewName(VIEW_NAME)).thenReturn(Optional.of(dcatView)); Optional result = dcatViewService.findByViewName(VIEW_NAME); @@ -63,9 +64,9 @@ void should_GetDcatViewFromRepository_when_FindByViewIsCalled() { void should_CallRepositoryWithDcatView_when_DeleteIsCalled() { dcatViewService.delete(VIEW_NAME); - verify(eventPublisher).publishEvent(new DcatViewDeletedEvent(VIEW_NAME)); - verify(dcatViewRepository).delete(VIEW_NAME); - verifyNoMoreInteractions(dcatViewRepository); + Mockito.verify(eventPublisher).publishEvent(new DcatViewDeletedEvent(VIEW_NAME)); + Mockito.verify(dcatViewRepository).delete(VIEW_NAME); + Mockito.verifyNoMoreInteractions(dcatViewRepository); } @Test @@ -73,13 +74,13 @@ void initViews() { DcatView dcatViewA = DcatView.from(ViewName.fromString("coll/A"), MODEL); DcatView dcatViewB = DcatView.from(ViewName.fromString("coll/B"), MODEL); DcatView dcatViewC = DcatView.from(ViewName.fromString("coll/C"), MODEL); - when(dcatViewRepository.findAll()).thenReturn(List.of(dcatViewA, dcatViewB, dcatViewC)); + Mockito.when(dcatViewRepository.findAll()).thenReturn(List.of(dcatViewA, dcatViewB, dcatViewC)); dcatViewService.initViews(); - verify(eventPublisher).publishEvent(new DcatViewSavedEvent(dcatViewA)); - verify(eventPublisher).publishEvent(new DcatViewSavedEvent(dcatViewB)); - verify(eventPublisher).publishEvent(new DcatViewSavedEvent(dcatViewC)); + Mockito.verify(eventPublisher).publishEvent(new DcatViewSavedEvent(dcatViewA)); + Mockito.verify(eventPublisher).publishEvent(new DcatViewSavedEvent(dcatViewB)); + Mockito.verify(eventPublisher).publishEvent(new DcatViewSavedEvent(dcatViewC)); } @Nested @@ -87,18 +88,18 @@ class Update { @Test void should_CallRepositoryWithDcatView_when_EntityExists() { - when(dcatViewRepository.findByViewName(VIEW_NAME)).thenReturn(Optional.of(DcatView.from(VIEW_NAME, MODEL))); + Mockito.when(dcatViewRepository.findByViewName(VIEW_NAME)).thenReturn(Optional.of(DcatView.from(VIEW_NAME, MODEL))); dcatViewService.update(VIEW_NAME, MODEL); - verify(eventPublisher).publishEvent(any(DcatViewSavedEvent.class)); - verify(dcatViewRepository).save(DcatView.from(VIEW_NAME, MODEL)); - verifyNoMoreInteractions(dcatViewRepository); + Mockito.verify(eventPublisher).publishEvent(ArgumentMatchers.any(DcatViewSavedEvent.class)); + Mockito.verify(dcatViewRepository).save(DcatView.from(VIEW_NAME, MODEL)); + Mockito.verifyNoMoreInteractions(dcatViewRepository); } @Test void should_ThrowException_when_EntityDoesNotExist() { - when(dcatViewRepository.findByViewName(VIEW_NAME)).thenReturn(Optional.empty()); + Mockito.when(dcatViewRepository.findByViewName(VIEW_NAME)).thenReturn(Optional.empty()); assertThatThrownBy(() -> dcatViewService.update(VIEW_NAME, MODEL)) .isInstanceOf(MissingResourceException.class) @@ -111,8 +112,8 @@ void should_ThrowException_when_EntityDoesNotExist() { void should_CallRepositoryToFindAllViews_when_FindAllIsCalled() { dcatViewService.findAll(); - verify(dcatViewRepository).findAll(); - verifyNoMoreInteractions(dcatViewRepository); + Mockito.verify(dcatViewRepository).findAll(); + Mockito.verifyNoMoreInteractions(dcatViewRepository); } } \ No newline at end of file diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/RetentionModelExtractorTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/RetentionModelExtractorTest.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/RetentionModelExtractorTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/RetentionModelExtractorTest.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewServiceImplTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewServiceImplTest.java similarity index 78% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewServiceImplTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewServiceImplTest.java index 81f546023d..8a13399608 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewServiceImplTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewServiceImplTest.java @@ -6,6 +6,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.ExistingResourceException; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.VersionCreationProperties; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; import org.apache.jena.rdf.model.Model; @@ -15,9 +16,7 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InOrder; -import org.mockito.InjectMocks; -import org.mockito.Mock; +import org.mockito.*; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationEventPublisher; @@ -29,7 +28,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class ViewServiceImplTest { @@ -50,7 +48,7 @@ class ViewServiceImplTest { @BeforeEach void setUp() { viewService.handleEventStreamInitEvent( - new EventStreamCreatedEvent(new EventStream(COLLECTION, null, null, false))); + new EventStreamCreatedEvent(new EventStream(COLLECTION, null, null, VersionCreationProperties.disabled()))); } @Nested @@ -64,38 +62,38 @@ class AddView { @Test void given_ViewWithDuplicateRetentionPolicy_when_AddView_then_ThrowException() { - when(viewRepository.getViewByViewName(view.getName())).thenReturn(Optional.empty()); - doThrow(DuplicateRetentionException.class).when(viewValidator).validateView(view); + Mockito.when(viewRepository.getViewByViewName(view.getName())).thenReturn(Optional.empty()); + Mockito.doThrow(DuplicateRetentionException.class).when(viewValidator).validateView(view); assertThatThrownBy(() -> viewService.addView(view)).isInstanceOf(DuplicateRetentionException.class); - verify(viewRepository).getViewByViewName(view.getName()); - verifyNoMoreInteractions(viewRepository, eventPublisher); + Mockito.verify(viewRepository).getViewByViewName(view.getName()); + Mockito.verifyNoMoreInteractions(viewRepository, eventPublisher); } @Test void when_ViewDoesNotExist_then_ViewIsAdded() { - when(viewRepository.getViewByViewName(view.getName())).thenReturn(Optional.empty()); + Mockito.when(viewRepository.getViewByViewName(view.getName())).thenReturn(Optional.empty()); viewService.addView(view); - InOrder inOrder = inOrder(viewRepository); + InOrder inOrder = Mockito.inOrder(viewRepository); inOrder.verify(viewRepository).getViewByViewName(view.getName()); inOrder.verify(viewRepository).saveView(view); inOrder.verifyNoMoreInteractions(); - await().untilAsserted(() -> verify(eventPublisher).publishEvent(any(ViewAddedEvent.class))); + await().untilAsserted(() -> Mockito.verify(eventPublisher).publishEvent(ArgumentMatchers.any(ViewAddedEvent.class))); } @Test void when_ViewDoesExist_then_DuplicateViewExceptionIsThrown() { - when(viewRepository.getViewByViewName(view.getName())).thenReturn(Optional.of(view)); + Mockito.when(viewRepository.getViewByViewName(view.getName())).thenReturn(Optional.of(view)); assertThatThrownBy(() -> viewService.addView(view)) .isInstanceOf(ExistingResourceException.class) .hasMessage("Resource of type: view with id: collection/view already exists."); - InOrder inOrder = inOrder(viewRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(viewRepository, eventPublisher); inOrder.verify(viewRepository).getViewByViewName(view.getName()); inOrder.verifyNoMoreInteractions(); } @@ -106,7 +104,7 @@ void when_EventStreamDoesNotExist_then_MissingEventStreamExceptionIsThrown() { .isInstanceOf(MissingResourceException.class) .hasMessage("Resource of type: eventstream with id: not_existing_collection could not be found."); - InOrder inOrder = inOrder(viewRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(viewRepository, eventPublisher); inOrder.verifyNoMoreInteractions(); } } @@ -121,7 +119,7 @@ void when_DeleteViewAndEventStreamDoesNotExist_then_MissingEventStreamExceptionI assertThatThrownBy(() -> viewService.deleteViewByViewName(viewNameOfNotExistingCollection)) .isInstanceOf(MissingResourceException.class) .hasMessage("Resource of type: eventstream with id: not_existing_collection could not be found."); - InOrder inOrder = inOrder(viewRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(viewRepository, eventPublisher); inOrder.verifyNoMoreInteractions(); } @@ -129,9 +127,9 @@ void when_DeleteViewAndEventStreamDoesNotExist_then_MissingEventStreamExceptionI void when_DeleteViewAndViewExists_then_ViewIsDeleted() { viewService.deleteViewByViewName(viewName); - InOrder inOrder = inOrder(viewRepository, eventPublisher, dcatViewService); + InOrder inOrder = Mockito.inOrder(viewRepository, eventPublisher, dcatViewService); inOrder.verify(viewRepository).deleteViewByViewName(viewName); - inOrder.verify(eventPublisher).publishEvent(any(ViewDeletedEvent.class)); + inOrder.verify(eventPublisher).publishEvent(ArgumentMatchers.any(ViewDeletedEvent.class)); inOrder.verifyNoMoreInteractions(); } } @@ -144,24 +142,24 @@ class GetView { void when_GetViewAndViewIsPresent_then_ViewIsReturned() { ViewSpecification expectedViewSpecification = new ViewSpecification(viewName, List.of(), List.of(), 100); - when(viewRepository.getViewByViewName(viewName)).thenReturn(Optional.of(expectedViewSpecification)); + Mockito.when(viewRepository.getViewByViewName(viewName)).thenReturn(Optional.of(expectedViewSpecification)); ViewSpecification actualViewSpecification = viewService.getViewByViewName(viewName); assertThat(actualViewSpecification).isEqualTo(expectedViewSpecification); - InOrder inOrder = inOrder(viewRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(viewRepository, eventPublisher); inOrder.verify(viewRepository).getViewByViewName(viewName); inOrder.verifyNoMoreInteractions(); } @Test void when_GetViewAndViewIsNotPresent_then_MissingViewExceptionIsThrown() { - when(viewRepository.getViewByViewName(viewName)).thenReturn(Optional.empty()); + Mockito.when(viewRepository.getViewByViewName(viewName)).thenReturn(Optional.empty()); assertThatThrownBy(() -> viewService.getViewByViewName(viewName)) .isInstanceOf(MissingResourceException.class); - InOrder inOrder = inOrder(viewRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(viewRepository, eventPublisher); inOrder.verify(viewRepository).getViewByViewName(viewName); inOrder.verifyNoMoreInteractions(); } @@ -178,20 +176,20 @@ void when_GetViewsByCollectionNameAndEventStreamDoesNotExist_then_MissingEventSt assertThatThrownBy(() -> viewService.getViewsByCollectionName(NOT_EXISTING_COLLECTION)) .isInstanceOf(MissingResourceException.class) .hasMessage("Resource of type: eventstream with id: not_existing_collection could not be found."); - InOrder inOrder = inOrder(viewRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(viewRepository, eventPublisher); inOrder.verifyNoMoreInteractions(); } @Test void when_GetViewsByCollectionName_then_ViewsAreReturned() { - when(viewRepository.retrieveAllViewsOfCollection(viewName.getCollectionName())) + Mockito.when(viewRepository.retrieveAllViewsOfCollection(viewName.getCollectionName())) .thenReturn(List.of(expectedViewSpecification)); List actualViewSpecifications = viewService .getViewsByCollectionName(viewName.getCollectionName()); assertEquals(List.of(expectedViewSpecification), actualViewSpecifications); - InOrder inOrder = inOrder(viewRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(viewRepository, eventPublisher); inOrder.verify(viewRepository).retrieveAllViewsOfCollection(viewName.getCollectionName()); inOrder.verifyNoMoreInteractions(); } @@ -205,14 +203,14 @@ void when_ApplicationIsStartedUp_then_ViewAddedEventsAreSent() { List.of(), List.of(), 100); ViewSpecification secondViewSpecification = new ViewSpecification(new ViewName(COLLECTION, "view2"), List.of(), List.of(), 100); - when(viewRepository.retrieveAllViews()) + Mockito.when(viewRepository.retrieveAllViews()) .thenReturn(List.of(firstViewSpecification, secondViewSpecification)); viewService.initViews(); - InOrder inOrder = inOrder(viewRepository, eventPublisher); + InOrder inOrder = Mockito.inOrder(viewRepository, eventPublisher); inOrder.verify(viewRepository).retrieveAllViews(); - inOrder.verify(eventPublisher, times(2)).publishEvent(any(ViewInitializationEvent.class)); + inOrder.verify(eventPublisher, Mockito.times(2)).publishEvent(ArgumentMatchers.any(ViewInitializationEvent.class)); inOrder.verifyNoMoreInteractions(); } } @@ -223,7 +221,7 @@ void should_CallRepositoryWithDcatView_when_ViewDeletedEventIsPublished() { ViewSpecification firstViewSpecification = new ViewSpecification(view, List.of(), List.of(), 100); ViewName view2 = new ViewName(COLLECTION, "view2"); ViewSpecification secondViewSpecification = new ViewSpecification(view2, List.of(), List.of(), 100); - when(viewRepository.retrieveAllViewsOfCollection(COLLECTION)) + Mockito.when(viewRepository.retrieveAllViewsOfCollection(COLLECTION)) .thenReturn(List.of(firstViewSpecification, secondViewSpecification)); viewService.initViews(); diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewSpecificationConverterTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewSpecificationConverterTest.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewSpecificationConverterTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/view/service/ViewSpecificationConverterTest.java diff --git a/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamReaderTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamReaderTest.java new file mode 100644 index 0000000000..19b40e0de6 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamReaderTest.java @@ -0,0 +1,157 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.admin.spi; + +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.FragmentationConfig; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.rest.PrefixConstructor; +import org.apache.commons.io.FileUtils; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.riot.Lang; +import org.apache.jena.riot.RDFDataMgr; +import org.apache.jena.riot.RDFParser; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.springframework.util.ResourceUtils; + +import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; + +class EventStreamReaderTest { + public static final String TIMESTAMP_PATH = "http://purl.org/dc/terms/created"; + public static final String VERSION_OF_PATH = "http://purl.org/dc/terms/isVersionOf"; + private EventStreamReader eventStreamReader; + private Model shacl; + + @BeforeEach + void setUp() { + String hostName = "http://localhost:8080"; + PrefixConstructor prefixConstructor = new PrefixConstructor(hostName, false); + RetentionModelExtractor retentionModelExtractor = new RetentionModelExtractor(); + ViewSpecificationConverter viewSpecificationConverter = new ViewSpecificationConverter(retentionModelExtractor, + new FragmentationConfigExtractor(), prefixConstructor); + eventStreamReader = new EventStreamReader(viewSpecificationConverter, retentionModelExtractor); + shacl = RDFDataMgr.loadModel("shacl/collection-shape.ttl"); + } + + @Test + void given_ModelWithViews_when_Read_then_ReturnEventStreamTo() { + final Model eventStreamModel = RDFDataMgr.loadModel("eventstream/streams/ldes-with-named-views.ttl"); + final EventStreamTO expected = eventStreamToWithViews(); + + final EventStreamTO eventStreamTO = eventStreamReader.read(eventStreamModel); + + assertThat(eventStreamTO).isEqualTo(expected); + } + + @Test + void given_modelWithoutViews_when_Read_then_convertToEventStreamResponse() { + final Model eventStreamModel = RDFDataMgr.loadModel("eventstream/streams/ldes-empty.ttl"); + EventStreamTO expectedEventStreamTO = new EventStreamTO.Builder() + .withCollection("collectionName1") + .withTimestampPath(TIMESTAMP_PATH) + .withVersionOfPath(VERSION_OF_PATH) + .withShacl(shacl) + .build(); + + final EventStreamTO result = eventStreamReader.read(eventStreamModel); + + assertThat(result).isEqualTo(expectedEventStreamTO); + } + + @Nested + class EventStreamWithVersionCreation { + @Test + void given_VersionCreationEnabled_when_FromModel_then_ResultContainsDefaultDelimiter() { + final Model eventStreamModel = RDFDataMgr.loadModel("eventstream/streams/ldes-create-versions.ttl"); + + final EventStreamTO result = eventStreamReader.read(eventStreamModel); + + assertThat(result.getVersionDelimiter()).isEqualTo("/"); + } + + @Test + void given_VersionCreationEnabledAndVersionDelimiter_when_FromModel_then_ResultContainsDefaultDelimiter() { + final Model eventStreamModel = RDFDataMgr.loadModel("eventstream/streams/ldes-create-versions-with-custom-delimiter.nq"); + + final EventStreamTO result = eventStreamReader.read(eventStreamModel); + + assertThat(result.getVersionDelimiter()).isEqualTo("&version="); + } + } + + @Nested + class EventStreamWithSkoleminationDomain { + private static final String LDES_SKOLEMIZATION_DOMAIN_KEY = "#LDES_SKOLEMIZATION_DOMAIN_LINE"; + private static final String SKOLEMIZATION_DOMAIN = "http://example.org"; + + @Test + void given_ModelWithSkolemizationDomainLiteral_when_FromModel_then_ReturnEventStreamToWithSkolemizationDomain() { + final String modelString = readModelString() + .replace(LDES_SKOLEMIZATION_DOMAIN_KEY, "ldes:skolemizationDomain \"" + SKOLEMIZATION_DOMAIN + "\" ;"); + final Model model = RDFParser.create().fromString(modelString).lang(Lang.TTL).toModel(); + + final EventStreamTO eventStreamTO = eventStreamReader.read(model); + + assertThat(eventStreamTO.getSkolemizationDomain()).isNull(); + } + + @Test + void given_ModelWithSkolemizationDomainResource_when_FromModel_then_ReturnEventStreamToWithSkolemizationDomain() { + final String modelString = readModelString() + .replace(LDES_SKOLEMIZATION_DOMAIN_KEY, "ldes:skolemizationDomain <" + SKOLEMIZATION_DOMAIN + "> ;"); + final Model model = RDFParser.create().fromString(modelString).lang(Lang.TTL).toModel(); + + final EventStreamTO eventStreamTO = eventStreamReader.read(model); + + assertThat(eventStreamTO.getSkolemizationDomain()).isEqualTo(SKOLEMIZATION_DOMAIN); + } + + @Test + void given_ModelWithoutSkolemization_when_FromModel_then_ReturnEventStreamToWitouthSkolemizationDomain() { + final String modelString = readModelString().replace(LDES_SKOLEMIZATION_DOMAIN_KEY, ""); + final Model model = RDFParser.create().fromString(modelString).lang(Lang.TTL).toModel(); + + final EventStreamTO eventStreamTO = eventStreamReader.read(model); + + assertThat(eventStreamTO.getSkolemizationDomain()).isNull(); + } + + private String readModelString() { + try { + final File file = ResourceUtils.getFile("classpath:eventstream/streams/ldes-with-skol-dom.ttl"); + return FileUtils.readFileToString(file, StandardCharsets.UTF_8); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + } + + private EventStreamTO eventStreamToWithViews() { + FragmentationConfig fragmentationConfig = new FragmentationConfig(); + fragmentationConfig.setName("ExampleFragmentation"); + fragmentationConfig.setConfig(Map.of("property", "ldes:propertyPath")); + return new EventStreamTO.Builder() + .withCollection("collectionName1") + .withTimestampPath(TIMESTAMP_PATH) + .withVersionOfPath(VERSION_OF_PATH) + .withShacl(shacl) + .withViews(List.of( + new ViewSpecification( + new ViewName("collectionName1", "view2"), + List.of(), + List.of(fragmentationConfig), 100), + new ViewSpecification( + new ViewName("collectionName1", "view1"), + List.of(), + List.of(fragmentationConfig), 100))) + .build(); + } + +} \ No newline at end of file diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTOTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTOTest.java similarity index 74% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTOTest.java rename to ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTOTest.java index df5396399e..142d2ed734 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTOTest.java +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamTOTest.java @@ -17,13 +17,13 @@ import static org.apache.jena.rdf.model.ResourceFactory.createProperty; import static org.apache.jena.rdf.model.ResourceFactory.createResource; -import static org.junit.jupiter.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; class EventStreamTOTest { private static final String COLLECTION = "collection"; private static final String TIMESTAMP_PATH = "generatedAt"; private static final String VERSION_OF_PATH = "isVersionOf"; - private static final boolean VERSION_CREATION_ENABLED = false; private static final boolean CLOSED = false; private static final EventStreamTO EVENT_STREAM_RESPONSE = getBaseBuilder().build(); private static final EventStreamTO EVENT_STREAM_RESPONSE_WITH_DATASET = getBaseBuilder() @@ -35,7 +35,7 @@ class EventStreamTOTest { void test_equality() { EventStreamTO other = getBaseBuilder().build(); - assertEquals(EVENT_STREAM_RESPONSE, other); + assertThat(other).isEqualTo(EVENT_STREAM_RESPONSE); } @Test @@ -44,23 +44,25 @@ void test_equality_with_dataset() { createProperty("predicate"), "value")); EventStreamTO other = getBaseBuilder().withDcatDataset(dcatDataset).build(); - assertEquals(EVENT_STREAM_RESPONSE_WITH_DATASET, other); + assertThat(other).isEqualTo(EVENT_STREAM_RESPONSE_WITH_DATASET); } @ParameterizedTest(name = "{0} is not equal") @ArgumentsSource(EventStreamResponseArgumentsProvider.class) void test_inEquality(Object other) { - assertNotEquals(EVENT_STREAM_RESPONSE, other); + assertThat(other).isNotEqualTo(EVENT_STREAM_RESPONSE); if (other != null) { - assertNotEquals(EVENT_STREAM_RESPONSE.hashCode(), other.hashCode()); + assertThat(other).doesNotHaveSameHashCodeAs(EVENT_STREAM_RESPONSE); } } @Test void test_invalid_skolem_domain() { var builder = getBaseBuilder().withSkolemizationDomain("example.com"); - assertThrows(InvalidSkolemisationDomainException.class, builder::build); + assertThatThrownBy(builder::build) + .isInstanceOf(InvalidSkolemisationDomainException.class) + .hasMessage("Invalid Skolemisation Domain. Should be URI. Provided skolemizationDomain : example.com"); } static class EventStreamResponseArgumentsProvider implements ArgumentsProvider { @@ -72,15 +74,15 @@ public Stream provideArguments(ExtensionContext extensionCo getBaseBuilder() .withShacl(ModelFactory.createDefaultModel().add(createResource(), RdfConstants.IS_PART_OF_PROPERTY, "object")) .build(), - Arguments.of("VersionPath", - getBaseBuilder().withVersionOfPath("other").build()), - Arguments.of("timestampPath", - getBaseBuilder().withTimestampPath("other").build()), - Arguments.of("collection", - getBaseBuilder().withCollection("other").build()), - Arguments.of("null", null), - Arguments.of("dataset", EVENT_STREAM_RESPONSE_WITH_DATASET), - Arguments.of(new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_ENABLED)))); + Arguments.of("VersionPath", + getBaseBuilder().withVersionOfPath("other").build()), + Arguments.of("timestampPath", + getBaseBuilder().withTimestampPath("other").build()), + Arguments.of("collection", + getBaseBuilder().withCollection("other").build()), + Arguments.of("null", null), + Arguments.of("dataset", EVENT_STREAM_RESPONSE_WITH_DATASET), + Arguments.of(new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, null)))); } } @@ -89,7 +91,6 @@ private static EventStreamTO.Builder getBaseBuilder() { .withCollection(COLLECTION) .withTimestampPath(TIMESTAMP_PATH) .withVersionOfPath(VERSION_OF_PATH) - .withVersionCreationEnabled(VERSION_CREATION_ENABLED) .withClosed(CLOSED) .withShacl(ModelFactory.createDefaultModel()) .withEventSourceRetentionPolicies(List.of()); diff --git a/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamWriterTest.java b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamWriterTest.java new file mode 100644 index 0000000000..18eb237166 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamWriterTest.java @@ -0,0 +1,184 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.admin.spi; + +import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities.DcatDataset; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdderImpl; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.FragmentationConfig; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.rest.PrefixConstructor; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.rdf.model.RDFNode; +import org.apache.jena.rdf.model.ResourceFactory; +import org.apache.jena.riot.Lang; +import org.apache.jena.riot.RDFDataMgr; +import org.apache.jena.riot.RDFParser; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; + +class EventStreamWriterTest { + private static final String TIMESTAMP_PATH = "http://purl.org/dc/terms/created"; + private static final String VERSION_OF_PATH = "http://purl.org/dc/terms/isVersionOf"; + private static final String COLLECTION_NAME = "collectionName1"; + private EventStreamWriter eventStreamWriter; + private Model shacl; + private Model dataSetModel; + private List eventSourceRetentionModels; + + @BeforeEach + void setUp() { + String hostName = "http://localhost:8080"; + PrefixConstructor prefixConstructor = new PrefixConstructor(hostName, false); + ViewSpecificationConverter viewSpecificationConverter = new ViewSpecificationConverter( + new RetentionModelExtractor(), + new FragmentationConfigExtractor(), + prefixConstructor + ); + eventStreamWriter = new EventStreamWriter(viewSpecificationConverter, new PrefixAdderImpl(), prefixConstructor); + shacl = RDFDataMgr.loadModel("shacl/collection-shape.ttl"); + dataSetModel = RDFDataMgr.loadModel("dcat/dataset/valid.ttl"); + eventSourceRetentionModels = List.of(RDFDataMgr.loadModel("retention/example_timebased.ttl")); + } + + @Nested + class EventStreamWithViews { + private List views; + private Model eventStreamModel; + + @BeforeEach + void setUp() { + views = viewSpecifications(); + eventStreamModel = RDFDataMgr.loadModel("eventstream/streams/ldes-with-named-views.ttl"); + } + + @Test + void when_eventStreamHasViews_then_convertToModel() { + final EventStreamTO eventStream = baseBuilder() + .withViews(views) + .withShacl(shacl) + .withEventSourceRetentionPolicies(eventSourceRetentionModels) + .build(); + + final Model convertedModel = eventStreamWriter.write(eventStream); + + assertThat(convertedModel).matches(eventStreamModel::isIsomorphicWith); + } + } + + @Nested + class EventStreamWithoutViews { + private Model eventStreamModel; + + @BeforeEach + void setUp() { + eventStreamModel = RDFDataMgr.loadModel("eventstream/streams/ldes-empty.ttl"); + } + + @Test + void when_eventStreamResponseHasNoViews_then_convertToModel() { + final EventStreamTO eventStream = baseBuilder() + .withShacl(shacl) + .withEventSourceRetentionPolicies(eventSourceRetentionModels) + .build(); + final Model convertedModel = eventStreamWriter.write(eventStream); + assertThat(convertedModel).matches(eventStreamModel::isIsomorphicWith); + } + + @ParameterizedTest + @ValueSource(strings = {"/", "&version="}) + void when_eventStreamCreateVersions_then_convertToModel(String delimiter) { + final Model expectedModel = RDFDataMgr.loadModel("eventstream/streams-with-dcat/ldes-create-versions.ttl"); + final Model emptyShacl = RDFParser.create() + .fromString(""" + _:genid1 . + _:genid1 . + """) + .lang(Lang.NQUADS) + .toModel(); + final EventStreamTO eventStream = new EventStreamTO.Builder() + .withCollection("animals") + .withTimestampPath(TIMESTAMP_PATH) + .withVersionOfPath(VERSION_OF_PATH) + .withShacl(emptyShacl) + .withVersionDelimiter(delimiter) + .build(); + + final Model convertedModel = eventStreamWriter.write(eventStream); + + assertThat(convertedModel).matches(expectedModel::isIsomorphicWith); + } + + @Test + void when_eventStreamResponseHasTimestampAndVersionOf_then_convertToModel() { + EventStreamTO eventStream = new EventStreamTO.Builder() + .withCollection(COLLECTION_NAME) + .withShacl(shacl) + .withEventSourceRetentionPolicies(eventSourceRetentionModels) + .build(); + + eventStreamModel.remove(eventStreamModel.listStatements(null, + ResourceFactory.createProperty("https://w3id.org/ldes#versionOfPath"), (RDFNode) null)); + eventStreamModel.remove(eventStreamModel.listStatements(null, + ResourceFactory.createProperty("https://w3id.org/ldes#timestampPath"), (RDFNode) null)); + + final Model convertedModel = eventStreamWriter.write(eventStream); + + assertThat(convertedModel).matches(eventStreamModel::isIsomorphicWith); + } + } + + @Nested + class EventStreamWithViewsAndDataset { + private List views; + private Model eventStreamModel; + + @BeforeEach + void setUp() { + views = viewSpecifications(); + eventStreamModel = RDFDataMgr.loadModel("eventstream/streams/ldes-and-dataset-with-named-views.ttl"); + } + + @Test + void when_eventStreamHasViewsAndDataset_Then_ConvertToModel() { + final EventStreamTO eventStream = baseBuilder() + .withVersionDelimiter("/") + .withViews(views) + .withShacl(shacl) + .withEventSourceRetentionPolicies(eventSourceRetentionModels) + .withDcatDataset(new DcatDataset(COLLECTION_NAME, dataSetModel)) + .build(); + final Model convertedModel = eventStreamWriter.write(eventStream); + + assertThat(convertedModel).matches(eventStreamModel::isIsomorphicWith); + } + } + + private static EventStreamTO.Builder baseBuilder() { + return new EventStreamTO.Builder() + .withCollection(COLLECTION_NAME) + .withTimestampPath(TIMESTAMP_PATH) + .withVersionOfPath(VERSION_OF_PATH); + } + + private List viewSpecifications() { + FragmentationConfig fragmentationConfig = new FragmentationConfig(); + fragmentationConfig.setName("ExampleFragmentation"); + fragmentationConfig.setConfig(Map.of("property", "ldes:propertyPath")); + return List.of( + new ViewSpecification( + new ViewName(COLLECTION_NAME, "view2"), + List.of(), + List.of(fragmentationConfig), 100), + new ViewSpecification( + new ViewName(COLLECTION_NAME, "view1"), + List.of(), + List.of(fragmentationConfig), 100)); + } +} \ No newline at end of file diff --git a/ldes-server-admin/src/test/resources/dcat/catalog/invalid-server-dcat.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/catalog/invalid-server-dcat.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/catalog/invalid-server-dcat.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/catalog/invalid-server-dcat.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/catalog/server.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/catalog/server.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/catalog/server.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/catalog/server.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/catalog/valid-server-dcat.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/catalog/valid-server-dcat.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/catalog/valid-server-dcat.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/catalog/valid-server-dcat.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dataservice/dcat-view-invalid.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataservice/dcat-view-invalid.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dataservice/dcat-view-invalid.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataservice/dcat-view-invalid.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dataservice/dcat-view-valid.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataservice/dcat-view-valid.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dataservice/dcat-view-valid.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataservice/dcat-view-valid.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dataservice/view-by-geospatial.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataservice/view-by-geospatial.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dataservice/view-by-geospatial.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataservice/view-by-geospatial.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dataservice/view-by-page.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataservice/view-by-page.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dataservice/view-by-page.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataservice/view-by-page.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dataset/buildings.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataset/buildings.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dataset/buildings.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataset/buildings.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dataset/not-valid.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataset/not-valid.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dataset/not-valid.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataset/not-valid.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dataset/parcels.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataset/parcels.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dataset/parcels.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataset/parcels.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dataset/valid.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataset/valid.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dataset/valid.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dataset/valid.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dcat-ap_2.0.1_shacl_shapes.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dcat-ap_2.0.1_shacl_shapes.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dcat-ap_2.0.1_shacl_shapes.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dcat-ap_2.0.1_shacl_shapes.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dcat-combined-all.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dcat-combined-all.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dcat-combined-all.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dcat-combined-all.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/dcat-combined-without-views.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dcat-combined-without-views.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/dcat-combined-without-views.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/dcat-combined-without-views.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/invalid-to-provided-shape.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/invalid-to-provided-shape.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/invalid-to-provided-shape.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/invalid-to-provided-shape.ttl diff --git a/ldes-server-admin/src/test/resources/dcat/valid-to-provided-shape.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/valid-to-provided-shape.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/dcat/valid-to-provided-shape.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/dcat/valid-to-provided-shape.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams-with-dcat/ldes-create-versions.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams-with-dcat/ldes-create-versions.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams-with-dcat/ldes-create-versions.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams-with-dcat/ldes-create-versions.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams-with-dcat/ldes-with-dcat.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams-with-dcat/ldes-with-dcat.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams-with-dcat/ldes-with-dcat.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams-with-dcat/ldes-with-dcat.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/ldes-and-dataset-with-named-views.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-and-dataset-with-named-views.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/ldes-and-dataset-with-named-views.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-and-dataset-with-named-views.ttl diff --git a/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-create-versions-with-custom-delimiter.nq b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-create-versions-with-custom-delimiter.nq new file mode 100644 index 0000000000..41b7d08525 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-create-versions-with-custom-delimiter.nq @@ -0,0 +1,7 @@ + . + . + . + "true"^^ . + "&version=" . + _:genid1 . +_:genid1 . \ No newline at end of file diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/ldes-create-versions.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-create-versions.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/ldes-create-versions.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-create-versions.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/ldes-empty.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-empty.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/ldes-empty.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-empty.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/ldes-with-duplicate-retention.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-with-duplicate-retention.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/ldes-with-duplicate-retention.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-with-duplicate-retention.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/ldes-with-invalid-skol-dom.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-with-invalid-skol-dom.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/ldes-with-invalid-skol-dom.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-with-invalid-skol-dom.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/ldes-with-named-views.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-with-named-views.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/ldes-with-named-views.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-with-named-views.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/ldes-with-skol-dom.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-with-skol-dom.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/ldes-with-skol-dom.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-with-skol-dom.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/ldes-with-valid-skol-dom.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-with-valid-skol-dom.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/ldes-with-valid-skol-dom.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-with-valid-skol-dom.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/ldes-without-type.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-without-type.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/ldes-without-type.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes-without-type.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/ldes.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/ldes.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/ldes.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/malformed-ldes.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/malformed-ldes.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/malformed-ldes.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/malformed-ldes.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/multiple-ldes.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/multiple-ldes.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/multiple-ldes.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/multiple-ldes.ttl diff --git a/ldes-server-admin/src/test/resources/eventstream/streams/valid-ldes.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/valid-ldes.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/eventstream/streams/valid-ldes.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/eventstream/streams/valid-ldes.ttl diff --git a/ldes-server-admin/src/test/resources/features/dcatdataset/dcatdataset.feature b/ldes-server-admin/ldes-server-admin-common/src/test/resources/features/dcatdataset/dcatdataset.feature similarity index 100% rename from ldes-server-admin/src/test/resources/features/dcatdataset/dcatdataset.feature rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/features/dcatdataset/dcatdataset.feature diff --git a/ldes-server-admin/src/test/resources/features/dcatserver/delete-dcatserver.feature b/ldes-server-admin/ldes-server-admin-common/src/test/resources/features/dcatserver/delete-dcatserver.feature similarity index 100% rename from ldes-server-admin/src/test/resources/features/dcatserver/delete-dcatserver.feature rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/features/dcatserver/delete-dcatserver.feature diff --git a/ldes-server-admin/src/test/resources/features/dcatserver/post-dcatserver.feature b/ldes-server-admin/ldes-server-admin-common/src/test/resources/features/dcatserver/post-dcatserver.feature similarity index 100% rename from ldes-server-admin/src/test/resources/features/dcatserver/post-dcatserver.feature rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/features/dcatserver/post-dcatserver.feature diff --git a/ldes-server-admin/src/test/resources/features/dcatserver/put-dcatserver.feature b/ldes-server-admin/ldes-server-admin-common/src/test/resources/features/dcatserver/put-dcatserver.feature similarity index 100% rename from ldes-server-admin/src/test/resources/features/dcatserver/put-dcatserver.feature rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/features/dcatserver/put-dcatserver.feature diff --git a/ldes-server-admin/src/test/resources/features/dcatview/dcatview.feature b/ldes-server-admin/ldes-server-admin-common/src/test/resources/features/dcatview/dcatview.feature similarity index 100% rename from ldes-server-admin/src/test/resources/features/dcatview/dcatview.feature rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/features/dcatview/dcatview.feature diff --git a/ldes-server-admin/src/test/resources/features/eventstreams/eventstreamscontroller.feature b/ldes-server-admin/ldes-server-admin-common/src/test/resources/features/eventstreams/eventstreamscontroller.feature similarity index 100% rename from ldes-server-admin/src/test/resources/features/eventstreams/eventstreamscontroller.feature rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/features/eventstreams/eventstreamscontroller.feature diff --git a/ldes-server-admin/src/test/resources/features/views/viewscontroller.feature b/ldes-server-admin/ldes-server-admin-common/src/test/resources/features/views/viewscontroller.feature similarity index 100% rename from ldes-server-admin/src/test/resources/features/views/viewscontroller.feature rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/features/views/viewscontroller.feature diff --git a/ldes-server-admin/src/test/resources/retention/example_timebased.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/example_timebased.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/retention/example_timebased.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/example_timebased.ttl diff --git a/ldes-server-admin/src/test/resources/retention/example_versionbased.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/example_versionbased.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/retention/example_versionbased.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/example_versionbased.ttl diff --git a/ldes-server-admin/src/test/resources/retention/fictional_retentionpolicy.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/fictional_retentionpolicy.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/retention/fictional_retentionpolicy.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/fictional_retentionpolicy.ttl diff --git a/ldes-server-admin/src/test/resources/retention/multiple_retentionpolicies.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/multiple_retentionpolicies.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/retention/multiple_retentionpolicies.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/multiple_retentionpolicies.ttl diff --git a/ldes-server-admin/src/test/resources/retention/one-year-timebased-policy.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/one-year-timebased-policy.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/retention/one-year-timebased-policy.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/one-year-timebased-policy.ttl diff --git a/ldes-server-admin/src/test/resources/retention/ten-minutes-timebased-policy.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/ten-minutes-timebased-policy.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/retention/ten-minutes-timebased-policy.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/ten-minutes-timebased-policy.ttl diff --git a/ldes-server-admin/src/test/resources/retention/timebased_retentionpolicy.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/timebased_retentionpolicy.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/retention/timebased_retentionpolicy.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/timebased_retentionpolicy.ttl diff --git a/ldes-server-admin/src/test/resources/retention/versionbased_retentionpolicy.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/versionbased_retentionpolicy.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/retention/versionbased_retentionpolicy.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/retention/versionbased_retentionpolicy.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/collection-shape.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/collection-shape.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/collection-shape.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/collection-shape.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/invalid-shape.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/invalid-shape.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/invalid-shape.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/invalid-shape.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/invalid-skol-dom-report.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/invalid-skol-dom-report.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/invalid-skol-dom-report.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/invalid-skol-dom-report.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/menu-shape.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/menu-shape.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/menu-shape.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/menu-shape.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/server-shape.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/server-shape.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/server-shape.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/server-shape.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/shape-name1.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/shape-name1.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/shape-name1.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/shape-name1.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/shape-name2.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/shape-name2.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/shape-name2.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/shape-name2.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/shape-without-type.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/shape-without-type.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/shape-without-type.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/shape-without-type.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/valid-shape.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/valid-shape.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/valid-shape.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/valid-shape.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/validation/eventstreamShaclShape.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/validation/eventstreamShaclShape.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/validation/eventstreamShaclShape.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/validation/eventstreamShaclShape.ttl diff --git a/ldes-server-admin/src/main/resources/shapeShaclShape.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/validation/shapeShaclShape.ttl similarity index 100% rename from ldes-server-admin/src/main/resources/shapeShaclShape.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/validation/shapeShaclShape.ttl diff --git a/ldes-server-admin/src/test/resources/shacl/validation/viewShaclShape.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/validation/viewShaclShape.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/validation/viewShaclShape.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/shacl/validation/viewShaclShape.ttl diff --git a/ldes-server-admin/src/test/resources/view/another-view.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/view/another-view.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/view/another-view.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/view/another-view.ttl diff --git a/ldes-server-admin/src/test/resources/view/view-with-duplicate-retention.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view-with-duplicate-retention.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/view/view-with-duplicate-retention.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view-with-duplicate-retention.ttl diff --git a/ldes-server-admin/src/test/resources/view/view-with-hierarchical-timebased-frag.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view-with-hierarchical-timebased-frag.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/view/view-with-hierarchical-timebased-frag.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view-with-hierarchical-timebased-frag.ttl diff --git a/ldes-server-admin/src/test/resources/view/view-with-two-diff-retention.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view-with-two-diff-retention.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/view/view-with-two-diff-retention.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view-with-two-diff-retention.ttl diff --git a/ldes-server-admin/src/test/resources/view/view-without-retention.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view-without-retention.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/view/view-without-retention.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view-without-retention.ttl diff --git a/ldes-server-admin/src/test/resources/view/view.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/view/view.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view.ttl diff --git a/ldes-server-admin/src/test/resources/view/view_multiple_fragmentations.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view_multiple_fragmentations.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/view/view_multiple_fragmentations.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view_multiple_fragmentations.ttl diff --git a/ldes-server-admin/src/test/resources/view/view_valid.ttl b/ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view_valid.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/view/view_valid.ttl rename to ldes-server-admin/ldes-server-admin-common/src/test/resources/view/view_valid.ttl diff --git a/ldes-server-admin/README.md b/ldes-server-admin/ldes-server-admin-rest/README.md similarity index 100% rename from ldes-server-admin/README.md rename to ldes-server-admin/ldes-server-admin-rest/README.md diff --git a/ldes-server-admin/ldes-server-admin-rest/pom.xml b/ldes-server-admin/ldes-server-admin-rest/pom.xml new file mode 100644 index 0000000000..5ac2fc9a8d --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/pom.xml @@ -0,0 +1,104 @@ + + + 4.0.0 + ldes-server-admin-rest + + be.vlaanderen.informatievlaanderen.vsds + ldes-server-admin + 3.5.0-SNAPSHOT + + + + + + be.vlaanderen.informatievlaanderen.vsds + ldes-server-admin-common + ${project.version} + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + + + io.swagger.core.v3 + swagger-annotations-jakarta + + + + + io.micrometer + micrometer-tracing-bridge-otel + + + io.micrometer + micrometer-registry-prometheus + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.boot + spring-boot-starter-actuator + + + io.zipkin.reporter2 + zipkin-reporter-brave + + + com.github.loki4j + loki-logback-appender + + + + + io.cucumber + cucumber-java + + + io.cucumber + cucumber-spring + + + io.cucumber + cucumber-junit-platform-engine + + + org.junit.platform + junit-platform-suite + + + org.awaitility + awaitility + test + + + + + org.jetbrains + annotations + + + com.google.guava + guava + ${google-guava.version} + + + + + ${project.artifactId} + + + org.apache.maven.plugins + maven-assembly-plugin + + + + + \ No newline at end of file diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/AdminWebConfig.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/AdminWebConfig.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/AdminWebConfig.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/AdminWebConfig.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestController.java similarity index 91% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestController.java index d8aac5d6ca..d4b8dfa4a3 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestController.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestController.java @@ -1,9 +1,9 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.controllers; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.services.EventStreamService; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamConverter; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.validation.ModelValidator; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamReader; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.RetentionModelExtractor; import io.micrometer.observation.annotation.Observed; import org.apache.jena.rdf.model.Model; @@ -26,7 +26,7 @@ public class AdminEventStreamsRestController implements OpenApiAdminEventStreams private static final Logger log = LoggerFactory.getLogger(AdminEventStreamsRestController.class); private final EventStreamService eventStreamService; - private final EventStreamConverter eventStreamConverter; + private final EventStreamReader eventStreamReader; private final RetentionModelExtractor retentionModelExtractor; private final ModelValidator eventStreamValidator; private final ModelValidator eventSourceValidator; @@ -34,11 +34,11 @@ public class AdminEventStreamsRestController implements OpenApiAdminEventStreams public AdminEventStreamsRestController(EventStreamService eventStreamService, @Qualifier("eventStreamShaclValidator") ModelValidator eventStreamValidator, @Qualifier("eventSourceShaclValidator") ModelValidator eventSourceValidator, - EventStreamConverter eventStreamConverter, RetentionModelExtractor retentionModelExtractor) { + EventStreamReader eventStreamReader, RetentionModelExtractor retentionModelExtractor) { this.eventStreamService = eventStreamService; this.eventStreamValidator = eventStreamValidator; this.eventSourceValidator = eventSourceValidator; - this.eventStreamConverter = eventStreamConverter; + this.eventStreamReader = eventStreamReader; this.retentionModelExtractor = retentionModelExtractor; } @@ -58,7 +58,7 @@ public List getEventStreams() { @PostMapping(consumes = {contentTypeJSONLD, contentTypeNQuads, contentTypeTurtle}) public EventStreamTO createEventStream(@RequestBody Model eventStreamModel) { eventStreamValidator.validate(eventStreamModel); - EventStreamTO eventStreamTO = eventStreamConverter.fromModel(eventStreamModel); + EventStreamTO eventStreamTO = eventStreamReader.read(eventStreamModel); log.atInfo().log("START creating collection {}", eventStreamTO.getCollection()); eventStreamService.createEventStream(eventStreamTO); log.atInfo().log("FINISHED creating collection {}", eventStreamTO.getCollection()); diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminServerDcatController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminServerDcatController.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminServerDcatController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminServerDcatController.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminShapeRestController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminShapeRestController.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminShapeRestController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminShapeRestController.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestController.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestController.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestController.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestController.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatHealthIndicator.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatHealthIndicator.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatHealthIndicator.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatHealthIndicator.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestController.java similarity index 91% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestController.java index c6315ec1c4..886c4b9426 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestController.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestController.java @@ -10,9 +10,7 @@ import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; -import static org.apache.jena.riot.WebContent.contentTypeJSONLD; -import static org.apache.jena.riot.WebContent.contentTypeNQuads; -import static org.apache.jena.riot.WebContent.contentTypeTurtle; +import static org.apache.jena.riot.WebContent.*; @Observed @RestController diff --git a/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiAdminEventStreamsController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiAdminEventStreamsController.java new file mode 100644 index 0000000000..e2e9a9af13 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiAdminEventStreamsController.java @@ -0,0 +1,492 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.controllers; + +import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.jena.rdf.model.Model; + +import java.util.List; + +import static org.apache.jena.riot.WebContent.*; + +@Tag(name = "Event Streams") +@SuppressWarnings("java:S2479") // whitespace needed for examples +public interface OpenApiAdminEventStreamsController { + @Operation(summary = "Retrieve list of configured Event Streams") + @ApiResponse(responseCode = "200", content = { + @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ + @prefix ldes: . + @prefix dcterms: . + @prefix tree: . + @prefix sh: . + @prefix server: . + @prefix xsd: . + @prefix event-stream-1: . + @prefix event-stream-2: . + + server:event-stream-1 a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions false ; + tree:shape event-stream-1:shape . + + server:event-stream-2 a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions true ; + tree:shape event-stream-2:shape . + ldes:view event-stream-2:by-page . + + event-stream-2:by-page tree:viewDescription [ + tree:pageSize "100"^^ ; + tree:fragmentationStrategy () ; + ] . + + event-stream-1:shape a sh:NodeShape . + + event-stream-2:shape a sh:NodeShape . + """)), + @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ + . + . + . + "false"^^ . + . + . + . + . + "true"^^ . + . + ""^^ . + _:genid1 "100"^^ . + _:genid1 . + _:genid1 . + . + . + """)), + @Content(mediaType = contentTypeJSONLD, examples = @ExampleObject(value = """ + [{"@id":"_:b0","https://w3id.org/tree#pageSize":[{"@value":"100","@type":"http://www.w3.org/2001/XMLSchema#int"}],"https://w3id.org/tree#fragmentationStrategy":[{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"}]},{"@id":"http://localhost:8080/event-stream-1","@type":["https://w3id.org/ldes#EventStream"],"https://w3id.org/ldes#timestampPath":[{"@id":"http://purl.org/dc/terms/created"}],"https://w3id.org/ldes#versionOfPath":[{"@id":"http://purl.org/dc/terms/isVersionOf"}],"https://w3id.org/ldes#createVersions":[{"@value":false}],"https://w3id.org/tree#shape":[{"@id":"http://localhost:8080/event-stream-1/shape"}]},{"@id":"http://localhost:8080/event-stream-1/shape","@type":["http://www.w3.org/ns/shacl#NodeShape"]},{"@id":"http://localhost:8080/event-stream-2","@type":["https://w3id.org/ldes#EventStream"],"https://w3id.org/ldes#timestampPath":[{"@id":"http://purl.org/dc/terms/created"}],"https://w3id.org/ldes#versionOfPath":[{"@id":"http://purl.org/dc/terms/isVersionOf"}],"https://w3id.org/ldes#createVersions":[{"@value":true}],"https://w3id.org/tree#shape":[{"@id":"http://localhost:8080/event-stream-2/shape"}]},{"@id":"http://localhost:8080/event-stream-2/by-page","https://w3id.org/tree#viewDescription":[{"@id":"_:b0"}]},{"@id":"http://localhost:8080/event-stream-2/shape","@type":["http://www.w3.org/ns/shacl#NodeShape"]},{"@id":"http://purl.org/dc/terms/created"},{"@id":"http://purl.org/dc/terms/isVersionOf"},{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"},{"@id":"http://www.w3.org/ns/shacl#NodeShape"},{"@id":"https://w3id.org/ldes#EventStream"},{"@id":"https://w3id.org/ldes#view","http://localhost:8080/event-stream-2/by-page":[{"@value":"","@type":"http://www.w3.org/2001/XMLSchema#integer"}]}] + """)) + }) + List getEventStreams(); + + @Operation(summary = "Create an Event Stream based on the provided config") + @ApiResponse(responseCode = "201", content = { + @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = { + @ExampleObject(name = "Version Objects ingestion", description = "An event stream that ingests version objects", value = """ + @prefix ldes: . + @prefix dcterms: . + @prefix prov: . + @prefix tree: . + @prefix sh: . + @prefix server: . + @prefix xsd: . + @prefix event-stream: . + + server:event-stream a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + tree:shape event-stream:shape . + + event-stream:shape a sh:NodeShape . + """), + @ExampleObject(name = "State Objects ingestion", description = "An event stream that ingests state objects", value = """ + @prefix ldes: . + @prefix dcterms: . + @prefix prov: . + @prefix tree: . + @prefix sh: . + @prefix server: . + @prefix xsd: . + @prefix event-stream: . + + server:event-stream a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions true ; + tree:shape event-stream:shape . + + event-stream:shape a sh:NodeShape . + """), + @ExampleObject(name = "State Objects ingestion with custom delimiter", description = "An event stream that ingests state objects with a custom version delimiter", value = """ + @prefix ldes: . + @prefix dcterms: . + @prefix prov: . + @prefix tree: . + @prefix sh: . + @prefix server: . + @prefix xsd: . + @prefix event-stream: . + + server:event-stream a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions true ; + ldes:versionDelimiter "&version=" ; + tree:shape event-stream:shape . + + event-stream:shape a sh:NodeShape . + """) + }), + @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = { + @ExampleObject(name = "Version Objects ingestion", description = "An event stream that ingests version objects", value = """ + . + . + . + . + . + """), + @ExampleObject(name = "State Objects ingestion", description = "An event stream that ingests state objects", value = """ + . + . + . + "true"^^ . + . + . + """), + @ExampleObject(name = "State Objects ingestion with custom delimiter", description = "An event stream that ingests state objects with a custom version delimiter", value = """ + . + . + . + "true"^^ . + "&version="^^ . + . + . + """) + }), + @Content(mediaType = contentTypeJSONLD, examples = { + @ExampleObject(name = "Version Objects ingestion", description = "An event stream that ingests version objects", value = """ + { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } + """), + @ExampleObject(name = "State Objects ingestion", description = "An event stream that ingests state objects", value = """ + { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "ldes:createVersions": true, + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } + """), + @ExampleObject(name = "State Objects ingestion with custom delimiter", description = "An event stream that ingests state objects with a custom version delimiter", value = """ + { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "ldes:createVersions": true, + "ldes:versionDelimiter": "&version=", + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } + """) + }) + }) + @ApiResponse(responseCode = "400", description = "The provided config is not valid", content = @Content) + EventStreamTO createEventStream(@RequestBody(content = { + @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = { + @ExampleObject(name = "Version Objects ingestion", description = "An event stream that ingests version objects", value = """ + @prefix ldes: . + @prefix dcterms: . + @prefix prov: . + @prefix tree: . + @prefix sh: . + @prefix server: . + @prefix xsd: . + @prefix event-stream: . + + server:event-stream a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + tree:shape event-stream:shape . + + event-stream:shape a sh:NodeShape . + """), + @ExampleObject(name = "State Objects ingestion", description = "An event stream that ingests state objects", value = """ + @prefix ldes: . + @prefix dcterms: . + @prefix prov: . + @prefix tree: . + @prefix sh: . + @prefix server: . + @prefix xsd: . + @prefix event-stream: . + + server:event-stream a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions true ; + tree:shape event-stream:shape . + + event-stream:shape a sh:NodeShape . + """), + @ExampleObject(name = "State Objects ingestion with custom delimiter", description = "An event stream that ingests state objects with a custom version delimiter", value = """ + @prefix ldes: . + @prefix dcterms: . + @prefix prov: . + @prefix tree: . + @prefix sh: . + @prefix server: . + @prefix xsd: . + @prefix event-stream: . + + server:event-stream a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions true ; + ldes:versionDelimiter "&version=" ; + tree:shape event-stream:shape . + + event-stream:shape a sh:NodeShape . + """) + }), + @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = { + @ExampleObject(name = "Version Objects ingestion", description = "An event stream that ingests version objects", value = """ + . + . + . + . + . + """), + @ExampleObject(name = "State Objects ingestion", description = "An event stream that ingests state objects", value = """ + . + . + . + "true"^^ . + . + . + """), + @ExampleObject(name = "State Objects ingestion with custom delimiter", description = "An event stream that ingests state objects with a custom version delimiter", value = """ + . + . + . + "true"^^ . + "&version="^^ . + . + . + """) + }), + @Content(mediaType = contentTypeJSONLD, schema = @Schema(implementation = String.class), examples = { + @ExampleObject(name = "Version Objects ingestion", description = "An event stream that ingests version objects", value = """ + { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } + """), + @ExampleObject(name = "State Objects ingestion", description = "An event stream that ingests state objects", value = """ + { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "ldes:createVersions": true, + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } + """), + @ExampleObject(name = "State Objects ingestion with custom delimiter", description = "An event stream that ingests state objects with a custom version delimiter", value = """ + { + "@context": { + "dcterms": "http://purl.org/dc/terms/", + "event-stream": "http://localhost:8080/event-stream/", + "ldes": "https://w3id.org/ldes#", + "tree": "https://w3id.org/tree#" + }, + "@id": "http://localhost:8080/event-stream", + "@type": "ldes:EventStream", + "ldes:timestampPath": { + "@id": "dcterms:created" + }, + "ldes:versionOfPath": { + "@id": "dcterms:isVersionOf" + }, + "ldes:createVersions": true, + "ldes:versionDelimiter": "&version=", + "tree:shape": { + "@id": "event-stream:shape", + "@type": "http://www.w3.org/ns/shacl#NodeShape" + } + } + """) + }) + }) Model eventStreamModel); + + @Operation(summary = "Retrieve specific Event Stream configuration") + @ApiResponse(responseCode = "200", content = { + @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ + @prefix ldes: . + @prefix dcterms: . + @prefix tree: . + @prefix sh: . + @prefix server: . + @prefix xsd: . + @prefix event-stream: . + + server:event-stream a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions false ; + tree:shape event-stream:shape . + ldes:view event-stream:pagination . + + event-stream:pagination tree:viewDescription [ + tree:pageSize "100"^^ ; + tree:fragmentationStrategy () ; + ] . + + event-stream:shape a sh:NodeShape . + """)), + @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ + . + . + . + "false"^^ . + . + ""^^ . + _:genid1 "100"^^ . + _:genid1 . + _:genid1 . + . + """)), + @Content(mediaType = contentTypeJSONLD, examples = @ExampleObject(value = """ + [{"@id":"_:b0","https://w3id.org/tree#pageSize":[{"@value":"100","@type":"http://www.w3.org/2001/XMLSchema#int"}],"https://w3id.org/tree#fragmentationStrategy":[{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"}]},{"@id":"http://localhost:8080/event-stream","@type":["https://w3id.org/ldes#EventStream"],"https://w3id.org/ldes#timestampPath":[{"@id":"http://purl.org/dc/terms/created"}],"https://w3id.org/ldes#versionOfPath":[{"@id":"http://purl.org/dc/terms/isVersionOf"}],"https://w3id.org/ldes#createVersions":[{"@value":false}],"https://w3id.org/tree#shape":[{"@id":"http://localhost:8080/event-stream/shape"}]},{"@id":"http://localhost:8080/event-stream/pagination","https://w3id.org/tree#viewDescription":[{"@id":"_:b0"}]},{"@id":"http://localhost:8080/event-stream/shape","@type":["http://www.w3.org/ns/shacl#NodeShape"]},{"@id":"http://purl.org/dc/terms/created"},{"@id":"http://purl.org/dc/terms/isVersionOf"},{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"},{"@id":"http://www.w3.org/ns/shacl#NodeShape"},{"@id":"https://w3id.org/ldes#EventStream"},{"@id":"https://w3id.org/ldes#view","http://localhost:8080/event-stream/pagination":[{"@value":"","@type":"http://www.w3.org/2001/XMLSchema#integer"}]}] + """)) + }) + @ApiResponse(responseCode = "404", description = "Event Stream with provided collection name could not be found", content = @Content) + EventStreamTO getEventStream(@Parameter(example = "event-stream") String collectionName); + + @Operation(summary = "Delete an Event Stream") + @ApiResponse(responseCode = "200", description = "Event Stream has been successfully deleted") + @ApiResponse(responseCode = "404", description = "Event Stream with provided collection name could not be found") + void deleteEventStream(@Parameter(example = "event-stream") String collectionName); + + @Operation(summary = "Close an Event Stream") + @ApiResponse(responseCode = "200", description = "Event Stream is successfully closed and all related fragments are made immutable") + @ApiResponse(responseCode = "404", description = "Event Stream with provided collection name could not be found") + void closeEventStream(@Parameter(example = "event-stream") String collectionName); + + @Operation(summary = "Update the Event Source of an Event Stream") + @ApiResponse(responseCode = "200", description = "Event Source has been successfully updated", content = { + @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ + @prefix ldes: . + @prefix dcterms: . + @prefix tree: . + + <> a ldes:EventSource ; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT5S"^^ ; + ] . + """)), + @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ + . + _:genid1 . + _:genid1 . + _:genid1 "PT5S"^^ . + """)), + @Content(mediaType = contentTypeJSONLD, examples = @ExampleObject(value = """ + [{"@id":"_:b0","@type":["https://w3id.org/ldes#DurationAgoPolicy"],"https://w3id.org/tree#value":[{"@value":"PT5S","@type":"http://www.w3.org/2001/XMLSchema#duration"}]},{"@id":"http://njh.me/","@type":["https://w3id.org/ldes#EventSource"],"https://w3id.org/ldes#retentionPolicy":[{"@id":"_:b0"}]},{"@id":"https://w3id.org/ldes#DurationAgoPolicy"},{"@id":"https://w3id.org/ldes#EventSource"}] + """))}) + @ApiResponse(responseCode = "404", description = "Event Stream with provided collection name could not be found") + void updateEventSource(@Parameter(example = "event-stream") String collectionName, + @RequestBody(content = { + @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ + @prefix ldes: . + @prefix dcterms: . + @prefix tree: . + + <> a ldes:EventSource ; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT5S"^^ ; + ] . + """)), + @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ + . + _:genid1 . + _:genid1 . + _:genid1 "PT5S"^^ . + """)), + @Content(mediaType = contentTypeJSONLD, examples = @ExampleObject(value = """ + [{"@id":"_:b0","@type":["https://w3id.org/ldes#DurationAgoPolicy"],"https://w3id.org/tree#value":[{"@value":"PT5S","@type":"http://www.w3.org/2001/XMLSchema#duration"}]},{"@id":"http://njh.me/","@type":["https://w3id.org/ldes#EventSource"],"https://w3id.org/ldes#retentionPolicy":[{"@id":"_:b0"}]},{"@id":"https://w3id.org/ldes#DurationAgoPolicy"},{"@id":"https://w3id.org/ldes#EventSource"}] + """)) + }) Model eventSourceModel); +} diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiAdminViewsRestController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiAdminViewsRestController.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiAdminViewsRestController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiAdminViewsRestController.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiDcatDatasetController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiDcatDatasetController.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiDcatDatasetController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiDcatDatasetController.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiDcatViewsController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiDcatViewsController.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiDcatViewsController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiDcatViewsController.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiServerDcatController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiServerDcatController.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiServerDcatController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiServerDcatController.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiShapeController.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiShapeController.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiShapeController.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiShapeController.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamHttpConverter.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamHttpConverter.java similarity index 88% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamHttpConverter.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamHttpConverter.java index 324d35260f..e88e58167c 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamHttpConverter.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamHttpConverter.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.converters; import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamConverter; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamWriter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.RdfModelConverter; import io.micrometer.observation.annotation.Observed; import org.apache.jena.rdf.model.Model; @@ -26,11 +26,11 @@ @Component public class EventStreamHttpConverter implements HttpMessageConverter { private static final MediaType DEFAULT_MEDIA_TYPE = MediaType.valueOf("text/turtle"); - private final EventStreamConverter eventStreamConverter; + private final EventStreamWriter eventStreamWriter; private final RdfModelConverter rdfModelConverter; - public EventStreamHttpConverter(EventStreamConverter eventStreamConverter, RdfModelConverter rdfModelConverter) { - this.eventStreamConverter = eventStreamConverter; + public EventStreamHttpConverter(EventStreamWriter eventStreamWriter, RdfModelConverter rdfModelConverter) { + this.eventStreamWriter = eventStreamWriter; this.rdfModelConverter = rdfModelConverter; } @@ -58,7 +58,7 @@ public EventStreamTO read(@NotNull Class clazz, @NotNul @Override public void write(@NotNull EventStreamTO eventStreamTO, MediaType contentType, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { - Model eventStreamModel = eventStreamConverter.toModel(eventStreamTO); + Model eventStreamModel = eventStreamWriter.write(eventStreamTO); Lang lang = rdfModelConverter.getLangOrDefault(contentType, REST_ADMIN); rdfModelConverter.checkLangForRelativeUrl(lang); outputMessage.getHeaders().setContentType(MediaType.parseMediaType(lang.getHeaderString())); diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamListHttpConverter.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamListHttpConverter.java similarity index 92% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamListHttpConverter.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamListHttpConverter.java index 2e3a896fc6..71aa717714 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamListHttpConverter.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/EventStreamListHttpConverter.java @@ -1,8 +1,9 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.converters; import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamConverter; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamWriter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.RdfModelConverter; +import com.google.common.reflect.TypeToken; import io.micrometer.observation.annotation.Observed; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; @@ -21,19 +22,17 @@ import java.lang.reflect.Type; import java.util.List; -import com.google.common.reflect.TypeToken; - import static be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.RdfFormatException.RdfFormatContext.REST_ADMIN; @Observed @Component public class EventStreamListHttpConverter implements GenericHttpMessageConverter> { private static final MediaType DEFAULT_MEDIA_TYPE = MediaType.valueOf("text/turtle"); - private final EventStreamConverter eventStreamConverter; + private final EventStreamWriter eventStreamWriter; private final RdfModelConverter rdfModelConverter; - public EventStreamListHttpConverter(EventStreamConverter eventStreamConverter, RdfModelConverter rdfModelConverter) { - this.eventStreamConverter = eventStreamConverter; + public EventStreamListHttpConverter(EventStreamWriter eventStreamWriter, RdfModelConverter rdfModelConverter) { + this.eventStreamWriter = eventStreamWriter; this.rdfModelConverter = rdfModelConverter; } @@ -81,7 +80,7 @@ public void write(List eventStreamRespons, MediaType contentType, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { Model model = ModelFactory.createDefaultModel(); eventStreamRespons.stream() - .map(eventStreamConverter::toModel) + .map(eventStreamWriter::write) .forEach(model::add); Lang lang = rdfModelConverter.getLangOrDefault(contentType, REST_ADMIN); rdfModelConverter.checkLangForRelativeUrl(lang); diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/ListViewHttpConverter.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/ListViewHttpConverter.java similarity index 99% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/ListViewHttpConverter.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/ListViewHttpConverter.java index 640c00dd34..9896cd996d 100644 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/ListViewHttpConverter.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/ListViewHttpConverter.java @@ -3,6 +3,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.ViewSpecificationConverter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.RdfModelConverter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; +import com.google.common.reflect.TypeToken; import io.micrometer.observation.annotation.Observed; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; @@ -21,8 +22,6 @@ import java.lang.reflect.Type; import java.util.List; -import com.google.common.reflect.TypeToken; - import static be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.RdfFormatException.RdfFormatContext.FETCH; @Observed diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/ViewHttpConverter.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/ViewHttpConverter.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/ViewHttpConverter.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/converters/ViewHttpConverter.java diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/exceptionhandling/AdminRestResponseEntityExceptionHandler.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/exceptionhandling/AdminRestResponseEntityExceptionHandler.java similarity index 100% rename from ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/exceptionhandling/AdminRestResponseEntityExceptionHandler.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/exceptionhandling/AdminRestResponseEntityExceptionHandler.java diff --git a/ldes-server-admin/src/main/java/module-info.java b/ldes-server-admin/ldes-server-admin-rest/src/main/java/module-info.java similarity index 88% rename from ldes-server-admin/src/main/java/module-info.java rename to ldes-server-admin/ldes-server-admin-rest/src/main/java/module-info.java index f4950d1467..3665c59edb 100644 --- a/ldes-server-admin/src/main/java/module-info.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/main/java/module-info.java @@ -1,6 +1,4 @@ -open module ldes.admin { - - exports be.vlaanderen.informatievlaanderen.ldes.server.admin.spi; +open module ldes.admin.rest { // LDES dependencies requires ldes.domain; @@ -25,5 +23,6 @@ requires org.jetbrains.annotations; requires micrometer.observation; requires micrometer.core; + requires ldes.admin; } \ No newline at end of file diff --git a/ldes-server-admin/src/main/resources/configShaclShape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/main/resources/configShaclShape.ttl similarity index 100% rename from ldes-server-admin/src/main/resources/configShaclShape.ttl rename to ldes-server-admin/ldes-server-admin-rest/src/main/resources/configShaclShape.ttl diff --git a/ldes-server-admin/src/main/resources/eventsourceShaclShape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/main/resources/eventsourceShaclShape.ttl similarity index 100% rename from ldes-server-admin/src/main/resources/eventsourceShaclShape.ttl rename to ldes-server-admin/ldes-server-admin-rest/src/main/resources/eventsourceShaclShape.ttl diff --git a/ldes-server-admin/src/main/resources/eventstreamShaclShape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/main/resources/eventstreamShaclShape.ttl similarity index 95% rename from ldes-server-admin/src/main/resources/eventstreamShaclShape.ttl rename to ldes-server-admin/ldes-server-admin-rest/src/main/resources/eventstreamShaclShape.ttl index 3a68b7a757..59efd510c0 100644 --- a/ldes-server-admin/src/main/resources/eventstreamShaclShape.ttl +++ b/ldes-server-admin/ldes-server-admin-rest/src/main/resources/eventstreamShaclShape.ttl @@ -49,6 +49,25 @@ sh:maxCount 1; sh:name "skolemizationDomain"@en; sh:path + ] , [ + sh:datatype xsd:string ; + sh:description "The object property that indicates the delimiter for version objects."@en; + sh:minLength 1 ; + sh:maxCount 1; + sh:name "versionDelimiter"@en; + sh:path + ] ; + sh:sparql [ + sh:message "ldes:versionDelimiter can only be present if ldes:createVersions is set true."@en ; + sh:select """ + PREFIX ldes: + SELECT $this + WHERE { + $this ldes:versionDelimiter ?versionDelimiter . + + FILTER NOT EXISTS { $this ldes:createVersions true } + } + """ ; ] . diff --git a/ldes-server-admin/src/test/resources/shacl/validation/shapeShaclShape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/main/resources/shapeShaclShape.ttl similarity index 100% rename from ldes-server-admin/src/test/resources/shacl/validation/shapeShaclShape.ttl rename to ldes-server-admin/ldes-server-admin-rest/src/main/resources/shapeShaclShape.ttl diff --git a/ldes-server-admin/src/main/resources/viewShaclShape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/main/resources/viewShaclShape.ttl similarity index 100% rename from ldes-server-admin/src/main/resources/viewShaclShape.ttl rename to ldes-server-admin/ldes-server-admin-rest/src/main/resources/viewShaclShape.ttl diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/IsIsomorphic.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/IsIsomorphic.java similarity index 57% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/IsIsomorphic.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/IsIsomorphic.java index 49b6d7d9e6..a5ccdf8b40 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/IsIsomorphic.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/IsIsomorphic.java @@ -1,13 +1,19 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.rest; +import org.apache.jena.atlas.web.ContentType; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.Lang; +import org.apache.jena.riot.RDFLanguages; import org.apache.jena.riot.RDFParser; import org.mockito.ArgumentMatcher; +import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.test.util.AssertionErrors; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.ResultMatcher; +import java.io.ByteArrayInputStream; +import java.util.Optional; + public class IsIsomorphic implements ResultMatcher, ArgumentMatcher { private final Model model; @@ -20,8 +26,14 @@ public static IsIsomorphic with(Model model) { } @Override - public void match(MvcResult result) throws Exception { - Model actualModel = RDFParser.fromString(result.getResponse().getContentAsString()).lang(Lang.TURTLE).toModel(); + public void match(MvcResult result) { + final MockHttpServletResponse response = result.getResponse(); + final ByteArrayInputStream bytes = new ByteArrayInputStream(response.getContentAsByteArray()); + final Lang lang = Optional.ofNullable(response.getContentType()) + .map(ContentType::create) + .map(RDFLanguages::contentTypeToLang) + .orElse(Lang.TURTLE); + final Model actualModel = RDFParser.source(bytes).lang(lang).toModel(); AssertionErrors.assertTrue("Result should be isomorphic with provided model", actualModel.isIsomorphicWith(model)); } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/ResourceRemover.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/ResourceRemover.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/ResourceRemover.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/ResourceRemover.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/SpringIntegrationTest.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/SpringIntegrationTest.java similarity index 98% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/SpringIntegrationTest.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/SpringIntegrationTest.java index 37bdef7be0..f773dee878 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/SpringIntegrationTest.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/config/SpringIntegrationTest.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.config; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.repository.DcatDatasetRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repositories.DcatServerRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repository.DcatServerRepository; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventsource.repository.EventSourceRepository; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventsource.services.EventSourceServiceImpl; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.repository.EventStreamRepository; diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminDcatServerControllerTest.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminDcatServerControllerTest.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminDcatServerControllerTest.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminDcatServerControllerTest.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerIT.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerIT.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerIT.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerIT.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerSteps.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerSteps.java similarity index 95% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerSteps.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerSteps.java index 4e28f31fbb..bfddaf9620 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerSteps.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerSteps.java @@ -4,10 +4,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.config.SpringIntegrationTest; import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.FragmentationConfig; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.*; import io.cucumber.java.After; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; @@ -42,7 +39,7 @@ public class AdminEventStreamsRestControllerSteps extends SpringIntegrationTest private static final String COLLECTION = "name1"; private static final String TIMESTAMP_PATH = "http://purl.org/dc/terms/created"; private static final String VERSION_OF_PATH = "http://purl.org/dc/terms/isVersionOf"; - private static final boolean VERSION_CREATION_ENABLED = false; + private static final VersionCreationProperties VERSION_DELIMITER = VersionCreationProperties.disabled(); private ResultActions resultActions; @After @@ -53,8 +50,8 @@ public void cleanup() { @Given("a db containing multiple eventstreams") public void aDbContainingMultipleEventstreams() throws URISyntaxException { final String collection2 = "name2"; - final EventStream eventStream = new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_ENABLED); - final EventStream eventStream2 = new EventStream(collection2, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_ENABLED); + final EventStream eventStream = new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_DELIMITER); + final EventStream eventStream2 = new EventStream(collection2, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_DELIMITER); eventPublisher.publishEvent(new EventStreamCreatedEvent(eventStream)); eventPublisher.publishEvent(new EventStreamCreatedEvent(eventStream2)); Model shape1 = readModelFromFile("shacl/shape-name1.ttl"); @@ -100,7 +97,7 @@ public void theClientReceivesAValidListOfEventStreams() throws Exception { @Given("a db containing one event stream") public void aDbContainingOneEventStream() throws URISyntaxException { - final EventStream eventStream = new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_CREATION_ENABLED); + final EventStream eventStream = new EventStream(COLLECTION, TIMESTAMP_PATH, VERSION_OF_PATH, VERSION_DELIMITER); Model shape = readModelFromFile("shacl/server-shape.ttl"); final EventStreamTO eventStreamTO = new EventStreamTO.Builder().withEventStream(eventStream).withShacl(shape).build(); when(eventStreamRepository.retrieveEventStreamTO(COLLECTION)).thenReturn(Optional.of(eventStreamTO)); diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerTest.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerTest.java similarity index 76% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerTest.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerTest.java index 54c646daaa..4902576283 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerTest.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminEventStreamsRestControllerTest.java @@ -10,6 +10,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.HttpModelConverter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdderImpl; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.RdfModelConverter; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.encodig.CharsetEncodingConfig; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.FragmentationConfig; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; @@ -20,6 +21,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; @@ -30,6 +33,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -40,6 +44,7 @@ import static org.apache.jena.riot.WebContent.contentTypeNQuads; import static org.apache.jena.riot.WebContent.contentTypeTurtle; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; @@ -49,9 +54,10 @@ @WebMvcTest @ActiveProfiles({"test", "rest"}) @ContextConfiguration(classes = {AdminEventStreamsRestController.class, HttpModelConverter.class, - EventStreamListHttpConverter.class, EventStreamHttpConverter.class, EventStreamConverterImpl.class, + EventStreamListHttpConverter.class, EventStreamHttpConverter.class, + EventStreamWriter.class, EventStreamReader.class, ViewSpecificationConverter.class, PrefixAdderImpl.class, ValidatorsConfig.class, - AdminRestResponseEntityExceptionHandler.class, RetentionModelExtractor.class, + AdminRestResponseEntityExceptionHandler.class, RetentionModelExtractor.class, CharsetEncodingConfig.class, FragmentationConfigExtractor.class, PrefixConstructor.class, RdfModelConverter.class}) class AdminEventStreamsRestControllerTest { private static final String COLLECTION = "name1"; @@ -113,7 +119,8 @@ void when_StreamsPresent_then_StreamsAreReturned() throws Exception { mockMvc.perform(get("/admin/api/v1/eventstreams").accept(contentTypeNQuads)) .andExpect(status().isOk()) - .andExpect(content().contentType(contentTypeNQuads)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeNQuads)) .andExpect(IsIsomorphic.with(expectedEventStreamsModel)); verify(eventStreamService).retrieveAllEventStreams(); @@ -137,7 +144,8 @@ void when_StreamPresent_Then_StreamIsReturned() throws Exception { mockMvc.perform(get("/admin/api/v1/eventstreams/" + COLLECTION).accept(contentTypeNQuads)) .andExpect(status().isOk()) - .andExpect(content().contentType(contentTypeNQuads)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeNQuads)) .andExpect(IsIsomorphic.with(model)); verify(eventStreamService).retrieveEventStream(COLLECTION); @@ -149,7 +157,8 @@ void when_StreamNotPresent_Then_Returned404() throws Exception { mockMvc.perform(get("/admin/api/v1/eventstreams/" + COLLECTION).accept(contentTypeTurtle)) .andExpect(status().isNotFound()) - .andExpect(content().contentType(MediaType.TEXT_PLAIN)); + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN)); verify(eventStreamService).retrieveEventStream(COLLECTION); } @@ -176,7 +185,8 @@ void when_eventStreamModelIsPut_then_eventStreamIsSaved_and_status200IsExpected( .content(readDataFromFile("eventstream/streams/ldes.ttl")) .contentType(contentTypeTurtle)) .andExpect(status().isCreated()) - .andExpect(content().contentType(contentTypeNQuads)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeNQuads)) .andExpect(IsIsomorphic.with(expectedModel)); verify(eventStreamService).createEventStream(any(EventStreamTO.class)); @@ -191,7 +201,7 @@ void when_eventStreamThatCreateVersionsModelIsPut_then_eventStreamIsSaved_and_st .withCollection("name1") .withTimestampPath(TIMESTAMP_PATH) .withVersionOfPath(VERSION_OF_PATH) - .withVersionCreationEnabled(true) + .withVersionDelimiter("/") .withShacl(shape) .build(); @@ -202,10 +212,11 @@ void when_eventStreamThatCreateVersionsModelIsPut_then_eventStreamIsSaved_and_st .content(readDataFromFile("eventstream/streams/ldes-create-versions.ttl")) .contentType(contentTypeTurtle)) .andExpect(status().isCreated()) - .andExpect(content().contentType(contentTypeNQuads)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeNQuads)) .andExpect(IsIsomorphic.with(expectedModel)); - verify(eventStreamService).createEventStream(any(EventStreamTO.class)); + verify(eventStreamService).createEventStream(assertArg(actual -> assertThat(actual.getVersionDelimiter()).isEqualTo("/"))); } @Test @@ -214,7 +225,8 @@ void when_ModelWithoutType_Then_ReturnedBadRequest() throws Exception { .content(readDataFromFile("eventstream/streams/ldes-without-type.ttl")) .contentType(contentTypeTurtle)) .andExpect(status().isBadRequest()) - .andExpect(content().contentType(contentTypeTurtle)); + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeTurtle)); verifyNoInteractions(eventStreamService); } @@ -225,8 +237,43 @@ void when_MalformedModelInRequestBody_Then_ReturnedBadRequest() throws Exception .content(readDataFromFile("eventstream/streams/malformed-ldes.ttl")) .contentType(contentTypeTurtle)) .andExpect(status().isBadRequest()) - .andExpect(content().contentType(MediaType.TEXT_PLAIN)); + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN)); + verifyNoInteractions(eventStreamService); + } + + @Test + void given_EventStreamWithVersionDelimiter_when_POST_then_ReturnCreated() throws Exception { + final String content = readDataFromFile("eventstream/streams/ldes-with-version-delimiter.ttl").replace("#VERSION_DELIMITER#", "&version="); + mockMvc.perform(post("/admin/api/v1/eventstreams") + .content(content) + .contentType(contentTypeTurtle)) + .andExpect(status().isCreated()) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeTurtle)); + verify(eventStreamService).createEventStream(assertArg(actual -> assertThat(actual.getVersionDelimiter()).isEqualTo("&version="))); + } + + @Test + void given_EventStreamWithVersionDelimiter_when_POST_then_ReturnBadRequest() throws Exception { + final String content = readDataFromFile("eventstream/streams/ldes-with-version-delimiter.ttl").replace("#VERSION_DELIMITER#", ""); + + mockMvc.perform(post("/admin/api/v1/eventstreams").content(content).contentType(contentTypeTurtle)) + .andExpect(status().isBadRequest()); + verifyNoInteractions(eventStreamService); + } + + @ParameterizedTest + @CsvSource({ + "'true', 'false'", + "'ldes:createVersions true ;', ''" + }) + void given_EventStreamWithVersionDelimiterAndCreateVersionsFalse_when_POST_then_ReturnBadRequest(String target, String replacement) throws Exception { + final String content = readDataFromFile("eventstream/streams/ldes-with-version-delimiter.ttl").replace("#VERSION_DELIMITER#", "/").replace(target, replacement); + + mockMvc.perform(post("/admin/api/v1/eventstreams").content(content).contentType(contentTypeTurtle)) + .andExpect(status().isBadRequest()); verifyNoInteractions(eventStreamService); } } @@ -247,8 +294,8 @@ void when_deleteNotExistingCollection_then_expectStatus404() throws Exception { mockMvc.perform(delete("/admin/api/v1/eventstreams/name1")) .andExpect(status().isNotFound()) - .andExpect(content().contentType(MediaType.TEXT_PLAIN)); - + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN)); verify(eventStreamService).deleteEventStream(COLLECTION); } } @@ -269,7 +316,8 @@ void when_collectionDoesNotExist_then_expectStatus404() throws Exception { mockMvc.perform(post("/admin/api/v1/eventstreams/name1/close")) .andExpect(status().isNotFound()) - .andExpect(content().contentType(MediaType.TEXT_PLAIN)); + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN)); verify(eventStreamService).closeEventStream(COLLECTION); } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminShapeRestControllerTest.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminShapeRestControllerTest.java similarity index 89% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminShapeRestControllerTest.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminShapeRestControllerTest.java index d45e5630f6..2b5228c4cb 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminShapeRestControllerTest.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminShapeRestControllerTest.java @@ -9,6 +9,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.HttpModelConverter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdderImpl; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.RdfModelConverter; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.encodig.CharsetEncodingConfig; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.RDFDataMgr; @@ -29,6 +30,7 @@ import java.io.File; import java.io.IOException; import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Objects; @@ -46,7 +48,7 @@ @ActiveProfiles({"test", "rest"}) @ContextConfiguration(classes = {AdminShapeRestController.class, HttpModelConverter.class, PrefixAdderImpl.class, AdminRestResponseEntityExceptionHandler.class, ValidatorsConfig.class, - RdfModelConverter.class}) + RdfModelConverter.class, CharsetEncodingConfig.class}) class AdminShapeRestControllerTest { @MockBean private ShaclShapeService shaclShapeService; @@ -76,7 +78,8 @@ void when_ShapeIsPresentArePresent_Then_ShapeIsReturned() throws Exception { mockMvc.perform(get("/admin/api/v1/eventstreams/" + collectionName + "/shape") .accept(contentTypeTurtle)) .andExpect(status().isOk()) - .andExpect(content().contentType(contentTypeTurtle)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeTurtle)) .andExpect(IsIsomorphic.with(expectedShapeModel)); } @@ -88,7 +91,8 @@ void when_ViewNotPresent_Then_Returned404() throws Exception { mockMvc.perform(get("/admin/api/v1/eventstreams/" + collectionName + "/shape") .accept(contentTypeTurtle)) .andExpect(status().isNotFound()) - .andExpect(content().contentType(MediaType.TEXT_PLAIN)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN)) .andExpect(content().string("Resource of type: shacl-shape with id: %s could not be found.".formatted(collectionName))); } } @@ -106,7 +110,8 @@ void when_ModelInRequestBody_Then_MethodIsCalled() throws Exception { .content(readDataFromFile(fileName)) .contentType(contentTypeTurtle)) .andExpect(status().isOk()) - .andExpect(content().contentType(contentTypeTurtle)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeTurtle)) .andExpect(IsIsomorphic.with(expectedShapeModel)); InOrder inOrder = inOrder(shaclShapeValidator, shaclShapeService); @@ -124,8 +129,8 @@ void when_ModelWithoutType_Then_ReturnedBadRequest() throws Exception { .content(readDataFromFile("shacl/shape-without-type.ttl")) .contentType(contentTypeTurtle)) .andExpect(status().isBadRequest()) - .andExpect(content().contentType(contentTypeTurtle)); - + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeTurtle)); verify(shaclShapeValidator).validate(any()); } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerIT.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerIT.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerIT.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerIT.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerSteps.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerSteps.java similarity index 95% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerSteps.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerSteps.java index 9e6352e799..30534caacf 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerSteps.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerSteps.java @@ -3,10 +3,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.IsIsomorphic; import be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.config.SpringIntegrationTest; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamCreatedEvent; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.FragmentationConfig; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.*; import io.cucumber.java.After; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; @@ -58,7 +55,7 @@ public void iObtainAnHTTPStatusStatus(int status) throws Exception { @Given("an LDES server with an event stream") public void anLDESServerWithAnEventStream() { - eventPublisher.publishEvent(new EventStreamCreatedEvent(new EventStream(COLLECTION_NAME, "timestamp-path", "isVersionOf-path", false, "skol-dom"))); + eventPublisher.publishEvent(new EventStreamCreatedEvent(new EventStream(COLLECTION_NAME, "timestamp-path", "isVersionOf-path", VersionCreationProperties.disabled(), "skol-dom"))); } @When("I DELETE a view with {string}") diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerTest.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerTest.java similarity index 93% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerTest.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerTest.java index 1b632cb81f..e7e9dce7a4 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerTest.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/AdminViewsRestControllerTest.java @@ -14,6 +14,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.HttpModelConverter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdderImpl; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.RdfModelConverter; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.encodig.CharsetEncodingConfig; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; @@ -35,6 +36,7 @@ import java.io.File; import java.io.IOException; import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.List; @@ -50,7 +52,7 @@ @WebMvcTest @ActiveProfiles({"test", "rest"}) -@ContextConfiguration(classes = {AdminViewsRestController.class, PrefixAdderImpl.class, +@ContextConfiguration(classes = {AdminViewsRestController.class, CharsetEncodingConfig.class, PrefixAdderImpl.class, HttpModelConverter.class, ViewHttpConverter.class, ListViewHttpConverter.class, ViewSpecificationConverter.class, ValidatorsConfig.class, AdminRestResponseEntityExceptionHandler.class, RetentionModelExtractor.class, @@ -78,7 +80,8 @@ void when_StreamAndViewsArePresent_Then_ViewsAreReturned() throws Exception { mockMvc.perform(get("/admin/api/v1/eventstreams/{collectionName}/views", COLLECTION_NAME) .accept(contentTypeNQuads)) .andExpect(status().isOk()) - .andExpect(content().contentType(contentTypeNQuads)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeNQuads)) .andExpect(IsIsomorphic.with(expectedViewModel1.add(expectedViewModel2))); } @@ -91,7 +94,8 @@ void when_StreamAndViewArePresent_Then_ViewIsReturned() throws Exception { mockMvc.perform(get("/admin/api/v1/eventstreams/{collectionName}/views/{viewName}", COLLECTION_NAME, VIEW_NAME) .accept(contentTypeTurtle)) .andExpect(status().isOk()) - .andExpect(content().contentType(contentTypeTurtle)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(contentTypeTurtle)) .andExpect(IsIsomorphic.with(expectedViewModel)); } @@ -103,7 +107,8 @@ void when_ViewNotPresent_Then_Returned404() throws Exception { mockMvc.perform(get("/admin/api/v1/eventstreams/{collectionName}/views/{viewName}", COLLECTION_NAME, VIEW_NAME) .accept(contentTypeTurtle)) .andExpect(status().isNotFound()) - .andExpect(content().contentType(MediaType.TEXT_PLAIN)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN)) .andExpect(content().string("Resource of type: view with id: %s/%s could not be found.".formatted(COLLECTION_NAME, VIEW_NAME))); } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerIT.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerIT.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerIT.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerIT.java diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerSteps.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerSteps.java new file mode 100644 index 0000000000..711e04cd8d --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerSteps.java @@ -0,0 +1,112 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.controllers; + +import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities.DcatDataset; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.config.SpringIntegrationTest; +import io.cucumber.java.After; +import io.cucumber.java.en.And; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import org.apache.commons.io.FileUtils; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.rdf.model.ModelFactory; +import org.apache.jena.riot.Lang; +import org.apache.jena.riot.RDFParser; +import org.springframework.test.web.servlet.ResultActions; +import org.springframework.util.ResourceUtils; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Optional; + +import static be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.controllers.DcatDatasetRestController.BASE_URL; +import static org.mockito.Mockito.*; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +public class DcatDatasetRestControllerSteps extends SpringIntegrationTest { + private static final String COLLECTION_NAME = "collectionName"; + private ResultActions resultActions; + private String datasetString; + + @After + public void cleanup() { + resourceRemover.removeUsedResources(); + } + + @Given("I have a valid dcat dataset") + public void iHaveAValidDcatDataset() throws Exception { + datasetString = readDataFromFile("dcat/dataset/valid.ttl"); + } + + @Given("I have a invalid dcat dataset") + public void iHaveAnInvalidDcatDataset() throws Exception { + datasetString = readDataFromFile("dcat/dataset/not-valid.ttl"); + } + + @When("I POST this dataset") + public void iCanPOSTThisDataset() throws Exception { + resultActions = mockMvc.perform(post(BASE_URL, COLLECTION_NAME) + .contentType(Lang.TURTLE.getHeaderString()) + .content(datasetString)); + } + + @When("I PUT this dataset") + public void iPUTThisDataset() throws Exception { + resultActions = mockMvc.perform(put(BASE_URL, COLLECTION_NAME) + .contentType(Lang.TURTLE.getHeaderString()) + .content(datasetString)); + } + + @When("I DELETE this dataset") + public void iDELETEThisDataservice() throws Exception { + resultActions = mockMvc.perform(delete(BASE_URL, COLLECTION_NAME)); + } + + private String readDataFromFile(String filename) throws IOException { + File file = ResourceUtils.getFile("classpath:" + filename); + return FileUtils.readFileToString(file, StandardCharsets.UTF_8); + } + + @And("The dataset will be stored") + public void theMetadataWillBeStored() { + Model model = RDFParser.create().fromString(datasetString).lang(Lang.TURTLE).build().toModel(); + DcatDataset dataset = new DcatDataset(COLLECTION_NAME, model); + verify(dcatDatasetRepository).saveDataset(dataset); + } + + @And("The dataset will not be stored") + public void theMetadataWillNotBeStored() { + Model model = RDFParser.create().fromString(datasetString).lang(Lang.TURTLE).build().toModel(); + DcatDataset dataset = new DcatDataset(COLLECTION_NAME, model); + verify(dcatDatasetRepository, never()).saveDataset(dataset); + } + + @Then("The dataset will be deleted") + public void theDataserviceMetadataWillBeDeleted() { + verify(dcatDatasetRepository, times(1)).deleteDataset(COLLECTION_NAME); + } + + @Then("The dataset will not be deleted") + public void theDataserviceMetadataWillNotBeDeleted() { + verify(dcatDatasetRepository, never()).deleteDataset(COLLECTION_NAME); + } + + @And("Response with http {int} will be returned for dataset") + public void responseWithHttpWillBeReturned(int httpCode) throws Exception { + resultActions.andExpect(status().is(httpCode)); + } + + @And("The dataset already exists") + public void theDataserviceAlreadyExists() { + when(dcatDatasetRepository.exitsByCollectionName(COLLECTION_NAME)).thenReturn(true); + when(dcatDatasetRepository.retrieveDataset(COLLECTION_NAME)).thenReturn(Optional.of(new DcatDataset(COLLECTION_NAME, ModelFactory.createDefaultModel()))); + } + + @And("The dataset does not yet exist") + public void theDataserviceDoesNotYetExist() { + when(dcatDatasetRepository.exitsByCollectionName(COLLECTION_NAME)).thenReturn(false); + } + +} diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerTest.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerTest.java similarity index 95% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerTest.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerTest.java index 0912a91e2f..225ce41f95 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerTest.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerTest.java @@ -32,9 +32,7 @@ import static org.apache.jena.riot.WebContent.contentTypeTurtle; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @WebMvcTest @@ -42,7 +40,7 @@ @ContextConfiguration(classes = { HttpModelConverter.class, PrefixAdderImpl.class, DcatDatasetRestController.class, AdminRestResponseEntityExceptionHandler.class, PrefixConstructor.class, RdfModelConverter.class, RdfModelConverter.class }) class DcatDatasetRestControllerTest { - private final static String COLLECTION_NAME = "collection"; + private static final String COLLECTION_NAME = "collection"; @Autowired private MockMvc mockMvc; @MockBean diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatHealthIndicatorTest.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatHealthIndicatorTest.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatHealthIndicatorTest.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatHealthIndicatorTest.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatServerRestControllerIT.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatServerRestControllerIT.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatServerRestControllerIT.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatServerRestControllerIT.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatServerRestControllerSteps.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatServerRestControllerSteps.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatServerRestControllerSteps.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatServerRestControllerSteps.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewRestControllerIT.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewRestControllerIT.java similarity index 100% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewRestControllerIT.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewRestControllerIT.java diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewRestControllerSteps.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewRestControllerSteps.java similarity index 85% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewRestControllerSteps.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewRestControllerSteps.java index 4a16d690c9..7fef222bd8 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewRestControllerSteps.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewRestControllerSteps.java @@ -22,19 +22,15 @@ import java.util.Optional; import static be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.controllers.DcatViewsRestController.BASE_URL; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.mockito.Mockito.*; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; public class DcatViewRestControllerSteps extends SpringIntegrationTest { - private final static String COLLECTION_NAME = "collectionName"; - private final static String VIEW = "viewName"; - private final static ViewName VIEW_NAME = new ViewName(COLLECTION_NAME, VIEW); + private static final String COLLECTION_NAME = "collectionName"; + private static final String VIEW = "viewName"; + private static final ViewName VIEW_NAME = new ViewName(COLLECTION_NAME, VIEW); private ResultActions resultActions; private String turtleDataservice; @@ -80,14 +76,14 @@ private String readDataFromFile(String filename) throws IOException { @And("The dataservice metadata will be stored") public void theMetadataWillBeStored() { - Model model = RDFParser.fromString(turtleDataservice).lang(Lang.TURTLE).build().toModel(); + Model model = RDFParser.create().fromString(turtleDataservice).lang(Lang.TURTLE).build().toModel(); DcatView dcatView = DcatView.from(VIEW_NAME, model); verify(dcatViewRepository, times(1)).save(dcatView); } @And("The dataservice metadata will not be stored") public void theMetadataWillNotBeStored() { - Model model = RDFParser.fromString(turtleDataservice).lang(Lang.TURTLE).build().toModel(); + Model model = RDFParser.create().fromString(turtleDataservice).lang(Lang.TURTLE).build().toModel(); DcatView dcatView = DcatView.from(VIEW_NAME, model); verify(dcatViewRepository, times(0)).save(dcatView); } diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestControllerTest.java b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestControllerTest.java similarity index 97% rename from ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestControllerTest.java rename to ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestControllerTest.java index 02ae18acae..2935ff937a 100644 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestControllerTest.java +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatViewsRestControllerTest.java @@ -37,8 +37,8 @@ RdfModelConverter.class}) class DcatViewsRestControllerTest { - private final static String COLLECTION_NAME = "collectionName"; - private final static String VIEW_NAME = "viewName"; + private static final String COLLECTION_NAME = "collectionName"; + private static final String VIEW_NAME = "viewName"; @MockBean private DcatViewService dcatViewService; diff --git a/ldes-server-admin/src/test/resources/application-health-test.yaml b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/application-health-test.yaml similarity index 100% rename from ldes-server-admin/src/test/resources/application-health-test.yaml rename to ldes-server-admin/ldes-server-admin-rest/src/test/resources/application-health-test.yaml diff --git a/ldes-server-admin/src/test/resources/application-test.yml b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/application-test.yml similarity index 100% rename from ldes-server-admin/src/test/resources/application-test.yml rename to ldes-server-admin/ldes-server-admin-rest/src/test/resources/application-test.yml diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/catalog/invalid-server-dcat.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/catalog/invalid-server-dcat.ttl new file mode 100644 index 0000000000..b26f576c8e --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/catalog/invalid-server-dcat.ttl @@ -0,0 +1,9 @@ +@base +@prefix dct: . +@prefix dcat: . + +[/not-empty] a dcat:Catalog ; + dcat:DataService + dcat:DataSet + dct:title "My LDES'es"@en ; + dct:description "All LDES'es from publiser X"@en . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/catalog/server.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/catalog/server.ttl new file mode 100644 index 0000000000..3da0bdd39b --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/catalog/server.ttl @@ -0,0 +1,24 @@ +@prefix dcat: . +@prefix dct: . +@prefix foaf: . +@prefix legal: . +@prefix locn: . +@prefix m8g: . +@prefix org: . + + + a foaf:Agent ; + m8g:contactPoint [ a m8g:ContactPoint ; + m8g:hasEmail "info@data-publishing-company.com" + ] ; + m8g:registeredAddress [ a locn:Address ; + locn:fullAddress "Some full address here" + ] ; + legal:legalName "Data Publishing Company BV" ; + foaf:name "Data Publishing Company" . + +[ a dcat:Catalog ; + dct:description "All LDES'es from publiser X"@en ; + dct:publisher ; + dct:title "My LDES'es"@en +] . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/catalog/valid-server-dcat.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/catalog/valid-server-dcat.ttl new file mode 100644 index 0000000000..3620eb98b1 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/catalog/valid-server-dcat.ttl @@ -0,0 +1,6 @@ +@prefix dct: . +@prefix dcat: . + +[] a dcat:Catalog ; + dct:title "My LDES'es"@en ; + dct:description "All LDES'es from publiser X"@en . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/dcat-view-invalid.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/dcat-view-invalid.ttl new file mode 100644 index 0000000000..211e5344cb --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/dcat-view-invalid.ttl @@ -0,0 +1,19 @@ +@prefix dct: . +@prefix dcat: . +@prefix foaf: . +@prefix org: . +@prefix legal: . +@prefix m8g: . +@prefix locn: . +@prefix skos: . + + a dcat:DataService ; + dct:title "My geo-spatial view"@en ; + dct:description "Geospatial fragmentation for my LDES"@en ; + dct:license [ + a dct:LicenseDocument ; + dct:type [ + a skos:Concept; + skos:prefLabel "some public license"@en + ] + ] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/dcat-view-valid.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/dcat-view-valid.ttl new file mode 100644 index 0000000000..9be4742e48 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/dcat-view-valid.ttl @@ -0,0 +1,19 @@ +@prefix dct: . +@prefix dcat: . +@prefix foaf: . +@prefix org: . +@prefix legal: . +@prefix m8g: . +@prefix locn: . +@prefix skos: . + +[] a dcat:DataService ; + dct:title "My geo-spatial view"@en ; + dct:description "Geospatial fragmentation for my LDES"@en ; + dct:license [ + a dct:LicenseDocument ; + dct:type [ + a skos:Concept; + skos:prefLabel "some public license"@en + ] + ] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/view-by-geospatial.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/view-by-geospatial.ttl new file mode 100644 index 0000000000..2757fe965c --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/view-by-geospatial.ttl @@ -0,0 +1,6 @@ +@prefix dct: . +@prefix dcat: . + +[] a dcat:DataService ; + dct:title "My geo-spatial view"@en ; + dct:description "Geospatial fragmentation for my LDES"@en . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/view-by-page.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/view-by-page.ttl new file mode 100644 index 0000000000..edcafc2197 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataservice/view-by-page.ttl @@ -0,0 +1,6 @@ +@prefix dct: . +@prefix dcat: . + +[] a dcat:DataService ; + dct:title "My view by page"@en ; + dct:description "By page fragmentation for my LDES"@en . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/buildings.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/buildings.ttl new file mode 100644 index 0000000000..3b47a29b83 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/buildings.ttl @@ -0,0 +1,7 @@ +@prefix dcat: . +@prefix dct: . + +[ a dcat:Dataset ; + dct:description "LDES for my buildings data collection"@en ; + dct:title "My LDES"@en +] . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/not-valid.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/not-valid.ttl new file mode 100644 index 0000000000..ece91e0ab1 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/not-valid.ttl @@ -0,0 +1,26 @@ +@prefix dct: . +@prefix dcat: . +@prefix foaf: . +@prefix org: . +@prefix legal: . +@prefix m8g: . +@prefix locn: . + +dct:dataset a dcat:Dataset ; + dct:title "My LDES"@en ; + dct:title "Mijn LDES"@nl ; + dct:description "LDES for my data collection"@en ; + dct:description "LDES vir my data-insameling"@af ; + dct:creator . + + a legal:LegalEntity ; + foaf:name "Data Company" ; + legal:legalName "Data Company BV" ; + m8g:registeredAddress [ + a locn:Address ; + locn:fullAddress "My full address here" + ] ; + m8g:contactPoint [ + a m8g:ContactPoint ; + m8g:hasEmail "info@data-company.com" + ] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/parcels.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/parcels.ttl new file mode 100644 index 0000000000..d3a83d676f --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/parcels.ttl @@ -0,0 +1,7 @@ +@prefix dcat: . +@prefix dct: . + +[ a dcat:Dataset ; + dct:description "LDES for my parcels data collection"@en ; + dct:title "My LDES"@en +] . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/valid.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/valid.ttl new file mode 100644 index 0000000000..cec5f4fcad --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dataset/valid.ttl @@ -0,0 +1,26 @@ +@prefix dct: . +@prefix dcat: . +@prefix foaf: . +@prefix org: . +@prefix legal: . +@prefix m8g: . +@prefix locn: . + +[] a dcat:Dataset ; + dct:title "My LDES"@en ; + dct:title "Mijn LDES"@nl ; + dct:description "LDES for my data collection"@en ; + dct:description "LDES vir my data-insameling"@af ; + dct:creator . + + a legal:LegalEntity ; + foaf:name "Data Company" ; + legal:legalName "Data Company BV" ; + m8g:registeredAddress [ + a locn:Address ; + locn:fullAddress "My full address here" + ] ; + m8g:contactPoint [ + a m8g:ContactPoint ; + m8g:hasEmail "info@data-company.com" + ] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dcat-ap_2.0.1_shacl_shapes.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dcat-ap_2.0.1_shacl_shapes.ttl new file mode 100644 index 0000000000..7f18842b91 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dcat-ap_2.0.1_shacl_shapes.ttl @@ -0,0 +1,697 @@ +@prefix rdf: . +@prefix : . +@prefix adms: . +@prefix cc: . +@prefix dc: . +@prefix dcat: . +@prefix dct: . +@prefix foaf: . +@prefix lcon: . +@prefix org: . +@prefix owl: . +@prefix odrl: . +@prefix prov: . +@prefix rdfs: . +@prefix schema: . +@prefix sh: . +@prefix skos: . +@prefix spdx: . +@prefix time: . +@prefix vcard: . +@prefix xsd: . +@prefix dcatap: . + + + dcat:accessURL ; + dcat:downloadURL ; + dcatap:availability ; + dct:format ; + dct:conformsTo ; + dct:creator [ + rdfs:seeAlso ; + org:memberOf ; + foaf:homepage ; + foaf:name "Bert Van Nuffelen" + ], [ + rdfs:seeAlso ; + org:memberOf ; + foaf:homepage ; + foaf:name "Natasa Sofou" + ], [ + rdfs:seeAlso ; + org:memberOf ; + foaf:homepage ; + foaf:name "Eugeniu Costetchi" + ], [ + rdfs:seeAlso ; + org:memberOf ; + foaf:homepage ; + foaf:name "Makx Dekkers" + ], [ + rdfs:seeAlso ; + org:memberOf ; + foaf:homepage ; + foaf:name "Nikolaos Loutas" + ], [ + rdfs:seeAlso ; + org:memberOf ; + foaf:homepage ; + foaf:name "Vassilios Peristeras" + ] ; + dct:license ; + cc:attributionURL ; + dct:modified "2019-11-15"^^xsd:date ; + dct:publisher ; + dct:relation ; + dct:description "This document specifies the constraints on properties and classes expressed by DCAT-AP in SHACL."@en ; + dct:title "The constraints of DCAT Application Profile for Data Portals in Europe"@en ; + owl:versionInfo "2.0.0" ; + foaf:homepage ; + foaf:maker [ + foaf:mbox ; + foaf:name "DCAT-AP Working Group" ; + foaf:page , + ] . + + + +#------------------------------------------------------------------------- +# The shapes in this file cover all classes in DCAT-AP 2.0.0. +# +# +#------------------------------------------------------------------------- + +:Agent_Shape + a sh:NodeShape ; + sh:name "Agent"@en ; + sh:property [ + sh:minCount 1 ; + sh:nodeKind sh:Literal ; + sh:path foaf:name ; + sh:severity sh:Violation + ], [ + sh:class skos:Concept ; + sh:maxCount 1 ; + sh:path dct:type ; + sh:severity sh:Violation + ] ; + sh:targetClass foaf:Agent . + +:CatalogRecord_Shape + a sh:NodeShape ; + sh:name "Catalog Record"@en ; + sh:property [ + sh:maxCount 1 ; + sh:minCount 1 ; + sh:node :DcatResource_Shape ; + sh:path foaf:primaryTopic ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:minCount 1 ; + sh:path dct:modified ; + sh:severity sh:Violation ; + sh:shape :DateOrDateTimeDataType_Shape + ], [ + sh:class dct:Standard ; + sh:maxCount 1 ; + sh:path dct:conformsTo ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:node :DateOrDateTimeDataType_Shape ; + sh:path dct:issued ; + sh:severity sh:Violation + ], [ + sh:class skos:Concept ; + sh:maxCount 1 ; + sh:path adms:status ; + sh:severity sh:Violation + ], [ + sh:class dct:LinguisticSystem ; + sh:path dct:language ; + sh:severity sh:Violation + ], [ + sh:class dcat:CatalogRecord ; + sh:maxCount 1 ; + sh:path dct:source ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:Literal ; + sh:path dct:title ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:Literal ; + sh:path dct:description ; + sh:severity sh:Violation + ] ; + sh:targetClass dcat:CatalogRecord . + +:Catalog_Shape + a sh:NodeShape ; + sh:name "Catalog"@en ; + sh:property [ + sh:class dct:LinguisticSystem ; + sh:path dct:language ; + sh:severity sh:Violation + ], [ + sh:class dct:LicenseDocument ; + sh:maxCount 1 ; + sh:path dct:license ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:node :DateOrDateTimeDataType_Shape ; + sh:path dct:issued ; + sh:severity sh:Violation + ], [ + sh:class dct:Location ; + sh:path dct:spatial ; + sh:severity sh:Violation + ], [ + sh:class dcat:Catalog ; + sh:path dct:hasPart ; + sh:severity sh:Violation + ], [ + sh:class dcat:Catalog ; + sh:maxCount 1 ; + sh:path dct:isPartOf ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:node :DateOrDateTimeDataType_Shape ; + sh:path dct:modified ; + sh:severity sh:Violation + ], [ + sh:class dct:RightsStatement ; + sh:maxCount 1 ; + sh:path dct:rights ; + sh:severity sh:Violation + ], [ + sh:class dcat:CatalogRecord ; + sh:path dcat:record ; + sh:severity sh:Violation + ], [ + sh:class skos:ConceptScheme ; + sh:path dcat:themeTaxonomy ; + sh:severity sh:Violation + ], [ + sh:class dcat:DataService ; + sh:path dcat:service ; + sh:severity sh:Violation + ], [ + sh:class dcat:Catalog ; + sh:path dcat:catalog ; + sh:severity sh:Violation + ], [ + sh:class foaf:Agent ; + sh:maxCount 1 ; + sh:path dct:creator ; + sh:severity sh:Violation + ], [ + sh:class dcat:Dataset ; + sh:minCount 1 ; + sh:path dcat:dataset ; + sh:severity sh:Violation + ], [ + sh:minCount 1 ; + sh:nodeKind sh:Literal ; + sh:path dct:description ; + sh:severity sh:Violation + ], [ + sh:class foaf:Agent ; + sh:maxCount 1 ; + sh:minCount 1 ; + sh:path dct:publisher ; + sh:severity sh:Violation + ], [ + sh:minCount 1 ; + sh:nodeKind sh:Literal ; + sh:path dct:title ; + sh:severity sh:Violation + ], [ + sh:class foaf:Document ; + sh:maxCount 1 ; + sh:path foaf:homepage ; + sh:severity sh:Violation + ] ; + sh:targetClass dcat:Catalog . + +:CategoryScheme_Shape + a sh:NodeShape ; + sh:name "Category Scheme"@en ; + sh:property [ + sh:minCount 1 ; + sh:nodeKind sh:Literal ; + sh:path dct:title ; + sh:severity sh:Violation + ] ; + sh:targetClass skos:ConceptScheme . + +:Category_Shape + a sh:NodeShape ; + sh:name "Category"@en ; + sh:property [ + sh:minCount 1 ; + sh:nodeKind sh:Literal ; + sh:path skos:prefLabel ; + sh:severity sh:Violation + ] ; + sh:targetClass skos:Concept . + +:Checksum_Shape + a sh:NodeShape ; + sh:name "Checksum"@en ; + sh:property [ + sh:hasValue spdx:checksumAlgorithm_sha1 ; + sh:maxCount 1 ; + sh:minCount 1 ; + sh:path spdx:algorithm ; + sh:severity sh:Violation + ], [ + sh:dateTime xsd:hexBinary ; + sh:maxCount 1 ; + sh:minCount 1 ; + sh:path spdx:checksumValue ; + sh:severity sh:Violation + ] ; + sh:targetClass spdx:Checksum . + +:DataService_Shape + a sh:NodeShape ; + sh:name "Data Service"@en ; + sh:property [ + sh:minCount 1 ; + sh:nodeKind sh:Literal ; + sh:path dct:title ; + sh:severity sh:Violation + ], [ + sh:minCount 1 ; + sh:nodeKind sh:BlankNodeOrIRI ; + sh:path dcat:endpointURL ; + sh:severity sh:Violation + ], [ + sh:class dcat:Dataset ; + sh:path dcat:servesDataset ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:Literal ; + sh:path dct:description ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:BlankNodeOrIRI ; + sh:path dcat:endpointDescription ; + sh:severity sh:Violation + ], [ + sh:class dct:LicenseDocument ; + sh:maxCount 1 ; + sh:path dct:licence ; + sh:severity sh:Violation + ], [ + sh:class dct:RightsStatement ; + sh:maxCount 1 ; + sh:path dct:accessRights ; + sh:severity sh:Violation + ] ; + sh:targetClass dcat:DataService . + +:Dataset_Shape + a sh:NodeShape ; + sh:name "Dataset"@en ; + sh:property [ + sh:minCount 1 ; + sh:nodeKind sh:Literal ; + sh:path dct:description ; + sh:severity sh:Violation + ], [ + sh:minCount 1 ; + sh:nodeKind sh:Literal ; + sh:path dct:title ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:Literal ; + sh:path dct:identifier ; + sh:severity sh:Violation + ], [ + sh:class vcard:Kind ; + sh:path dcat:contactPoint ; + sh:severity sh:Violation + ], [ + sh:class dcat:Distribution ; + sh:path dcat:distribution ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:Literal ; + sh:path dcat:keyword ; + sh:severity sh:Violation + ], [ + sh:class foaf:Agent ; + sh:maxCount 1 ; + sh:path dct:publisher ; + sh:severity sh:Violation + ], [ + sh:class dct:Location ; + sh:path dct:spatial ; + sh:severity sh:Violation + ], [ + sh:class dct:PeriodOfTime ; + sh:path dct:temporal ; + sh:severity sh:Violation + ], [ + sh:class skos:Concept ; + sh:path dcat:theme ; + sh:severity sh:Violation + ], [ + sh:class dct:RightsStatement ; + sh:maxCount 1 ; + sh:path dct:accessRights ; + sh:severity sh:Violation + ], [ + sh:class dct:Frequency ; + sh:maxCount 1 ; + sh:path dct:accrualPeriodicity ; + sh:severity sh:Violation + ], [ + sh:class dct:Standard ; + sh:path dct:conformsTo ; + sh:severity sh:Violation + ], [ + sh:class dcat:Dataset ; + sh:path dct:hasVersion ; + sh:severity sh:Violation + ], [ + sh:class dcat:Dataset ; + sh:path dct:isVersionOf ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:path dct:issued ; + sh:severity sh:Violation ; + sh:shape :DateOrDateTimeDataType_Shape + ], [ + sh:class dct:LinguisticSystem ; + sh:path dct:language ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:path dct:modified ; + sh:severity sh:Violation ; + sh:shape :DateOrDateTimeDataType_Shape + ], [ + sh:class dct:ProvenanceStatement ; + sh:path dct:provenance ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:BlankNodeOrIRI ; + sh:path dct:relation ; + sh:severity sh:Violation + ], [ + sh:class dcat:Dataset ; + sh:path dct:source ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:class skos:Concept ; + sh:path dct:type ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:nodeKind sh:Literal ; + sh:path owl:versionInfo ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:Literal ; + sh:path adms:versionNotes ; + sh:severity sh:Violation + ], [ + sh:class adms:Identifier ; + sh:path adms:identifier ; + sh:severity sh:Violation + ], [ + sh:class dcat:Distribution ; + sh:path adms:sample ; + sh:severity sh:Violation + ], [ + sh:class foaf:Document ; + sh:path dcat:landingPage ; + sh:severity sh:Violation + ], [ + sh:class foaf:Document ; + sh:path foaf:page ; + sh:severity sh:Violation + ], [ + sh:class dcat:Relationship ; + sh:path dcat:qualifiedRelation ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:BlankNodeOrIRI ; + sh:path dc:isReferencedBy ; + sh:severity sh:Violation + ], [ + sh:class prov:Attribution ; + sh:path prov:qualifiedAttribution ; + sh:severity sh:Violation + ], [ + sh:class prov:Activity ; + sh:path prov:wasGeneratedBy ; + sh:severity sh:Violation + ], [ + sh:datatype xsd:duration ; + sh:path dcat:temporalResolution ; + sh:severity sh:Violation + ], [ + sh:datatype xsd:decimal ; + sh:path dcat:spatialResolutionInMeters ; + sh:severity sh:Violation + ], [ + sh:class foaf:Agent ; + sh:maxCount 1 ; + sh:path dct:creator ; + sh:severity sh:Violation + ] ; + sh:targetClass dcat:Dataset . + +:DateOrDateTimeDataType_Shape + a sh:NodeShape ; + rdfs:comment "Date time date disjunction shape checks that a datatype property receives a date or a dateTime literal" ; + rdfs:label "Date time date disjunction" ; + sh:message "The values must be data typed as either xsd:date or xsd:dateTime" ; + sh:or ([ + sh:datatype xsd:date + ] + [ + sh:datatype xsd:dateTime + ] + ) . + +:DcatResource_Shape + a sh:NodeShape ; + rdfs:comment "the union of Catalog, Dataset and DataService" ; + rdfs:label "dcat:Resource" ; + sh:message "The node is either a Catalog, Dataset or a DataService" ; + sh:or ([ + sh:class dcat:Catalog + ] + [ + sh:class dcat:Dataset + ] + [ + sh:class dcat:DataService + ] + ) . + +:Distribution_Shape + a sh:NodeShape ; + sh:name "Distribution"@en ; + sh:property [ + sh:class dct:Standard ; + sh:path dct:conformsTo ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:node :DateOrDateTimeDataType_Shape ; + sh:path dct:issued ; + sh:severity sh:Violation + ], [ + sh:class dct:LinguisticSystem ; + sh:path dct:language ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:node :DateOrDateTimeDataType_Shape ; + sh:path dct:modified ; + sh:severity sh:Violation + ], [ + sh:class dct:RightsStatement ; + sh:maxCount 1 ; + sh:path dct:rights ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:Literal ; + sh:path dct:title ; + sh:severity sh:Violation + ], [ + sh:class spdx:Checksum ; + sh:maxCount 1 ; + sh:path spdx:checksum ; + sh:severity sh:Violation + ], [ + sh:class skos:Concept ; + sh:maxCount 1 ; + sh:path adms:status ; + sh:severity sh:Violation + ], [ + sh:datatype xsd:decimal ; + sh:maxCount 1 ; + sh:path dcat:byteSize ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:BlankNodeOrIRI; + sh:path dcat:downloadURL ; + sh:severity sh:Violation + ], [ + sh:class dct:MediaType ; + sh:maxCount 1 ; + sh:path dcat:mediaType ; + sh:severity sh:Violation + ], [ + sh:class foaf:Document ; + sh:path foaf:page ; + sh:severity sh:Violation + ], [ + sh:class odrl:Policy ; + sh:maxCount 1 ; + sh:path odrl:hasPolicy ; + sh:severity sh:Violation + ], [ + sh:class dcat:DataService ; + sh:path dcat:accessService ; + sh:severity sh:Violation + ], [ + sh:class dct:MediaType ; + sh:maxCount 1 ; + sh:path dcat:compressFormat ; + sh:severity sh:Violation + ], [ + sh:class dct:MediaType ; + sh:maxCount 1 ; + sh:path dcat:packageFormat ; + sh:severity sh:Violation + ], [ + sh:datatype xsd:duration ; + sh:path dcat:temporalResolution ; + sh:severity sh:Violation + ], [ + sh:datatype xsd:decimal ; + sh:path dcat:spatialResolutionInMeters ; + sh:severity sh:Violation + ], [ + sh:minCount 1 ; + sh:nodeKind sh:BlankNodeOrIRI; + sh:path dcat:accessURL ; + sh:severity sh:Violation + ], [ + sh:nodeKind sh:Literal ; + sh:path dct:description ; + sh:severity sh:Violation + ], [ + sh:class skos:Concept ; + sh:maxCount 1 ; + sh:path dcatap:availability ; + sh:severity sh:Violation + ], [ + sh:class dct:MediaTypeOrExtent ; + sh:maxCount 1 ; + sh:path dct:format ; + sh:severity sh:Violation + ], [ + sh:class dct:LicenseDocument ; + sh:maxCount 1 ; + sh:path dct:license ; + sh:severity sh:Violation + ] ; + sh:targetClass dcat:Distribution . + +:Identifier_Shape + a sh:NodeShape ; + sh:name "Identifier"@en ; + sh:property [ + sh:maxCount 1 ; + sh:path skos:notation ; + sh:severity sh:Violation + ] ; + sh:targetClass adms:Identifier . + +:LicenceDocument_Shape + a sh:NodeShape ; + sh:name "Licence Document"@en ; + sh:property [ + sh:class skos:Concept ; + sh:path dct:type ; + sh:severity sh:Violation + ] ; + sh:targetClass dct:LicenseDocument . + +:Location_Shape + a sh:NodeShape ; + sh:name "Location"@en ; + sh:property [ + sh:maxCount 1 ; + sh:nodeKind sh:Literal ; + sh:path dcat:bbox ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:nodeKind sh:Literal ; + sh:path dcat:centroid ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:nodeKind sh:Literal ; + sh:path lcon:geometry ; + sh:severity sh:Violation + ] ; + sh:targetClass dct:Location . + +:PeriodOfTime_Shape + a sh:NodeShape ; + sh:name "PeriodOfTime"@en ; + sh:property [ + sh:maxCount 1 ; + sh:path dcat:endDate ; + sh:severity sh:Violation ; + sh:shape :DateOrDateTimeDataType_Shape + ], [ + sh:class time:Instant ; + sh:maxCount 1 ; + sh:path time:hasBeginning ; + sh:severity sh:Violation + ], [ + sh:class time:Instant ; + sh:maxCount 1 ; + sh:path time:hasEnd ; + sh:severity sh:Violation + ], [ + sh:maxCount 1 ; + sh:path dcat:startDate ; + sh:severity sh:Violation ; + sh:shape :DateOrDateTimeDataType_Shape + ] ; + sh:targetClass dct:PeriodOfTime . + +:Relationship_Shape + a sh:NodeShape ; + sh:name "Relationship"@en ; + sh:property [ + sh:class dcat:Role ; + sh:minCount 1 ; + sh:path dct:relation ; + sh:severity sh:Violation + ], [ + sh:minCount 1 ; + sh:node :DcatResource_Shape ; + sh:path dcat:hadRole ; + sh:severity sh:Violation + ] ; + sh:targetClass dcat:Relationship . + diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dcat-combined-all.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dcat-combined-all.ttl new file mode 100644 index 0000000000..9298105564 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dcat-combined-all.ttl @@ -0,0 +1,80 @@ +@prefix dcat: . +@prefix dc: . +@prefix foaf: . +@prefix ns0: . +@prefix ns1: . +@prefix ns2: . +@prefix rdfs: . + + + dcat:dataset , ; + dcat:service , , ; + a dcat:Catalog ; + dc:identifier "2a896d35-8c72-4723-83b3-add9b1be96aa"^^rdfs:Literal ; + dc:description "All LDES'es from publiser X"@en ; + dc:publisher ; + dc:title "My LDES'es"@en . + + + a foaf:Agent ; + ns0:contactPoint [ + a ns0:ContactPoint ; + ns0:hasEmail "info@data-publishing-company.com" + ] ; + ns0:registeredAddress [ + a ; + ns1:fullAddress "Some full address here" + ] ; + ns2:legalName "Data Publishing Company BV" ; + foaf:name "Data Publishing Company" . + + + dc:title "My LDES"@en ; + dc:description "LDES for my parcels data collection"@en ; + dc:identifier "http://localhost.dev/parcels"^^rdfs:Literal ; + dc:conformsTo , ; + a dcat:Dataset . + + + dcat:servesDataset ; + dcat:endpointURL ; + dcat:endpointDescription ; + a dcat:DataService ; + dc:title "My view by page"@en ; + dc:identifier "http://localhost.dev/parcels/by-page"^^rdfs:Literal ; + dc:description "By page fragmentation for my LDES"@en . + + + dcat:servesDataset ; + dcat:endpointURL ; + dcat:endpointDescription ; + a dcat:DataService ; + dc:title "My geo-spatial view"@en ; + dc:identifier "http://localhost.dev/parcels/by-time"^^rdfs:Literal ; + dc:description "Geospatial fragmentation for my LDES"@en . + + + dc:title "My LDES"@en ; + dc:identifier "http://localhost.dev/buildings"^^rdfs:Literal ; + dc:description "LDES for my buildings data collection"@en ; + dc:conformsTo , ; + a dcat:Dataset . + + + dcat:servesDataset ; + dcat:endpointDescription ; + dcat:endpointURL ; + a dcat:DataService ; + dc:title "My view by page"@en ; + dc:identifier "http://localhost.dev/buildings/by-page"^^rdfs:Literal ; + dc:description "By page fragmentation for my LDES"@en . + + a . + + a . + + a rdfs:Resource . + + a rdfs:Resource . + a rdfs:Resource . + a rdfs:Resource . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dcat-combined-without-views.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dcat-combined-without-views.ttl new file mode 100644 index 0000000000..71e4088f17 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/dcat-combined-without-views.ttl @@ -0,0 +1,48 @@ +@prefix dc: . +@prefix dcat: . +@prefix foaf: . +@prefix ns0: . +@prefix ns1: . +@prefix ns2: . +@prefix rdfs: . + + + dc:title "My LDES"@en ; + dc:identifier "http://localhost.dev/buildings"^^rdfs:Literal ; + dc:description "LDES for my buildings data collection"@en ; + dc:conformsTo , ; + a dcat:Dataset . + + + dcat:dataset , ; + a dcat:Catalog ; + dc:description "All LDES'es from publiser X"@en ; + dc:identifier "2a896d35-8c72-4723-83b3-add9b1be96aa"^^rdfs:Literal ; + dc:publisher ; + dc:title "My LDES'es"@en . + + + a foaf:Agent ; + ns0:contactPoint [ + a ns0:ContactPoint ; + ns0:hasEmail "info@data-publishing-company.com" + ] ; + ns0:registeredAddress [ + a ; + ns1:fullAddress "Some full address here" + ] ; + ns2:legalName "Data Publishing Company BV" ; + foaf:name "Data Publishing Company" . + + + dc:title "My LDES"@en ; + dc:identifier "http://localhost.dev/parcels"^^rdfs:Literal ; + dc:description "LDES for my parcels data collection"@en ; + dc:conformsTo , ; + a dcat:Dataset . + + + a . + + + a . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/invalid-to-provided-shape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/invalid-to-provided-shape.ttl new file mode 100644 index 0000000000..68540ee38f --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/invalid-to-provided-shape.ttl @@ -0,0 +1,45 @@ +@base +@prefix dct: . +@prefix dcat: . +@prefix foaf: . +@prefix rdf: . +@prefix skos: . +@prefix legal: . +@prefix m8g: . +@prefix locn: . + + a dcat:Catalog ; + dct:title "My LDES'es"@en ; + dct:description "All LDES'es from publiser X"@en ; + dct:publisher ; + dcat:dataset ; + dcat:service . + + a legal:LegalEntity ; + foaf:name "Data Publishing Company" ; + legal:legalName "Data Publishing Company BV" ; + m8g:registeredAddress [ + a locn:Address ; + locn:fullAddress "Some full address here" + ] ; + m8g:contactPoint [ + a m8g:ContactPoint ; + m8g:hasEmail "info@data-publishing-company.com" + ] . + + a dcat:Dataset ; + dct:title "My LDES"@en ; + dct:description "LDES for my data collection"@en . + + a dcat:DataService ; + dcat:endpointURL ; + dcat:servesDataset ; + dct:title "My geo-spatial view"@en ; + dct:description "Geospatial fragmentation for my LDES"@en ; + dct:license [ + a dct:LicenseDocument ; + dct:type [ + rdf:type skos:Concept; + skos:prefLabel "some public license"@en + ] + ] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/valid-to-provided-shape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/valid-to-provided-shape.ttl new file mode 100644 index 0000000000..06457a586d --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/dcat/valid-to-provided-shape.ttl @@ -0,0 +1,45 @@ +@base +@prefix dct: . +@prefix dcat: . +@prefix foaf: . +@prefix rdf: . +@prefix skos: . +@prefix legal: . +@prefix m8g: . +@prefix locn: . + + a dcat:Catalog ; + dct:title "My LDES'es"@en ; + dct:description "All LDES'es from publiser X"@en ; + dct:publisher ; + dcat:dataset ; + dcat:service . + + a foaf:Agent ; + foaf:name "Data Publishing Company" ; + legal:legalName "Data Publishing Company BV" ; + m8g:registeredAddress [ + a locn:Address ; + locn:fullAddress "Some full address here" + ] ; + m8g:contactPoint [ + a m8g:ContactPoint ; + m8g:hasEmail "info@data-publishing-company.com" + ] . + + a dcat:Dataset ; + dct:title "My LDES"@en ; + dct:description "LDES for my data collection"@en . + + a dcat:DataService ; + dcat:endpointURL ; + dcat:servesDataset ; + dct:title "My geo-spatial view"@en ; + dct:description "Geospatial fragmentation for my LDES"@en ; + dct:license [ + a dct:LicenseDocument ; + dct:type [ + rdf:type skos:Concept; + skos:prefLabel "some public license"@en + ] + ] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams-with-dcat/ldes-create-versions.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams-with-dcat/ldes-create-versions.ttl new file mode 100644 index 0000000000..b83c1e124c --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams-with-dcat/ldes-create-versions.ttl @@ -0,0 +1,26 @@ +@prefix ldes: . +@prefix dcat: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix server: . +@prefix xsd: . +@prefix animals: . +@prefix rdfs: . + +server:animals a ldes:EventStream, dcat:Dataset ; + dcterms:conformsTo , ; + dcterms:identifier "http://localhost:8080/animals"^^rdfs:Literal ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:eventSource [ + a ldes:EventSource ; + ] ; + ldes:createVersions true ; + tree:shape [ + a sh:NodeShape + ] . + + a dcterms:Standard . + + a dcterms:Standard . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams-with-dcat/ldes-with-dcat.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams-with-dcat/ldes-with-dcat.ttl new file mode 100644 index 0000000000..5a63afd4d5 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams-with-dcat/ldes-with-dcat.ttl @@ -0,0 +1,26 @@ +@prefix ldes: . +@prefix dcat: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix server: . +@prefix xsd: . +@prefix rdfs: . + + +server:name1 a ldes:EventStream, dcat:Dataset ; + dcterms:conformsTo , ; + dcterms:identifier "http://localhost:8080/name1"^^rdfs:Literal ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions false ; + ldes:eventSource [ + a ldes:EventSource ; + ] ; + tree:shape server:shape . + +server:shape a sh:NodeShape . + + a dcterms:Standard . + + a dcterms:Standard . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-and-dataset-with-named-views.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-and-dataset-with-named-views.ttl new file mode 100644 index 0000000000..ef68423522 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-and-dataset-with-named-views.ttl @@ -0,0 +1,79 @@ +@prefix tree: . +@prefix ldes: . +@prefix sh: . +@prefix dcterms: . +@prefix mobiliteit: . +@prefix col: . +@prefix server: . +@prefix xsd: . +@prefix dct: . +@prefix dcat: . +@prefix foaf: . +@prefix org: . +@prefix legal: . +@prefix m8g: . +@prefix locn: . +@prefix view1: . +@prefix view2: . +@prefix rdfs: . + +server:collectionName1 a ldes:EventStream, dcat:Dataset ; + dct:conformsTo , ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions true ; + ldes:eventSource [ + a ldes:EventSource ; + ldes:retentionPolicy [ + a ; + "PT2M"^^ ; + ] + ] ; + tree:shape col:shape ; + tree:view col:view1 ; + tree:view col:view2 ; + dct:title "My LDES"@en ; + dct:title "Mijn LDES"@nl ; + dct:identifier "http://localhost:8080/collectionName1"^^rdfs:Literal ; + dct:description "LDES for my data collection"@en ; + dct:description "LDES vir my data-insameling"@af ; + dct:creator . + +col:shape a sh:NodeShape ; + sh:deactivated true . + +col:view1 a tree:Node ; + tree:viewDescription view1:description . + +col:view2 a tree:Node ; + tree:viewDescription view2:description . + +view1:description a tree:ViewDescription ; + tree:pageSize "100"^^; + tree:fragmentationStrategy + ([ a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + +view2:description a tree:ViewDescription ; + tree:pageSize "100"^^; + tree:fragmentationStrategy + ([ a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + + a legal:LegalEntity ; + foaf:name "Data Company" ; + legal:legalName "Data Company BV" ; + m8g:registeredAddress [ + a locn:Address ; + locn:fullAddress "My full address here" + ] ; + m8g:contactPoint [ + a m8g:ContactPoint ; + m8g:hasEmail "info@data-company.com" + ] . + + a dcterms:Standard . + + a dcterms:Standard . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-create-versions.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-create-versions.ttl new file mode 100644 index 0000000000..967c07b50a --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-create-versions.ttl @@ -0,0 +1,16 @@ +@prefix ldes: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix server: . +@prefix xsd: . +@prefix animals: . + +server:animals a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions true ; + tree:shape [ + a sh:NodeShape + ] . + diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-empty.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-empty.ttl new file mode 100644 index 0000000000..5cdf8f1c6e --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-empty.ttl @@ -0,0 +1,32 @@ +@prefix tree: . +@prefix ldes: . +@prefix sh: . +@prefix dcterms: . +@prefix dcat: . +@prefix custom: . +@prefix server: . +@prefix col: . +@prefix xsd: . +@prefix rdfs: . + +server:collectionName1 a ldes:EventStream, dcat:Dataset ; + dcterms:conformsTo , ; + dcterms:identifier "http://localhost:8080/collectionName1"^^rdfs:Literal ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions false ; + ldes:eventSource [ + a ldes:EventSource ; + ldes:retentionPolicy [ + a ; + "PT2M"^^ ; + ] + ] ; + tree:shape col:shape . + +col:shape a sh:NodeShape ; + sh:deactivated true . + + a dcterms:Standard . + + a dcterms:Standard . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-duplicate-retention.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-duplicate-retention.ttl new file mode 100644 index 0000000000..9898655d23 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-duplicate-retention.ttl @@ -0,0 +1,36 @@ +@prefix ldes: . +@prefix custom: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix server: . +@prefix xsd: . + + +[] a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:view ldes:view1 ; + tree:shape [ + sh:closed "true"; + a sh:NodeShape ; + ] . + +ldes:view1 a tree:Node ; + tree:viewDescription viewName:description . + +viewName:description + a tree:ViewDescription ; + tree:pageSize "100"^^; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT10M"^^ ; + ] ; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "P1D"^^ ; + ] ; + tree:fragmentationStrategy ([ + a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-invalid-skol-dom.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-invalid-skol-dom.ttl new file mode 100644 index 0000000000..2d54e5c958 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-invalid-skol-dom.ttl @@ -0,0 +1,18 @@ +@prefix ldes: . +@prefix custom: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix server: . +@prefix xsd: . +@prefix rdfs: . + + + +server:name1 a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:skolemizationDomain "http://example.org" ; + tree:shape server:shape . + +server:shape a sh:NodeShape . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-named-views.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-named-views.ttl new file mode 100644 index 0000000000..b1049d5584 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-named-views.ttl @@ -0,0 +1,56 @@ +@prefix tree: . +@prefix ldes: . +@prefix sh: . +@prefix dc: . +@prefix dcat: . +@prefix col: . +@prefix mobiliteit: . +@prefix rdf: . +@prefix view1: . +@prefix view2: . +@prefix server: . +@prefix xsd: . +@prefix rdfs: . + +col:view2 a tree:Node ; + tree:viewDescription view2:description . + +col:view1 a tree:Node ; + tree:viewDescription view1:description . + +server:collectionName1 a ldes:EventStream, dcat:Dataset ; + dc:conformsTo , ; + dc:identifier "http://localhost:8080/collectionName1"^^rdfs:Literal ; + ldes:timestampPath dc:created ; + ldes:versionOfPath dc:isVersionOf ; + ldes:createVersions false ; + ldes:eventSource [ + a ldes:EventSource ; + ldes:retentionPolicy [ + a ; + "PT2M"^^ ; + ] + ] ; + tree:shape col:shape ; + tree:view col:view1 ; + tree:view col:view2 . + +col:shape a sh:NodeShape ; + sh:deactivated true . + +view1:description rdf:type tree:ViewDescription ; + tree:pageSize "100"^^; + tree:fragmentationStrategy + ([ a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + +view2:description rdf:type tree:ViewDescription ; + tree:pageSize "100"^^; + tree:fragmentationStrategy + ([ a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + + a dc:Standard . + a dc:Standard . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-skol-dom.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-skol-dom.ttl new file mode 100644 index 0000000000..39a4cfa05c --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-skol-dom.ttl @@ -0,0 +1,16 @@ +@prefix ldes: . +@prefix custom: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix server: . +@prefix xsd: . + + +server:name1 a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + #LDES_SKOLEMIZATION_DOMAIN_LINE + tree:shape server:shape . + +server:shape a sh:NodeShape . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-valid-skol-dom.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-valid-skol-dom.ttl new file mode 100644 index 0000000000..1ba1b2366a --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-valid-skol-dom.ttl @@ -0,0 +1,16 @@ +@prefix ldes: . +@prefix custom: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix server: . +@prefix xsd: . + + +server:name1 a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:skolemizationDomain ; + tree:shape server:shape . + +server:shape a sh:NodeShape . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-version-delimiter.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-version-delimiter.ttl new file mode 100644 index 0000000000..0c6d6385f0 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-with-version-delimiter.ttl @@ -0,0 +1,17 @@ +@prefix ldes: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix server: . +@prefix xsd: . +@prefix animals: . + +server:animals a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + ldes:createVersions true ; + ldes:versionDelimiter "#VERSION_DELIMITER#" ; + tree:shape [ + a sh:NodeShape + ] . + diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-without-type.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-without-type.ttl new file mode 100644 index 0000000000..9d75e7e82e --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes-without-type.ttl @@ -0,0 +1,7 @@ +@prefix tree: . +@prefix ldes: . +@prefix server: . + +server:collectionName1 + ldes:versionOfPath "1.1" ; + ldes:shape [] . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes.ttl new file mode 100644 index 0000000000..cf6f520947 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/ldes.ttl @@ -0,0 +1,15 @@ +@prefix ldes: . +@prefix custom: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix server: . +@prefix xsd: . + + +server:name1 a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + tree:shape server:shape . + +server:shape a sh:NodeShape . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/malformed-ldes.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/malformed-ldes.ttl new file mode 100644 index 0000000000..dde87f0077 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/malformed-ldes.ttl @@ -0,0 +1,6 @@ +@prefix tree: . +@preix ldes: . + +ldes:collectionName1 a ldes:EventStream ; + ldes:versionOfPath "1.1" ; + ldes:shape [] . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/multiple-ldes.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/multiple-ldes.ttl new file mode 100644 index 0000000000..d79a661596 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/multiple-ldes.ttl @@ -0,0 +1,77 @@ +@prefix ldes: . +@prefix mobiliteit: . +@prefix name1: . +@prefix name2: . +@prefix rdf: . +@prefix server: . +@prefix sh: . +@prefix shacl: . +@prefix terms: . +@prefix tree: . +@prefix view1: . +@prefix view2: . +@prefix view3: . +@prefix dcat: . +@prefix rdfs: . + +view3:description rdf:type tree:ViewDescription ; + tree:pageSize "100"^^; + tree:fragmentationStrategy + ([ a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + +view1:description rdf:type tree:ViewDescription ; + tree:pageSize "100"^^; + tree:fragmentationStrategy + ([ a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + +server:name2 rdf:type ldes:EventStream, dcat:Dataset ; + terms:conformsTo , ; + terms:identifier "http://localhost:8080/name2"^^rdfs:Literal ; + ldes:timestampPath terms:created ; + ldes:versionOfPath terms:isVersionOf ; + ldes:createVersions false ; + ldes:eventSource [ + a ldes:EventSource ; + ] ; + tree:view name2:view1 ; + tree:shape name2:shape . + +name2:shape a sh:NodeShape . + +view2:description rdf:type tree:ViewDescription ; + tree:pageSize "100"^^; + tree:fragmentationStrategy + ([ a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + +name2:view1 a tree:Node ; + tree:viewDescription view1:description . + +name1:view2 a tree:Node ; + tree:viewDescription view2:description . + +server:name1 rdf:type ldes:EventStream, dcat:Dataset ; + terms:conformsTo , ; + terms:identifier "http://localhost:8080/name1"^^rdfs:Literal ; + ldes:timestampPath terms:created ; + ldes:versionOfPath terms:isVersionOf ; + ldes:createVersions false ; + ldes:eventSource [ + a ldes:EventSource ; + ] ; + tree:view name1:view2 , name1:view3 ; + tree:shape name1:shape . + +name1:shape a sh:NodeShape . + +name1:view3 a tree:Node ; + tree:viewDescription view3:description . + + a terms:Standard . + + a terms:Standard . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/valid-ldes.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/valid-ldes.ttl new file mode 100644 index 0000000000..41095fc1b1 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/eventstream/streams/valid-ldes.ttl @@ -0,0 +1,14 @@ +@prefix ldes: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix custom: . + + +[] a ldes:EventStream ; + ldes:timestampPath dcterms:created ; + ldes:versionOfPath dcterms:isVersionOf ; + tree:shape [ + sh:closed true; + a sh:NodeShape ; + ] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatdataset/dcatdataset.feature b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatdataset/dcatdataset.feature new file mode 100644 index 0000000000..1ea31e9dd6 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatdataset/dcatdataset.feature @@ -0,0 +1,39 @@ +Feature: DcatDataset + As a user + I want to interact with the DcatDatasetRestController to handle datasets + + Scenario Outline: Create DCAT dataset + Given I have a dcat dataset + When I POST this dataset + Then The dataset be stored + And Response with http will be returned for dataset + + Examples: + | isValid | isStored | httpCode | + | valid | will | 201 | + | invalid | will not | 400 | + + Scenario Outline: Update DCAT dataset + Given I have a dcat dataset + And The dataset + When I PUT this dataset + Then The dataset be stored + And Response with http will be returned for dataset + + Examples: + | isValid | isStored | httpCode | isExisting | + | valid | will | 200 | already exists | + | valid | will not | 404 | does not yet exist | + | invalid | will not | 400 | already exists | + + Scenario Outline: Delete DCAT dataset + Given I have a dcat dataset + And The dataset + When I DELETE this dataset + Then The dataset be deleted + And Response with http 200 will be returned for dataset + + Examples: + | isValid | isExisting | isDeleted | + | valid | already exists |will | + | valid | does not yet exist |will not | \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatserver/delete-dcatserver.feature b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatserver/delete-dcatserver.feature new file mode 100644 index 0000000000..7a95fe6859 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatserver/delete-dcatserver.feature @@ -0,0 +1,10 @@ +Feature: delete a dcatserver from the server + + Scenario Outline: DELETE a valid dcatserver + Given a db containing + When the client makes a delete serverdcat request + Then the client receives HTTP status for dcatserverrequest + Examples: + | dcatNumber | status | + | one dcatserver | 200 | + | no dcatserver | 200 | \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatserver/post-dcatserver.feature b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatserver/post-dcatserver.feature new file mode 100644 index 0000000000..3bddcad91a --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatserver/post-dcatserver.feature @@ -0,0 +1,17 @@ +Feature: POST a dcatserver to the server + + Scenario: POST a valid dcatserver + Given a db containing no dcatserver + When the client makes a post request with a valid model + Then the client receives HTTP status 201 for dcatserverrequest + And the client receives an UUID + + Scenario: POST an invalid dcatserver + Given a db containing no dcatserver + When the client makes a post request with a invalid model + Then the client receives HTTP status 400 for dcatserverrequest + + Scenario: POST a valid dcatserver when there is already one configured + Given a db containing one dcatserver + When the client makes a post request with a valid model + Then the client receives HTTP status 400 for dcatserverrequest diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatserver/put-dcatserver.feature b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatserver/put-dcatserver.feature new file mode 100644 index 0000000000..8edac731b6 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatserver/put-dcatserver.feature @@ -0,0 +1,13 @@ +Feature: PUT a dcatserver to the server + + Scenario Outline: PUT a valid dcatserver + Given a db containing + When the client makes a put request with a model + Then the client receives HTTP status for dcatserverrequest + Examples: + | dcatNumber | isValid | status | + | one dcatserver | valid | 200 | + | no dcatserver | valid | 404 | + | one dcatserver | invalid | 400 | + | no dcatserver | invalid | 400 | + diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatview/dcatview.feature b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatview/dcatview.feature new file mode 100644 index 0000000000..010b9949c0 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/dcatview/dcatview.feature @@ -0,0 +1,38 @@ +Feature: DcatView + As a user + I want to interact with the DcatViewRestController to handle data services + + Scenario Outline: Create DCAT Dataservice + Given I have a dcat dataservice + When I POST this dataservice + Then The dataservice metadata be stored + And Response with http will be returned + + Examples: + | isValid | isStored | httpCode | + | valid | will | 201 | + | invalid | will not | 400 | + + Scenario Outline: Update DCAT Dataservice + Given I have a dcat dataservice + And The dataservice + When I PUT this dataservice + Then The dataservice metadata be stored + And Response with http will be returned + + Examples: + | isValid | isStored | httpCode | isExisting | + | valid | will | 200 | already exists | + | valid | will not | 404 | does not yet exist | + | invalid | will not | 400 | already exists | + + Scenario Outline: Delete DCAT Dataservice + Given I have a dcat dataservice + When I DELETE this dataservice + Then The dataservice metadata will be deleted + And Response with http 200 will be returned + + Examples: + | isValid | + | valid | + | invalid | \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/eventstreams/eventstreamscontroller.feature b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/eventstreams/eventstreamscontroller.feature new file mode 100644 index 0000000000..4f7ae23d4a --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/eventstreams/eventstreamscontroller.feature @@ -0,0 +1,74 @@ +Feature: event streams can be configured at runtime + + Scenario: get all event streams + Given a db containing multiple eventstreams + When the client calls "/admin/api/v1/eventstreams" + Then the client receives HTTP status 200 + And the client receives a valid list of event streams + + Scenario: get an existing event stream + Given a db containing one event stream + When the client calls "/admin/api/v1/eventstreams/name1" + Then the client receives HTTP status 200 + And the client receives a single event stream + + Scenario: get a non-existing event stream + Given an empty db + When the client calls "/admin/api/v1/eventstreams/name1" + Then the client receives HTTP status 404 + And I verify the event stream retrieval interaction + + Scenario: put a valid event stream + Given a db which does not contain specified event stream + When the client posts model from file eventstream/streams/ldes.ttl + Then the client receives HTTP status 201 + And I verify the event stream in the response body to file eventstream/streams-with-dcat/ldes-with-dcat.ttl + And I verify the event stream is saved to the db + + Scenario: post an event stream with an invalid view + Given a db which does not contain specified event stream + When the client posts model from file eventstream/streams/ldes-with-duplicate-retention.ttl + Then the client receives HTTP status 400 + + Scenario: post an event stream that creates versions + Given a db which does not contain specified event stream + When the client posts model from file eventstream/streams/ldes-create-versions.ttl + Then the client receives HTTP status 201 + And I verify the event stream in the response body to file eventstream/streams-with-dcat/ldes-create-versions.ttl + And I verify the event stream is saved to the db + + + Scenario Outline: put a invalid event stream + When the client posts model from file + Then the client receives HTTP status 400 + And I verify the absence of interactions + And I verify the absence of the event stream + Examples: + | fileName | + | eventstream/streams/ldes-without-type.ttl | + | eventstream/streams/malformed-ldes.ttl | + | eventstream/streams/ldes-with-duplicate-retention.ttl | + + Scenario: delete an existing event stream + Given a db containing one deletable event stream + When the client deletes the event stream + Then the client receives HTTP status 200 + And I verify the event stream deletion interaction + + Scenario: delete an non-existing event stream + Given an empty db + When the client deletes the event stream + Then the client receives HTTP status 404 + And I verify the event stream deletion interaction + + Scenario Outline: create an event stream in a skolemization context + Given an empty db + When the client posts model from file + Then the client receives HTTP status + And I verify the event stream in the response body to file + And I verify + Examples: + | fileName | expectedStatus | expectedResultBody | verification | + | eventstream/streams/ldes.ttl | 201 | eventstream/streams-with-dcat/ldes-with-dcat.ttl | the saved event stream has no skolemization domain | + | eventstream/streams/ldes-with-valid-skol-dom.ttl | 201 | eventstream/streams-with-dcat/ldes-with-dcat.ttl | the saved event stream has a skolemization domain | + | eventstream/streams/ldes-with-invalid-skol-dom.ttl | 400 | shacl/invalid-skol-dom-report.ttl | no event stream has been saved to the db | diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/views/viewscontroller.feature b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/views/viewscontroller.feature new file mode 100644 index 0000000000..3f596335b3 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/features/views/viewscontroller.feature @@ -0,0 +1,56 @@ +Feature: AdminViewsRestController + + Scenario Outline: Add a view with retention policies + Given an LDES server with an event stream + When I POST a view from file "" to "/admin/api/v1/eventstreams/name1/views" + Then I obtain an HTTP status + Examples: + | fileName | status | + | view/view-without-retention.ttl | 201 | + | view/view.ttl | 201 | + | view/view-with-duplicate-retention.ttl | 400 | + | view/view-with-two-diff-retention.ttl | 201 | + + Scenario: Add a view to a non-existing event stream + Given an LDES server with an event stream + When I POST a view from file "view/view.ttl" to "/admin/api/v1/eventstreams/an-unique-and-non-existing-event-stream/views" + Then I obtain an HTTP status 404 + And I check if there were no interactions with the db + + Scenario Outline: Delete a view + Given an LDES server with an event stream + When I DELETE a view with "" + Then I obtain an HTTP status + And I verify there was db deletion + Examples: + | viewName | httpStatus | deletions | + | name1/view1 | 200 | 1 | + | non-existing/view1 | 404 | 0 | + + Scenario: Get all views + Given an LDES server with an event stream + And the event stream contains two views + When I GET the views of the event stream + Then I obtain an HTTP status 200 + And I check the response body is isomorphic with the two views + And I check if all views from collection "name1" were retrieved from the db + + Scenario: Get one view + Given an LDES server with an event stream + And the event stream contains two views + When I GET a view of the event stream wit id "name1/view1" + Then I obtain an HTTP status 200 + And I check the response body is isomorphic with the single view + And I check if view with id "name1/view1" was retrieved from the db + + Scenario: Get a non-existing view + Given an LDES server with an event stream + And the event stream contains two views + When I GET a view of the event stream wit id "name1/view3" + Then I obtain an HTTP status 404 + And I check if view with id "name1/view3" was retrieved from the db + + Scenario: Get a view from a non-existing event stream + When I GET a view of the event stream wit id "name3/view1" + Then I obtain an HTTP status 404 + And I check if view with id "name3/view1" was retrieved from the db diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/example_timebased.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/example_timebased.ttl new file mode 100644 index 0000000000..d7ecf2144b --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/example_timebased.ttl @@ -0,0 +1,3 @@ +[ a ; + "PT2M"^^ +] . \ No newline at end of file diff --git a/ldes-server-retention/src/test/resources/retentionpolicy/versionbased/valid_versionbased.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/example_versionbased.ttl similarity index 100% rename from ldes-server-retention/src/test/resources/retentionpolicy/versionbased/valid_versionbased.ttl rename to ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/example_versionbased.ttl diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/fictional_retentionpolicy.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/fictional_retentionpolicy.ttl new file mode 100644 index 0000000000..6f9c14d226 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/fictional_retentionpolicy.ttl @@ -0,0 +1,16 @@ +@prefix ldes: . +@prefix tree: . +@prefix server: . + +server:version-based tree:viewDescription [ + ldes:retentionPolicy [ + a ldes:Fictional1; + ldes:fictionalProperty [ + a ldes:Fictional2; + ldes:fictionalProperty [ + a ldes:Fictional3; + ldes:fictionalLiteralProperty 2 ; + ] ; + ] ; + ] ; +] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/multiple_retentionpolicies.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/multiple_retentionpolicies.ttl new file mode 100644 index 0000000000..f080992099 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/multiple_retentionpolicies.ttl @@ -0,0 +1,15 @@ +@prefix ldes: . +@prefix tree: . +@prefix xsd: . +@prefix server: . + +server:multiple tree:viewDescription [ + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT2M"^^xsd:duration ; + ], + [ + a ldes:LatestVersionSubset; + ldes:amount 2 ; + ] ; +] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/one-year-timebased-policy.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/one-year-timebased-policy.ttl new file mode 100644 index 0000000000..2ffbe78626 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/one-year-timebased-policy.ttl @@ -0,0 +1,7 @@ +@prefix tree: . +@prefix xsd: . +@prefix ldes: . + +ldes:retentionPolicy + a ldes:DurationAgoPolicy ; + tree:value "P1Y"^^ . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/ten-minutes-timebased-policy.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/ten-minutes-timebased-policy.ttl new file mode 100644 index 0000000000..e51e1c442a --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/ten-minutes-timebased-policy.ttl @@ -0,0 +1,7 @@ +@prefix tree: . +@prefix xsd: . +@prefix ldes: . + +ldes:retentionPolicy + a ldes:DurationAgoPolicy ; + tree:value "PT10M"^^ . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/timebased_retentionpolicy.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/timebased_retentionpolicy.ttl new file mode 100644 index 0000000000..f492319f70 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/timebased_retentionpolicy.ttl @@ -0,0 +1,11 @@ +@prefix ldes: . +@prefix tree: . +@prefix xsd: . +@prefix server: . + +server:time-based tree:viewDescription [ + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT2M"^^xsd:duration ; + ] ; +] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/versionbased_retentionpolicy.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/versionbased_retentionpolicy.ttl new file mode 100644 index 0000000000..a28b06171a --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/retention/versionbased_retentionpolicy.ttl @@ -0,0 +1,10 @@ +@prefix ldes: . +@prefix tree: . +@prefix server: . + +server:version-based tree:viewDescription [ + ldes:retentionPolicy [ + a ldes:LatestVersionSubset; + ldes:amount 2 ; + ] ; +] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/collection-shape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/collection-shape.ttl new file mode 100644 index 0000000000..5c54f9d176 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/collection-shape.ttl @@ -0,0 +1,7 @@ +@prefix tree: . +@prefix ldes: . +@prefix sh: . +@prefix col: . + +col:shape a sh:NodeShape ; + sh:deactivated true . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/invalid-shape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/invalid-shape.ttl new file mode 100644 index 0000000000..ca42f68eb2 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/invalid-shape.ttl @@ -0,0 +1,10 @@ +@prefix tree: . +@prefix ldes: . +@prefix sh: . + +ldes:shape a sh:NodeShape ; + sh:nodeShape [ + sh:closed "true" ; + sh:propertyShape [] + ] ; + sh:deactivated true . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/invalid-skol-dom-report.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/invalid-skol-dom-report.ttl new file mode 100644 index 0000000000..0c69ac1a91 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/invalid-skol-dom-report.ttl @@ -0,0 +1,24 @@ +@prefix dcterms: . +@prefix event-stream: . +@prefix ldes: . +@prefix rdf: . +@prefix rdfs: . +@prefix server: . +@prefix sh: . +@prefix shsh: . +@prefix test: . +@prefix tree: . +@prefix xsd: . + +[ rdf:type sh:ValidationReport; + sh:conforms false; + sh:result [ rdf:type sh:ValidationResult; + sh:focusNode server:name1; + sh:resultMessage "NodeKind[IRI] : Expected IRI for \"http://example.org\""; + sh:resultPath ldes:skolemizationDomain; + sh:resultSeverity sh:Violation; + sh:sourceConstraintComponent sh:NodeKindConstraintComponent ; + sh:sourceShape [] ; + sh:value "http://example.org" + ] +] . \ No newline at end of file diff --git a/ldes-server-port-ingest-rest/src/test/resources/menu-items/example-shape-new.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/menu-shape.ttl similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/menu-items/example-shape-new.ttl rename to ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/menu-shape.ttl diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/server-shape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/server-shape.ttl new file mode 100644 index 0000000000..faa5bb4769 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/server-shape.ttl @@ -0,0 +1,6 @@ +@prefix tree: . +@prefix ldes: . +@prefix sh: . +@prefix server: . + +server:shape a sh:NodeShape . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/shape-name1.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/shape-name1.ttl new file mode 100644 index 0000000000..d4263b6155 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/shape-name1.ttl @@ -0,0 +1,6 @@ +@prefix tree: . +@prefix ldes: . +@prefix sh: . +@prefix server: . + +server:shape a sh:NodeShape . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/shape-name2.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/shape-name2.ttl new file mode 100644 index 0000000000..62fa2f486a --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/shape-name2.ttl @@ -0,0 +1,6 @@ +@prefix tree: . +@prefix ldes: . +@prefix sh: . +@prefix server: . + +server:shape a sh:NodeShape . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/shape-without-type.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/shape-without-type.ttl new file mode 100644 index 0000000000..cf7cc98c41 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/shape-without-type.ttl @@ -0,0 +1,42 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . +@prefix sh: . +@prefix : . +@prefix skos: . + + +:MenuItemShape + sh:targetClass :MenuItem ; + sh:property [ + sh:path :name ; + sh:datatype xsd:string ; + sh:minCount 1 ; + sh:maxCount 1 ; + ]; + sh:property [ + sh:path :category ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + sh:in (:mainDish :starter :dessert) ; + ]; + sh:property [ + sh:path :price ; + sh:datatype xsd:decimal ; + sh:minCount 1 ; + sh:maxCount 1 ; + ]; + sh:property [ + sh:path :ingredients ; + sh:datatype xsd:string ; + sh:minCount 1 ; + ] . + +:mainDish a skos:Concept ; + skos:prefLabel "Main Dish" . + +:starter a skos:Concept ; + skos:prefLabel "Starter" . + +:dessert a skos:Concept ; + skos:prefLabel "Dessert" . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/valid-shape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/valid-shape.ttl new file mode 100644 index 0000000000..df40ee7f93 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/valid-shape.ttl @@ -0,0 +1,32 @@ +@prefix ldes: . +@prefix dcterms: . +@prefix tree: . +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + +[] a sh:NodeShape; + sh:targetClass ; + sh:closed true; + sh:ignoredProperties (rdf:type) ; + sh:property [ + sh:class sh:NodeShape; + sh:description "The schema all elements of the eventstream must conform to."@en; + sh:maxCount 1; + sh:minCount 1; + sh:name "shape"@en; + sh:path + ], [ + sh:nodeKind sh:IRI ; + sh:description "The object property of the members that idicates how members relate to each other from the time perspective."@en; + sh:maxCount 1; + sh:name "timestampPath"@en; + sh:path + ], [ + sh:nodeKind sh:IRI ; + sh:description "The object property that indicates the object identifier in a version object."@en; + sh:maxCount 1; + sh:name "versionOfPath"@en; + sh:path + ] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/validation/eventstreamShaclShape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/validation/eventstreamShaclShape.ttl new file mode 100644 index 0000000000..5189fce646 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/validation/eventstreamShaclShape.ttl @@ -0,0 +1,455 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . +@prefix test: . + +@prefix shsh: . + +[] a sh:NodeShape; + sh:targetClass ; + sh:closed false; + sh:ignoredProperties (rdf:type) ; + sh:property [ + sh:class sh:NodeShape; + sh:description "The schema all elements of the eventstream must conform to."@en; + sh:maxCount 1; + sh:minCount 1; + sh:name "shape"@en; + sh:path + ], [ + sh:nodeKind sh:IRI ; + sh:description "The object property of the members that idicates how members relate to each other from the time perspective."@en; + sh:maxCount 1; + sh:name "timestampPath"@en; + sh:path + ], [ + sh:nodeKind sh:IRI ; + sh:description "The object property that indicates the object identifier in a version object."@en; + sh:maxCount 1; + sh:name "versionOfPath"@en; + sh:path + ], [ + sh:datatype xsd:boolean ; + sh:description "The object property that indicates whether the object has a default view."@en; + sh:maxCount 1; + sh:name "hasDefaultView"@en; + sh:path +] . + + +shsh: + rdfs:label "SHACL for SHACL"@en ; + rdfs:comment "This shapes graph can be used to validate SHACL shapes graphs against a subset of the syntax rules."@en ; + sh:declare [ + sh:prefix "shsh" ; + sh:namespace "http://www.w3.org/ns/shacl-shacl#" ; + ] . + + +shsh:ListShape + a sh:NodeShape ; + rdfs:label "List shape"@en ; + rdfs:comment "A shape describing well-formed RDF lists. Currently does not check for non-recursion. This could be expressed using SHACL-SPARQL."@en ; + rdfs:seeAlso ; + sh:property [ + sh:path [ sh:zeroOrMorePath rdf:rest ] ; + rdfs:comment "Each list member (including this node) must be have the shape shsh:ListNodeShape."@en ; + sh:hasValue rdf:nil ; + sh:node shsh:ListNodeShape ; + ] . + +shsh:ListNodeShape + a sh:NodeShape ; + rdfs:label "List node shape"@en ; + rdfs:comment "Defines constraints on what it means for a node to be a node within a well-formed RDF list. Note that this does not check whether the rdf:rest items are also well-formed lists as this would lead to unsupported recursion."@en ; + sh:or ( [ + sh:hasValue rdf:nil ; + sh:property [ + sh:path rdf:first ; + sh:maxCount 0 ; + ] ; + sh:property [ + sh:path rdf:rest ; + sh:maxCount 0 ; + ] ; + ] + [ + sh:not [ sh:hasValue rdf:nil ] ; + sh:property [ + sh:path rdf:first ; + sh:maxCount 1 ; + sh:minCount 1 ; + ] ; + sh:property [ + sh:path rdf:rest ; + sh:maxCount 1 ; + sh:minCount 1 ; + ] ; + ] ) . + +shsh:ShapeShape + a sh:NodeShape ; + rdfs:label "Shape shape"@en ; + rdfs:comment "A shape that can be used to validate syntax rules for other shapes."@en ; + + # See https://www.w3.org/TR/shacl/#shapes for what counts as a shape + sh:targetClass sh:NodeShape ; + sh:targetClass sh:PropertyShape ; + sh:targetSubjectsOf sh:targetClass, sh:targetNode, sh:targetObjectsOf, sh:targetSubjectsOf ; + sh:targetSubjectsOf sh:and, sh:class, sh:closed, sh:datatype, sh:disjoint, sh:equals, sh:flags, sh:hasValue, + sh:ignoredProperties, sh:in, sh:languageIn, sh:lessThan, sh:lessThanOrEquals, sh:maxCount, sh:maxExclusive, + sh:maxInclusive, sh:maxLength, sh:minCount, sh:minExclusive, sh:minInclusive, sh:minLength, sh:node, sh:nodeKind, + sh:not, sh:or, sh:pattern, sh:property, sh:qualifiedMaxCount, sh:qualifiedMinCount, sh:qualifiedValueShape, + sh:qualifiedValueShape, sh:qualifiedValueShapesDisjoint, sh:qualifiedValueShapesDisjoint, sh:sparql, sh:uniqueLang, sh:xone ; + + sh:targetObjectsOf sh:node ; # node-node + sh:targetObjectsOf sh:not ; # not-node + sh:targetObjectsOf sh:property ; # property-node + sh:targetObjectsOf sh:qualifiedValueShape ; # qualifiedValueShape-node + + # Shapes are either node shapes or property shapes + sh:xone ( shsh:NodeShapeShape shsh:PropertyShapeShape ) ; + + sh:property [ + sh:path sh:targetNode ; + sh:nodeKind sh:IRIOrLiteral ; # targetNode-nodeKind + ] ; + sh:property [ + sh:path sh:targetSubjectsOf ; + sh:nodeKind sh:IRI ; # targetSubjectsOf-nodeKind + ] ; + sh:property [ + sh:path sh:targetObjectsOf ; + sh:nodeKind sh:IRI ; # targetObjectsOf-nodeKind + ] ; + sh:or ( [ sh:not [ + sh:class rdfs:Class ; + sh:or ( [ sh:class sh:NodeShape ] [ sh:class sh:PropertyShape ] ) + ] ] + [ sh:nodeKind sh:IRI ] + ) ; # implicit-targetClass-nodeKind + + sh:property [ + sh:path sh:severity ; + sh:maxCount 1 ; # severity-maxCount + sh:nodeKind sh:IRI ; # severity-nodeKind + ] ; + sh:property [ + sh:path sh:message ; + sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ; # message-datatype + ] ; + sh:property [ + sh:path sh:deactivated ; + sh:maxCount 1 ; # deactivated-maxCount + sh:in ( true false ) ; # deactivated-datatype + ] ; + + sh:property [ + sh:path sh:and ; + sh:node shsh:ListShape ; # and-node + ] ; + sh:property [ + sh:path sh:class ; + sh:nodeKind sh:IRI ; # class-nodeKind + ] ; + sh:property [ + sh:path sh:closed ; + sh:datatype xsd:boolean ; # closed-datatype + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:ignoredProperties ; + sh:node shsh:ListShape ; # ignoredProperties-node + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path ( sh:ignoredProperties [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ; + sh:nodeKind sh:IRI ; # ignoredProperties-members-nodeKind + ] ; + sh:property [ + sh:path sh:datatype ; + sh:nodeKind sh:IRI ; # datatype-nodeKind + sh:maxCount 1 ; # datatype-maxCount + ] ; + sh:property [ + sh:path sh:disjoint ; + sh:nodeKind sh:IRI ; # disjoint-nodeKind + ] ; + sh:property [ + sh:path sh:equals ; + sh:nodeKind sh:IRI ; # equals-nodeKind + ] ; + sh:property [ + sh:path sh:in ; + sh:maxCount 1 ; # in-maxCount + sh:node shsh:ListShape ; # in-node + ] ; + sh:property [ + sh:path sh:languageIn ; + sh:maxCount 1 ; # languageIn-maxCount + sh:node shsh:ListShape ; # languageIn-node + ] ; + sh:property [ + sh:path ( sh:languageIn [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ; + sh:datatype xsd:string ; # languageIn-members-datatype + ] ; + sh:property [ + sh:path sh:lessThan ; + sh:nodeKind sh:IRI ; # lessThan-nodeKind + ] ; + sh:property [ + sh:path sh:lessThanOrEquals ; + sh:nodeKind sh:IRI ; # lessThanOrEquals-nodeKind + ] ; + sh:property [ + sh:path sh:maxCount ; + sh:datatype xsd:integer ; # maxCount-datatype + sh:maxCount 1 ; # maxCount-maxCount + ] ; + sh:property [ + sh:path sh:maxExclusive ; + sh:maxCount 1 ; # maxExclusive-maxCount + sh:nodeKind sh:Literal ; # maxExclusive-nodeKind + ] ; + sh:property [ + sh:path sh:maxInclusive ; + sh:maxCount 1 ; # maxInclusive-maxCount + sh:nodeKind sh:Literal ; # maxInclusive-nodeKind + ] ; + sh:property [ + sh:path sh:maxLength ; + sh:datatype xsd:integer ; # maxLength-datatype + sh:maxCount 1 ; # maxLength-maxCount + ] ; + sh:property [ + sh:path sh:minCount ; + sh:datatype xsd:integer ; # minCount-datatype + sh:maxCount 1 ; # minCount-maxCount + ] ; + sh:property [ + sh:path sh:minExclusive ; + sh:maxCount 1 ; # minExclusive-maxCount + sh:nodeKind sh:Literal ; # minExclusive-nodeKind + ] ; + sh:property [ + sh:path sh:minInclusive ; + sh:maxCount 1 ; # minInclusive-maxCount + sh:nodeKind sh:Literal ; # minInclusive-nodeKind + ] ; + sh:property [ + sh:path sh:minLength ; + sh:datatype xsd:integer ; # minLength-datatype + sh:maxCount 1 ; # minLength-maxCount + ] ; + sh:property [ + sh:path sh:nodeKind ; + sh:in ( sh:BlankNode sh:IRI sh:Literal sh:BlankNodeOrIRI sh:BlankNodeOrLiteral sh:IRIOrLiteral ) ; # nodeKind-in + sh:maxCount 1 ; # nodeKind-maxCount + ] ; + sh:property [ + sh:path sh:or ; + sh:node shsh:ListShape ; # or-node + ] ; + sh:property [ + sh:path sh:pattern ; + sh:datatype xsd:string ; # pattern-datatype + sh:maxCount 1 ; # multiple-parameters + # Not implemented: syntax rule pattern-regex + ] ; + sh:property [ + sh:path sh:flags ; + sh:datatype xsd:string ; # flags-datatype + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:qualifiedMaxCount ; + sh:datatype xsd:integer ; # qualifiedMaxCount-datatype + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:qualifiedMinCount ; + sh:datatype xsd:integer ; # qualifiedMinCount-datatype + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:qualifiedValueShape ; + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:qualifiedValueShapesDisjoint ; + sh:datatype xsd:boolean ; # qualifiedValueShapesDisjoint-datatype + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:uniqueLang ; + sh:datatype xsd:boolean ; # uniqueLang-datatype + sh:maxCount 1 ; # uniqueLang-maxCount + ] ; + sh:property [ + sh:path sh:xone ; + sh:node shsh:ListShape ; # xone-node + ] . + +shsh:NodeShapeShape + a sh:NodeShape ; + sh:targetObjectsOf sh:node ; # node-node + sh:property [ + sh:path sh:path ; + sh:maxCount 0 ; # NodeShape-path-maxCount + ] ; + sh:property [ + sh:path sh:lessThan ; + sh:maxCount 0 ; # lessThan-scope + ] ; + sh:property [ + sh:path sh:lessThanOrEquals ; + sh:maxCount 0 ; # lessThanOrEquals-scope + ] ; + sh:property [ + sh:path sh:maxCount ; + sh:maxCount 0 ; # maxCount-scope + ] ; + sh:property [ + sh:path sh:minCount ; + sh:maxCount 0 ; # minCount-scope + ] ; + sh:property [ + sh:path sh:qualifiedValueShape ; + sh:maxCount 0 ; # qualifiedValueShape-scope + ] ; + sh:property [ + sh:path sh:uniqueLang ; + sh:maxCount 0 ; # uniqueLang-scope + ] . + +shsh:PropertyShapeShape + a sh:NodeShape ; + sh:targetObjectsOf sh:property ; # property-node + sh:property [ + sh:path sh:path ; + sh:maxCount 1 ; # path-maxCount + sh:minCount 1 ; # PropertyShape-path-minCount + sh:node shsh:PathShape ; # path-node + ] . + +# Values of sh:and, sh:or and sh:xone must be lists of shapes +shsh:ShapesListShape + a sh:NodeShape ; + sh:targetObjectsOf sh:and ; # and-members-node + sh:targetObjectsOf sh:or ; # or-members-node + sh:targetObjectsOf sh:xone ; # xone-members-node + sh:property [ + sh:path ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ; + sh:node shsh:ShapeShape ; + ] . + + +# A path of blank node path syntax, used to simulate recursion +_:PathPath + sh:alternativePath ( + ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) + ( sh:alternativePath [ sh:zeroOrMorePath rdf:rest ] rdf:first ) + sh:inversePath + sh:zeroOrMorePath + sh:oneOrMorePath + sh:zeroOrOnePath + ) . + +shsh:PathShape + a sh:NodeShape ; + rdfs:label "Path shape"@en ; + rdfs:comment "A shape that can be used to validate the syntax rules of well-formed SHACL paths."@en ; + rdfs:seeAlso ; + sh:property [ + sh:path [ sh:zeroOrMorePath _:PathPath ] ; + sh:node shsh:PathNodeShape ; + ] . + +shsh:PathNodeShape + sh:xone ( # path-metarule + [ sh:nodeKind sh:IRI ] # 2.3.1.1: Predicate path + [ sh:nodeKind sh:BlankNode ; # 2.3.1.2: Sequence path + sh:node shsh:PathListWithAtLeast2Members ; + ] + [ sh:nodeKind sh:BlankNode ; # 2.3.1.3: Alternative path + sh:closed true ; + sh:property [ + sh:path sh:alternativePath ; + sh:node shsh:PathListWithAtLeast2Members ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] + ] + [ sh:nodeKind sh:BlankNode ; # 2.3.1.4: Inverse path + sh:closed true ; + sh:property [ + sh:path sh:inversePath ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] + ] + [ sh:nodeKind sh:BlankNode ; # 2.3.1.5: Zero-or-more path + sh:closed true ; + sh:property [ + sh:path sh:zeroOrMorePath ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] + ] + [ sh:nodeKind sh:BlankNode ; # 2.3.1.6: One-or-more path + sh:closed true ; + sh:property [ + sh:path sh:oneOrMorePath ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] + ] + [ sh:nodeKind sh:BlankNode ; # 2.3.1.7: Zero-or-one path + sh:closed true ; + sh:property [ + sh:path sh:zeroOrOnePath ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] + ] + ) . + +shsh:PathListWithAtLeast2Members + a sh:NodeShape ; + sh:node shsh:ListShape ; + sh:property [ + sh:path [ sh:oneOrMorePath rdf:rest ] ; + sh:minCount 2 ; # 1 other list node plus rdf:nil + ] . + +shsh:ShapesGraphShape + a sh:NodeShape ; + sh:targetObjectsOf sh:shapesGraph ; + sh:nodeKind sh:IRI . # shapesGraph-nodeKind + +shsh:EntailmentShape + a sh:NodeShape ; + sh:targetObjectsOf sh:entailment ; + sh:nodeKind sh:IRI . # entailment-nodeKind + + +# Close the world beyond the defined nodeshape. +test:additionalStatements + a sh:NodeShape ; + sh:closed true ; + sh:ignoredProperties (rdf:type) ; + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + SELECT ?this + WHERE { + VALUES (?type ) { + () + } + ?this ?p ?o . + FILTER NOT EXISTS { ?x_1 ?x_2 ?this } + FILTER NOT EXISTS { ?this a ?type } + } + """ ; + ] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/validation/shapeShaclShape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/validation/shapeShaclShape.ttl new file mode 100644 index 0000000000..32647dc19e --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/validation/shapeShaclShape.ttl @@ -0,0 +1,432 @@ +# baseURI: http://www.w3.org/ns/shacl-shacl# + +# A SHACL shapes graph to validate SHACL shapes graphs +# Draft last edited 2017-04-04 + +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix xsd: . + +@prefix shsh: . + +@prefix test: . + +shsh: + rdfs:label "SHACL for SHACL"@en ; + rdfs:comment "This shapes graph can be used to validate SHACL shapes graphs against a subset of the syntax rules."@en ; + sh:declare [ + sh:prefix "shsh" ; + sh:namespace "http://www.w3.org/ns/shacl-shacl#" ; + ] . + + +shsh:ListShape + a sh:NodeShape ; + rdfs:label "List shape"@en ; + rdfs:comment "A shape describing well-formed RDF lists. Currently does not check for non-recursion. This could be expressed using SHACL-SPARQL."@en ; + rdfs:seeAlso ; + sh:property [ + sh:path [ sh:zeroOrMorePath rdf:rest ] ; + rdfs:comment "Each list member (including this node) must be have the shape shsh:ListNodeShape."@en ; + sh:hasValue rdf:nil ; + sh:node shsh:ListNodeShape ; + ] . + +shsh:ListNodeShape + a sh:NodeShape ; + rdfs:label "List node shape"@en ; + rdfs:comment "Defines constraints on what it means for a node to be a node within a well-formed RDF list. Note that this does not check whether the rdf:rest items are also well-formed lists as this would lead to unsupported recursion."@en ; + sh:or ( [ + sh:hasValue rdf:nil ; + sh:property [ + sh:path rdf:first ; + sh:maxCount 0 ; + ] ; + sh:property [ + sh:path rdf:rest ; + sh:maxCount 0 ; + ] ; + ] + [ + sh:not [ sh:hasValue rdf:nil ] ; + sh:property [ + sh:path rdf:first ; + sh:maxCount 1 ; + sh:minCount 1 ; + ] ; + sh:property [ + sh:path rdf:rest ; + sh:maxCount 1 ; + sh:minCount 1 ; + ] ; + ] ) . + +shsh:ShapeShape + a sh:NodeShape ; + rdfs:label "Shape shape"@en ; + rdfs:comment "A shape that can be used to validate syntax rules for other shapes."@en ; + + # See https://www.w3.org/TR/shacl/#shapes for what counts as a shape + sh:targetClass sh:NodeShape ; + sh:targetClass sh:PropertyShape ; + sh:targetSubjectsOf sh:targetClass, sh:targetNode, sh:targetObjectsOf, sh:targetSubjectsOf ; + sh:targetSubjectsOf sh:and, sh:class, sh:closed, sh:datatype, sh:disjoint, sh:equals, sh:flags, sh:hasValue, + sh:ignoredProperties, sh:in, sh:languageIn, sh:lessThan, sh:lessThanOrEquals, sh:maxCount, sh:maxExclusive, + sh:maxInclusive, sh:maxLength, sh:minCount, sh:minExclusive, sh:minInclusive, sh:minLength, sh:node, sh:nodeKind, + sh:not, sh:or, sh:pattern, sh:property, sh:qualifiedMaxCount, sh:qualifiedMinCount, sh:qualifiedValueShape, + sh:qualifiedValueShape, sh:qualifiedValueShapesDisjoint, sh:qualifiedValueShapesDisjoint, sh:sparql, sh:uniqueLang, sh:xone ; + + sh:targetObjectsOf sh:node ; # node-node + sh:targetObjectsOf sh:not ; # not-node + sh:targetObjectsOf sh:property ; # property-node + sh:targetObjectsOf sh:qualifiedValueShape ; # qualifiedValueShape-node + + # Shapes are either node shapes or property shapes + sh:xone ( shsh:NodeShapeShape shsh:PropertyShapeShape ) ; + + sh:property [ + sh:path sh:targetNode ; + sh:nodeKind sh:IRIOrLiteral ; # targetNode-nodeKind + ] ; + sh:property [ + sh:path sh:targetClass ; + sh:nodeKind sh:IRI ; # targetClass-nodeKind + ] ; + sh:property [ + sh:path sh:targetSubjectsOf ; + sh:nodeKind sh:IRI ; # targetSubjectsOf-nodeKind + ] ; + sh:property [ + sh:path sh:targetObjectsOf ; + sh:nodeKind sh:IRI ; # targetObjectsOf-nodeKind + ] ; + sh:or ( [ sh:not [ + sh:class rdfs:Class ; + sh:or ( [ sh:class sh:NodeShape ] [ sh:class sh:PropertyShape ] ) + ] ] + [ sh:nodeKind sh:IRI ] + ) ; # implicit-targetClass-nodeKind + + sh:property [ + sh:path sh:severity ; + sh:maxCount 1 ; # severity-maxCount + sh:nodeKind sh:IRI ; # severity-nodeKind + ] ; + sh:property [ + sh:path sh:message ; + sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ; # message-datatype + ] ; + sh:property [ + sh:path sh:deactivated ; + sh:maxCount 1 ; # deactivated-maxCount + sh:in ( true false ) ; # deactivated-datatype + ] ; + + sh:property [ + sh:path sh:and ; + sh:node shsh:ListShape ; # and-node + ] ; + sh:property [ + sh:path sh:class ; + sh:nodeKind sh:IRI ; # class-nodeKind + ] ; + sh:property [ + sh:path sh:closed ; + sh:datatype xsd:boolean ; # closed-datatype + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:ignoredProperties ; + sh:node shsh:ListShape ; # ignoredProperties-node + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path ( sh:ignoredProperties [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ; + sh:nodeKind sh:IRI ; # ignoredProperties-members-nodeKind + ] ; + sh:property [ + sh:path sh:datatype ; + sh:nodeKind sh:IRI ; # datatype-nodeKind + sh:maxCount 1 ; # datatype-maxCount + ] ; + sh:property [ + sh:path sh:disjoint ; + sh:nodeKind sh:IRI ; # disjoint-nodeKind + ] ; + sh:property [ + sh:path sh:equals ; + sh:nodeKind sh:IRI ; # equals-nodeKind + ] ; + sh:property [ + sh:path sh:in ; + sh:maxCount 1 ; # in-maxCount + sh:node shsh:ListShape ; # in-node + ] ; + sh:property [ + sh:path sh:languageIn ; + sh:maxCount 1 ; # languageIn-maxCount + sh:node shsh:ListShape ; # languageIn-node + ] ; + sh:property [ + sh:path ( sh:languageIn [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ; + sh:datatype xsd:string ; # languageIn-members-datatype + ] ; + sh:property [ + sh:path sh:lessThan ; + sh:nodeKind sh:IRI ; # lessThan-nodeKind + ] ; + sh:property [ + sh:path sh:lessThanOrEquals ; + sh:nodeKind sh:IRI ; # lessThanOrEquals-nodeKind + ] ; + sh:property [ + sh:path sh:maxCount ; + sh:datatype xsd:integer ; # maxCount-datatype + sh:maxCount 1 ; # maxCount-maxCount + ] ; + sh:property [ + sh:path sh:maxExclusive ; + sh:maxCount 1 ; # maxExclusive-maxCount + sh:nodeKind sh:Literal ; # maxExclusive-nodeKind + ] ; + sh:property [ + sh:path sh:maxInclusive ; + sh:maxCount 1 ; # maxInclusive-maxCount + sh:nodeKind sh:Literal ; # maxInclusive-nodeKind + ] ; + sh:property [ + sh:path sh:maxLength ; + sh:datatype xsd:integer ; # maxLength-datatype + sh:maxCount 1 ; # maxLength-maxCount + ] ; + sh:property [ + sh:path sh:minCount ; + sh:datatype xsd:integer ; # minCount-datatype + sh:maxCount 1 ; # minCount-maxCount + ] ; + sh:property [ + sh:path sh:minExclusive ; + sh:maxCount 1 ; # minExclusive-maxCount + sh:nodeKind sh:Literal ; # minExclusive-nodeKind + ] ; + sh:property [ + sh:path sh:minInclusive ; + sh:maxCount 1 ; # minInclusive-maxCount + sh:nodeKind sh:Literal ; # minInclusive-nodeKind + ] ; + sh:property [ + sh:path sh:minLength ; + sh:datatype xsd:integer ; # minLength-datatype + sh:maxCount 1 ; # minLength-maxCount + ] ; + sh:property [ + sh:path sh:nodeKind ; + sh:in ( sh:BlankNode sh:IRI sh:Literal sh:BlankNodeOrIRI sh:BlankNodeOrLiteral sh:IRIOrLiteral ) ; # nodeKind-in + sh:maxCount 1 ; # nodeKind-maxCount + ] ; + sh:property [ + sh:path sh:or ; + sh:node shsh:ListShape ; # or-node + ] ; + sh:property [ + sh:path sh:pattern ; + sh:datatype xsd:string ; # pattern-datatype + sh:maxCount 1 ; # multiple-parameters + # Not implemented: syntax rule pattern-regex + ] ; + sh:property [ + sh:path sh:flags ; + sh:datatype xsd:string ; # flags-datatype + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:qualifiedMaxCount ; + sh:datatype xsd:integer ; # qualifiedMaxCount-datatype + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:qualifiedMinCount ; + sh:datatype xsd:integer ; # qualifiedMinCount-datatype + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:qualifiedValueShape ; + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:qualifiedValueShapesDisjoint ; + sh:datatype xsd:boolean ; # qualifiedValueShapesDisjoint-datatype + sh:maxCount 1 ; # multiple-parameters + ] ; + sh:property [ + sh:path sh:uniqueLang ; + sh:datatype xsd:boolean ; # uniqueLang-datatype + sh:maxCount 1 ; # uniqueLang-maxCount + ] ; + sh:property [ + sh:path sh:xone ; + sh:node shsh:ListShape ; # xone-node + ] . + +shsh:NodeShapeShape + a sh:NodeShape ; + sh:targetObjectsOf sh:node ; # node-node + sh:property [ + sh:path sh:path ; + sh:maxCount 0 ; # NodeShape-path-maxCount + ] ; + sh:property [ + sh:path sh:lessThan ; + sh:maxCount 0 ; # lessThan-scope + ] ; + sh:property [ + sh:path sh:lessThanOrEquals ; + sh:maxCount 0 ; # lessThanOrEquals-scope + ] ; + sh:property [ + sh:path sh:maxCount ; + sh:maxCount 0 ; # maxCount-scope + ] ; + sh:property [ + sh:path sh:minCount ; + sh:maxCount 0 ; # minCount-scope + ] ; + sh:property [ + sh:path sh:qualifiedValueShape ; + sh:maxCount 0 ; # qualifiedValueShape-scope + ] ; + sh:property [ + sh:path sh:uniqueLang ; + sh:maxCount 0 ; # uniqueLang-scope + ] . + +shsh:PropertyShapeShape + a sh:NodeShape ; + sh:targetObjectsOf sh:property ; # property-node + sh:property [ + sh:path sh:path ; + sh:maxCount 1 ; # path-maxCount + sh:minCount 1 ; # PropertyShape-path-minCount + sh:node shsh:PathShape ; # path-node + ] . + +# Values of sh:and, sh:or and sh:xone must be lists of shapes +shsh:ShapesListShape + a sh:NodeShape ; + sh:targetObjectsOf sh:and ; # and-members-node + sh:targetObjectsOf sh:or ; # or-members-node + sh:targetObjectsOf sh:xone ; # xone-members-node + sh:property [ + sh:path ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ; + sh:node shsh:ShapeShape ; + ] . + + +# A path of blank node path syntax, used to simulate recursion +_:PathPath + sh:alternativePath ( + ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) + ( sh:alternativePath [ sh:zeroOrMorePath rdf:rest ] rdf:first ) + sh:inversePath + sh:zeroOrMorePath + sh:oneOrMorePath + sh:zeroOrOnePath + ) . + +shsh:PathShape + a sh:NodeShape ; + rdfs:label "Path shape"@en ; + rdfs:comment "A shape that can be used to validate the syntax rules of well-formed SHACL paths."@en ; + rdfs:seeAlso ; + sh:property [ + sh:path [ sh:zeroOrMorePath _:PathPath ] ; + sh:node shsh:PathNodeShape ; + ] . + +shsh:PathNodeShape + sh:xone ( # path-metarule + [ sh:nodeKind sh:IRI ] # 2.3.1.1: Predicate path + [ sh:nodeKind sh:BlankNode ; # 2.3.1.2: Sequence path + sh:node shsh:PathListWithAtLeast2Members ; + ] + [ sh:nodeKind sh:BlankNode ; # 2.3.1.3: Alternative path + sh:closed true ; + sh:property [ + sh:path sh:alternativePath ; + sh:node shsh:PathListWithAtLeast2Members ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] + ] + [ sh:nodeKind sh:BlankNode ; # 2.3.1.4: Inverse path + sh:closed true ; + sh:property [ + sh:path sh:inversePath ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] + ] + [ sh:nodeKind sh:BlankNode ; # 2.3.1.5: Zero-or-more path + sh:closed true ; + sh:property [ + sh:path sh:zeroOrMorePath ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] + ] + [ sh:nodeKind sh:BlankNode ; # 2.3.1.6: One-or-more path + sh:closed true ; + sh:property [ + sh:path sh:oneOrMorePath ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] + ] + [ sh:nodeKind sh:BlankNode ; # 2.3.1.7: Zero-or-one path + sh:closed true ; + sh:property [ + sh:path sh:zeroOrOnePath ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] + ] + ) . + +shsh:PathListWithAtLeast2Members + a sh:NodeShape ; + sh:node shsh:ListShape ; + sh:property [ + sh:path [ sh:oneOrMorePath rdf:rest ] ; + sh:minCount 2 ; # 1 other list node plus rdf:nil + ] . + +shsh:ShapesGraphShape + a sh:NodeShape ; + sh:targetObjectsOf sh:shapesGraph ; + sh:nodeKind sh:IRI . # shapesGraph-nodeKind + +shsh:EntailmentShape + a sh:NodeShape ; + sh:targetObjectsOf sh:entailment ; + sh:nodeKind sh:IRI . # entailment-nodeKind + +# Close the world beyond the defined nodeshape. +test:additionalStatements + a sh:NodeShape ; + sh:closed true ; + sh:ignoredProperties (rdf:type) ; + sh:target [ + a sh:SPARQLTarget ; + sh:select """ + SELECT ?this + WHERE { + VALUES (?type ) { + () + } + ?this ?p ?o . + FILTER NOT EXISTS { ?x_1 ?x_2 ?this } + FILTER NOT EXISTS { ?this a ?type } + } + """ ; + ] . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/validation/viewShaclShape.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/validation/viewShaclShape.ttl new file mode 100644 index 0000000000..40a5fe4bf6 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/shacl/validation/viewShaclShape.ttl @@ -0,0 +1,90 @@ +@prefix sh: . +@prefix rdf: . +@prefix rdfs: . +@prefix schema: . +@prefix tree: . +@prefix xsd: . +@prefix ldes: . + +tree:ViewDescription + sh:order 1; + a sh:NodeShape ; + sh:property [ + sh:path tree:fragmentationStrategy ; + sh:name "List of fragmentations"; + sh:description "Ordered list of fragmentations how a member for this view should be processed"; + sh:or (tree:GeospatialFragmentation tree:HierarchicalTimeBasedFragmentation) ; + sh:minCount 1 ; + sh:maxCount 1 ; + ]; + sh:property [ + sh:path ldes:retentionPolicy; + sh:targetClass ldes:RetentionPolicy ; + sh:name "List of retention policies"; + sh:description "Unordered list of retention policies that declare when a member should be removed from the collection"; + ]. + +tree:GeospatialFragmentation + sh:order 2; + a sh:NodeShape; + sh:class tree:GeospatialFragmentation ; + sh:targetClass tree:GeospatialFragmentation ; + sh:property [ + sh:name "Max Zoom"; + sh:description "Maximal zoom level the fragmentation should go"; + sh:path tree:maxZoom ; + sh:datatype xsd:integer ; + sh:minInclusive 0 ; + sh:maxInclusive 23; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + sh:property tree:FragmentationPath . + +tree:HierarchicalTimeBasedFragmentation + sh:order 2 ; + a sh:NodeShape ; + sh:class: tree:HierarchicalTimeBasedFragmentation ; + sh:targetClass tree:HierarchicalTimeBasedFragmentation ; + sh:zeroOrOnePath true; + sh:property tree:FragmentationPath, tree:MaxGranularity, tree:FragmentSubjectFilter . + +tree:MaxGranularity + a sh:PropertyShape; + sh:name "Max Granularity" ; + sh:description "The depth level of the fragments" ; + sh:path tree:maxGranularity ; + sh:datatype xsd:string ; + sh:in ( "year" "month" "day" "hour" "minute" "second" ) ; + sh:minCount 1 ; + sh:maxCount 1 . + +tree:FragmentSubjectFilter + a sh:PropertyShape; + sh:name "Fragment Subject Filter" ; + sh:description "Regex to filter the subjects matching the fragmentationPath" ; + sh:path tree:fragmentSubjectFilter ; + sh:datatype xsd:string ; + sh:minCount 0 ; + sh:maxCount 1 . + +tree:MemberLimit + a sh:PropertyShape; + sh:name "Member Limit"; + sh:description "The amount of members allowed in one fragment"; + sh:path tree:memberLimit ; + sh:datatype xsd:integer ; + sh:minInclusive 1 ; + sh:minCount 1 ; + sh:maxCount 1 . + +tree:FragmentationPath + a sh:PropertyShape; + sh:name "Fragmentation Path"; + sh:description "Path the fragmentation should use to find the "; + sh:path tree:fragmentationPath ; + sh:nodeKind sh:IRI ; + sh:minCount 1 ; + sh:maxCount 1 . + + diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/another-view.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/another-view.ttl new file mode 100644 index 0000000000..228975adcb --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/another-view.ttl @@ -0,0 +1,19 @@ +@prefix ldes: . +@prefix tree: . +@prefix server: . +@prefix viewName: . + +viewName:description + a tree:ViewDescription ; + tree:pageSize "100"^^; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT10M"^^ ; + ] ; + tree:fragmentationStrategy ([ + a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + +server:view2 a tree:Node ; + tree:viewDescription . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-with-duplicate-retention.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-with-duplicate-retention.ttl new file mode 100644 index 0000000000..8894981e05 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-with-duplicate-retention.ttl @@ -0,0 +1,23 @@ +@prefix ldes: . +@prefix tree: . +@prefix server: . +@prefix viewName: . + +viewName:description + a tree:ViewDescription ; + tree:pageSize "100"^^; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT10M"^^ ; + ] ; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "P1D"^^ ; + ] ; + tree:fragmentationStrategy ([ + a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + +server:view1 a tree:Node ; + tree:viewDescription . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-with-hierarchical-timebased-frag.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-with-hierarchical-timebased-frag.ttl new file mode 100644 index 0000000000..ab8a22461c --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-with-hierarchical-timebased-frag.ttl @@ -0,0 +1,20 @@ +@prefix ldes: . +@prefix tree: . +@prefix server: . +@prefix viewName: . + +viewName:description + a tree:ViewDescription ; + tree:pageSize "100"^^; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT10M"^^ ; + ] ; + tree:fragmentationStrategy [ + a tree:HierarchicalTimeBasedFragmentation ; + tree:maxGranularity "day" ; + tree:fragmentationPath ; + ] . + + a tree:Node ; + tree:viewDescription . \ No newline at end of file diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-with-two-diff-retention.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-with-two-diff-retention.ttl new file mode 100644 index 0000000000..4c838d557b --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-with-two-diff-retention.ttl @@ -0,0 +1,23 @@ +@prefix ldes: . +@prefix tree: . +@prefix server: . +@prefix viewName: . + +viewName:description + a tree:ViewDescription ; + tree:pageSize "100"^^; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT10M"^^ ; + ] ; + ldes:retentionPolicy [ + a ldes:LatestVersionSubset ; + ldes:amount 2 ; + ] ; + tree:fragmentationStrategy ([ + a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + +server:view1 a tree:Node ; + tree:viewDescription . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-without-retention.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-without-retention.ttl new file mode 100644 index 0000000000..3a9305f159 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view-without-retention.ttl @@ -0,0 +1,15 @@ +@prefix ldes: . +@prefix tree: . +@prefix server: . +@prefix viewName: . + +viewName:description + a tree:ViewDescription ; + tree:pageSize "100"^^; + tree:fragmentationStrategy ([ + a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + +server:view1 a tree:Node ; + tree:viewDescription . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view.ttl new file mode 100644 index 0000000000..c21345af3e --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view.ttl @@ -0,0 +1,19 @@ +@prefix ldes: . +@prefix tree: . +@prefix server: . +@prefix viewName: . + +viewName:description + a tree:ViewDescription ; + tree:pageSize "100"^^; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT10M"^^ ; + ] ; + tree:fragmentationStrategy ([ + a tree:ExampleFragmentation ; + tree:property "ldes:propertyPath" + ]) . + +server:view1 a tree:Node ; + tree:viewDescription . diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view_multiple_fragmentations.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view_multiple_fragmentations.ttl new file mode 100644 index 0000000000..c769d1f891 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view_multiple_fragmentations.ttl @@ -0,0 +1,21 @@ +@prefix server: . +@prefix tree: . +@prefix viewName: . + +server:geospatial + a tree:Node ; + tree:viewDescription viewName:description . + +viewName:description + a tree:ViewDescription ; + tree:pageSize "100"^^; + tree:fragmentationStrategy ([ + a tree:GeospatialFragmentation ; + tree:maxZoom "15"; + tree:fragmentationPath "http://www.opengis.net/ont/geosparql#asWKT" + ] [ + a tree:HierarchicalTimeBasedFragmentation ; + tree:maxGranularity "day" ; + tree:fragmentationPath "http://www.w3.org/ns/prov#generatedAtTime" ; + ] ) . + diff --git a/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view_valid.ttl b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view_valid.ttl new file mode 100644 index 0000000000..21e3698051 --- /dev/null +++ b/ldes-server-admin/ldes-server-admin-rest/src/test/resources/view/view_valid.ttl @@ -0,0 +1,41 @@ +@prefix ldes: . +@prefix tree: . +@prefix dc: . +@prefix host: . +@prefix server: . +@prefix viewName: . +@prefix dcat: . +@prefix skos: . +@prefix xsd: . +@prefix rdfs: . + +server:viewName a tree:Node, rdfs:Resource ; + tree:viewDescription viewName:description . + +viewName:description + a dcat:DataService , tree:ViewDescription ; + tree:pageSize "100"^^; + tree:fragmentationStrategy + ([ a tree:ExampleFragmentation ; + tree:pageSize "100" ; + tree:property "example/property" + ]) ; + dc:description "Geospatial fragmentation for my LDES"@en ; + dc:identifier "http://localhost:8080/collection/viewName"^^rdfs:Literal ; + dc:title "My geo-spatial view"@en ; + dc:license + [ a dc:LicenseDocument ; + dc:type + [ a skos:Concept ; + skos:prefLabel "some public license"@en + ] + ] ; + ldes:retentionPolicy [ + a ldes:DurationAgoPolicy ; + tree:value "PT2M"^^xsd:duration ; + ] ; + dcat:endpointDescription ; + dcat:endpointURL server:viewName ; + dcat:servesDataset host:collection . + + a rdfs:Resource . \ No newline at end of file diff --git a/ldes-server-admin/pom.xml b/ldes-server-admin/pom.xml index 06a4f5217c..58cfe60fcf 100644 --- a/ldes-server-admin/pom.xml +++ b/ldes-server-admin/pom.xml @@ -1,102 +1,22 @@ - + 4.0.0 - ldes-server-admin be.vlaanderen.informatievlaanderen.vsds ldes-server - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - - - be.vlaanderen.informatievlaanderen.vsds - ldes-server-domain - - - io.swagger.core.v3 - swagger-annotations-jakarta - - - - - io.micrometer - micrometer-tracing-bridge-otel - - - io.micrometer - micrometer-registry-prometheus - - - org.springframework.boot - spring-boot-starter-aop - - - org.springframework.boot - spring-boot-starter-actuator - - - io.zipkin.reporter2 - zipkin-reporter-brave - - - com.github.loki4j - loki-logback-appender - + pom + ldes-server-admin - - - io.cucumber - cucumber-java - - - io.cucumber - cucumber-spring - - - io.cucumber - cucumber-junit-platform-engine - - - org.junit.platform - junit-platform-suite - - - org.awaitility - awaitility - test - + + ldes-server-admin-rest + ldes-server-admin-common + - - - org.jetbrains - annotations - - - com.google.guava - guava - ${google-guava.version} - - - - ${project.artifactId} - - - org.apache.maven.plugins - maven-assembly-plugin - - - \ No newline at end of file diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/entities/DcatDataset.java b/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/entities/DcatDataset.java deleted file mode 100644 index f24dcb8827..0000000000 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/dcat/dcatdataset/entities/DcatDataset.java +++ /dev/null @@ -1,77 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities; - -import org.apache.jena.rdf.model.*; - -import java.util.List; -import java.util.Objects; - -import static be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamConverterImpl.DATASET_TYPE; -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.*; -import static org.apache.jena.rdf.model.ModelFactory.createDefaultModel; -import static org.apache.jena.rdf.model.ResourceFactory.*; -import static org.apache.jena.util.ResourceUtils.renameResource; - -public class DcatDataset { - public static final Property TREE_SPECIFICATION = createProperty("https://w3id.org/tree/specification"); - public static final Property LDES_SPECIFICATION = createProperty("https://w3id.org/ldes/specification"); - - private final String collectionName; - private final Model model; - - public DcatDataset(String collectionName, Model model) { - this.collectionName = collectionName; - this.model = model; - } - - public DcatDataset(String collectionName) { - this(collectionName, createDefaultModel()); - } - - public String getCollectionName() { - return collectionName; - } - - public Model getModel() { - return model; - } - - public Model getModelWithIdentity(String hostname) { - String datasetIriString = getDatasetIriString(hostname); - Model modelWithIdentity = ModelFactory.createDefaultModel(); - modelWithIdentity.add(model); - modelWithIdentity.listStatements(null, RDF_SYNTAX_TYPE, createResource(DATASET_TYPE)).nextOptional() - .ifPresent(statement -> renameResource(statement.getSubject(), datasetIriString)); - modelWithIdentity.add(createResource(datasetIriString), DC_TERMS_IDENTIFIER, - modelWithIdentity.createTypedLiteral(datasetIriString, RDF_LITERAL)); - modelWithIdentity.add(createConformsToStatements(createResource(datasetIriString))); - return modelWithIdentity; - } - - public String getDatasetIriString(String hostName) { - return hostName + "/" + getCollectionName(); - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - DcatDataset that = (DcatDataset) o; - return Objects.equals(collectionName, that.getCollectionName()); - } - - @Override - public int hashCode() { - return Objects.hash(collectionName); - } - - private List createConformsToStatements(Resource datasetIri) { - return List.of( - createStatement(datasetIri, DC_CONFORMS_TO, TREE_SPECIFICATION), - createStatement(datasetIri, DC_CONFORMS_TO, LDES_SPECIFICATION), - createStatement(TREE_SPECIFICATION, RDF_SYNTAX_TYPE, DC_STANDARD), - createStatement(LDES_SPECIFICATION, RDF_SYNTAX_TYPE, DC_STANDARD) - ); - } -} diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiAdminEventStreamsController.java b/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiAdminEventStreamsController.java deleted file mode 100644 index 8401cabf47..0000000000 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/OpenApiAdminEventStreamsController.java +++ /dev/null @@ -1,241 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.controllers; - -import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.parameters.RequestBody; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.jena.rdf.model.Model; - -import java.util.List; - -import static org.apache.jena.riot.WebContent.*; - -@Tag(name = "Event Streams") -@SuppressWarnings("java:S2479") // whitespace needed for examples -public interface OpenApiAdminEventStreamsController { - @Operation(summary = "Retrieve list of configured Event Streams") - @ApiResponse(responseCode = "200", content = { - @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - @prefix ldes: . - @prefix dcterms: . - @prefix tree: . - @prefix sh: . - @prefix server: . - @prefix xsd: . - @prefix event-stream-1: . - @prefix event-stream-2: . - - server:event-stream-1 a ldes:EventStream ; - ldes:timestampPath dcterms:created ; - ldes:versionOfPath dcterms:isVersionOf ; - ldes:createVersions false ; - tree:shape event-stream-1:shape . - - server:event-stream-2 a ldes:EventStream ; - ldes:timestampPath dcterms:created ; - ldes:versionOfPath dcterms:isVersionOf ; - ldes:createVersions true ; - tree:shape event-stream-2:shape . - ldes:view event-stream-2:by-page . - - event-stream-2:by-page tree:viewDescription [ - tree:pageSize "100"^^ ; - tree:fragmentationStrategy () ; - ] . - - event-stream-1:shape a sh:NodeShape . - - event-stream-2:shape a sh:NodeShape . - """)), - @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - . - . - . - "false"^^ . - . - . - . - . - "true"^^ . - . - ""^^ . - _:genid1 "100"^^ . - _:genid1 . - _:genid1 . - . - . - """)), - @Content(mediaType = contentTypeJSONLD, examples = @ExampleObject(value = """ - [{"@id":"_:b0","https://w3id.org/tree#pageSize":[{"@value":"100","@type":"http://www.w3.org/2001/XMLSchema#int"}],"https://w3id.org/tree#fragmentationStrategy":[{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"}]},{"@id":"http://localhost:8080/event-stream-1","@type":["https://w3id.org/ldes#EventStream"],"https://w3id.org/ldes#timestampPath":[{"@id":"http://purl.org/dc/terms/created"}],"https://w3id.org/ldes#versionOfPath":[{"@id":"http://purl.org/dc/terms/isVersionOf"}],"https://w3id.org/ldes#createVersions":[{"@value":false}],"https://w3id.org/tree#shape":[{"@id":"http://localhost:8080/event-stream-1/shape"}]},{"@id":"http://localhost:8080/event-stream-1/shape","@type":["http://www.w3.org/ns/shacl#NodeShape"]},{"@id":"http://localhost:8080/event-stream-2","@type":["https://w3id.org/ldes#EventStream"],"https://w3id.org/ldes#timestampPath":[{"@id":"http://purl.org/dc/terms/created"}],"https://w3id.org/ldes#versionOfPath":[{"@id":"http://purl.org/dc/terms/isVersionOf"}],"https://w3id.org/ldes#createVersions":[{"@value":true}],"https://w3id.org/tree#shape":[{"@id":"http://localhost:8080/event-stream-2/shape"}]},{"@id":"http://localhost:8080/event-stream-2/by-page","https://w3id.org/tree#viewDescription":[{"@id":"_:b0"}]},{"@id":"http://localhost:8080/event-stream-2/shape","@type":["http://www.w3.org/ns/shacl#NodeShape"]},{"@id":"http://purl.org/dc/terms/created"},{"@id":"http://purl.org/dc/terms/isVersionOf"},{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"},{"@id":"http://www.w3.org/ns/shacl#NodeShape"},{"@id":"https://w3id.org/ldes#EventStream"},{"@id":"https://w3id.org/ldes#view","http://localhost:8080/event-stream-2/by-page":[{"@value":"","@type":"http://www.w3.org/2001/XMLSchema#integer"}]}] - """)) - }) - List getEventStreams(); - - @Operation(summary = "Create an Event Stream based on the provided config") - @ApiResponse(responseCode = "201", content = { - @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - @prefix ldes: . - @prefix dcterms: . - @prefix tree: . - @prefix sh: . - @prefix server: . - @prefix xsd: . - @prefix event-stream: . - - server:event-stream a ldes:EventStream ; - ldes:timestampPath dcterms:created ; - ldes:versionOfPath dcterms:isVersionOf ; - ldes:createVersions false ; - tree:shape event-stream:shape . - - event-stream:shape a sh:NodeShape . - """)), - @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - . - . - . - "false"^^ . - . - . - """)), - @Content(mediaType = contentTypeJSONLD, examples = @ExampleObject(value = """ - [{"@id":"http://localhost:8080/event-stream","@type":["https://w3id.org/ldes#EventStream"],"https://w3id.org/ldes#timestampPath":[{"@id":"http://purl.org/dc/terms/created"}],"https://w3id.org/ldes#versionOfPath":[{"@id":"http://purl.org/dc/terms/isVersionOf"}],"https://w3id.org/ldes#createVersions":[{"@value":false}],"https://w3id.org/tree#shape":[{"@id":"http://localhost:8080/event-stream/shape"}]},{"@id":"http://localhost:8080/event-stream/shape","@type":["http://www.w3.org/ns/shacl#NodeShape"]},{"@id":"http://purl.org/dc/terms/created"},{"@id":"http://purl.org/dc/terms/isVersionOf"},{"@id":"http://www.w3.org/ns/shacl#NodeShape"},{"@id":"https://w3id.org/ldes#EventStream"}] - """)) - }) - @ApiResponse(responseCode = "400", description = "The provided config is not valid", content = @Content) - EventStreamTO createEventStream( - @RequestBody(content = { - @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - @prefix ldes: . - @prefix dcterms: . - @prefix tree: . - @prefix sh: . - @prefix server: . - @prefix xsd: . - @prefix event-stream: . - - server:event-stream a ldes:EventStream ; - ldes:timestampPath dcterms:created ; - ldes:versionOfPath dcterms:isVersionOf ; - tree:shape event-stream:shape . - - event-stream:shape a sh:NodeShape . - """)), - @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - . - . - . - . - . - """)), - @Content(mediaType = contentTypeJSONLD, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - [{"@id":"http://localhost:8080/event-stream","@type":["https://w3id.org/ldes#EventStream"],"https://w3id.org/ldes#timestampPath":[{"@id":"http://purl.org/dc/terms/created"}],"https://w3id.org/ldes#versionOfPath":[{"@id":"http://purl.org/dc/terms/isVersionOf"}],"https://w3id.org/tree#shape":[{"@id":"http://localhost:8080/event-stream/shape"}]},{"@id":"http://localhost:8080/event-stream/shape","@type":["http://www.w3.org/ns/shacl#NodeShape"]},{"@id":"http://purl.org/dc/terms/created"},{"@id":"http://purl.org/dc/terms/isVersionOf"},{"@id":"http://www.w3.org/ns/shacl#NodeShape"},{"@id":"https://w3id.org/ldes#EventStream"}] - """)) - }) Model eventStreamModel); - - @Operation(summary = "Retrieve specific Event Stream configuration") - @ApiResponse(responseCode = "200", content = { - @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - @prefix ldes: . - @prefix dcterms: . - @prefix tree: . - @prefix sh: . - @prefix server: . - @prefix xsd: . - @prefix event-stream: . - - server:event-stream a ldes:EventStream ; - ldes:timestampPath dcterms:created ; - ldes:versionOfPath dcterms:isVersionOf ; - ldes:createVersions false ; - tree:shape event-stream:shape . - ldes:view event-stream:pagination . - - event-stream:pagination tree:viewDescription [ - tree:pageSize "100"^^ ; - tree:fragmentationStrategy () ; - ] . - - event-stream:shape a sh:NodeShape . - """)), - @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - . - . - . - "false"^^ . - . - ""^^ . - _:genid1 "100"^^ . - _:genid1 . - _:genid1 . - . - """)), - @Content(mediaType = contentTypeJSONLD, examples = @ExampleObject(value = """ - [{"@id":"_:b0","https://w3id.org/tree#pageSize":[{"@value":"100","@type":"http://www.w3.org/2001/XMLSchema#int"}],"https://w3id.org/tree#fragmentationStrategy":[{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"}]},{"@id":"http://localhost:8080/event-stream","@type":["https://w3id.org/ldes#EventStream"],"https://w3id.org/ldes#timestampPath":[{"@id":"http://purl.org/dc/terms/created"}],"https://w3id.org/ldes#versionOfPath":[{"@id":"http://purl.org/dc/terms/isVersionOf"}],"https://w3id.org/ldes#createVersions":[{"@value":false}],"https://w3id.org/tree#shape":[{"@id":"http://localhost:8080/event-stream/shape"}]},{"@id":"http://localhost:8080/event-stream/pagination","https://w3id.org/tree#viewDescription":[{"@id":"_:b0"}]},{"@id":"http://localhost:8080/event-stream/shape","@type":["http://www.w3.org/ns/shacl#NodeShape"]},{"@id":"http://purl.org/dc/terms/created"},{"@id":"http://purl.org/dc/terms/isVersionOf"},{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"},{"@id":"http://www.w3.org/ns/shacl#NodeShape"},{"@id":"https://w3id.org/ldes#EventStream"},{"@id":"https://w3id.org/ldes#view","http://localhost:8080/event-stream/pagination":[{"@value":"","@type":"http://www.w3.org/2001/XMLSchema#integer"}]}] - """)) - }) - @ApiResponse(responseCode = "404", description = "Event Stream with provided collection name could not be found", content = @Content) - EventStreamTO getEventStream(@Parameter(example = "event-stream") String collectionName); - - @Operation(summary = "Delete an Event Stream") - @ApiResponse(responseCode = "200", description = "Event Stream has been successfully deleted") - @ApiResponse(responseCode = "404", description = "Event Stream with provided collection name could not be found") - void deleteEventStream(@Parameter(example = "event-stream") String collectionName); - - @Operation(summary = "Close an Event Stream") - @ApiResponse(responseCode = "200", description = "Event Stream is successfully closed and all related fragments are made immutable") - @ApiResponse(responseCode = "404", description = "Event Stream with provided collection name could not be found") - void closeEventStream(@Parameter(example = "event-stream") String collectionName); - - @Operation(summary = "Update the Event Source of an Event Stream") - @ApiResponse(responseCode = "200", description = "Event Source has been successfully updated", content = { - @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - @prefix ldes: . - @prefix dcterms: . - @prefix tree: . - - <> a ldes:EventSource ; - ldes:retentionPolicy [ - a ldes:DurationAgoPolicy ; - tree:value "PT5S"^^ ; - ] . - """)), - @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - . - _:genid1 . - _:genid1 . - _:genid1 "PT5S"^^ . - """)), - @Content(mediaType = contentTypeJSONLD, examples = @ExampleObject(value = """ - [{"@id":"_:b0","@type":["https://w3id.org/ldes#DurationAgoPolicy"],"https://w3id.org/tree#value":[{"@value":"PT5S","@type":"http://www.w3.org/2001/XMLSchema#duration"}]},{"@id":"http://njh.me/","@type":["https://w3id.org/ldes#EventSource"],"https://w3id.org/ldes#retentionPolicy":[{"@id":"_:b0"}]},{"@id":"https://w3id.org/ldes#DurationAgoPolicy"},{"@id":"https://w3id.org/ldes#EventSource"}] - """))}) - @ApiResponse(responseCode = "404", description = "Event Stream with provided collection name could not be found") - void updateEventSource(@Parameter(example = "event-stream") String collectionName, - @RequestBody(content = { - @Content(mediaType = contentTypeTurtle, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - @prefix ldes: . - @prefix dcterms: . - @prefix tree: . - - <> a ldes:EventSource ; - ldes:retentionPolicy [ - a ldes:DurationAgoPolicy ; - tree:value "PT5S"^^ ; - ] . - """)), - @Content(mediaType = contentTypeNQuads, schema = @Schema(implementation = String.class), examples = @ExampleObject(value = """ - . - _:genid1 . - _:genid1 . - _:genid1 "PT5S"^^ . - """)), - @Content(mediaType = contentTypeJSONLD, examples = @ExampleObject(value = """ - [{"@id":"_:b0","@type":["https://w3id.org/ldes#DurationAgoPolicy"],"https://w3id.org/tree#value":[{"@value":"PT5S","@type":"http://www.w3.org/2001/XMLSchema#duration"}]},{"@id":"http://njh.me/","@type":["https://w3id.org/ldes#EventSource"],"https://w3id.org/ldes#retentionPolicy":[{"@id":"_:b0"}]},{"@id":"https://w3id.org/ldes#DurationAgoPolicy"},{"@id":"https://w3id.org/ldes#EventSource"}] - """)) - }) Model eventSourceModel); -} diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamConverter.java b/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamConverter.java deleted file mode 100644 index 31eb91d07b..0000000000 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamConverter.java +++ /dev/null @@ -1,9 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.admin.spi; - -import org.apache.jena.rdf.model.Model; - -public interface EventStreamConverter { - EventStreamTO fromModel(Model model); - - Model toModel(EventStreamTO eventStreamTO); -} diff --git a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamConverterImpl.java b/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamConverterImpl.java deleted file mode 100644 index f0c9b33b1a..0000000000 --- a/ldes-server-admin/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/spi/EventStreamConverterImpl.java +++ /dev/null @@ -1,212 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.admin.spi; - -import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.exceptions.MissingStatementException; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdder; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.rest.PrefixConstructor; -import org.apache.jena.rdf.model.*; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.*; -import static org.apache.commons.lang3.StringUtils.isNotBlank; -import static org.apache.jena.rdf.model.ModelFactory.createDefaultModel; -import static org.apache.jena.rdf.model.ResourceFactory.*; - -@Component -public class EventStreamConverterImpl implements EventStreamConverter { - - public static final String DCAT_PREFIX = "http://www.w3.org/ns/dcat#"; - public static final String DATASET_TYPE = DCAT_PREFIX + "Dataset"; - private final ViewSpecificationConverter viewSpecificationConverter; - private final RetentionModelExtractor retentionModelExtractor; - private final PrefixAdder prefixAdder; - private final PrefixConstructor prefixConstructor; - - public EventStreamConverterImpl(ViewSpecificationConverter viewSpecificationConverter, RetentionModelExtractor retentionModelExtractor, - PrefixAdder prefixAdder, PrefixConstructor prefixConstructor) { - this.viewSpecificationConverter = viewSpecificationConverter; - this.retentionModelExtractor = retentionModelExtractor; - this.prefixAdder = prefixAdder; - this.prefixConstructor = prefixConstructor; - } - - @Override - public EventStreamTO fromModel(Model model) { - final String collection = getIdentifier(model, createResource(EVENT_STREAM_TYPE)).map(Resource::getLocalName) - .orElseThrow(() -> new MissingStatementException("Not blank node with type " + EVENT_STREAM_TYPE)); - return new EventStreamTO.Builder() - .withCollection(collection) - .withTimestampPath(getResource(model, LDES_TIMESTAMP_PATH).orElse(null)) - .withVersionOfPath(getResource(model, LDES_VERSION_OF).orElse(null)) - .withVersionCreationEnabled(getBooleanResource(model, LDES_CREATE_VERSIONS).orElse(false)) - .withSkolemizationDomain(getResource(model, LDES_SKOLEMIZATION_DOMAIN).orElse(null)) - .withViews(getViews(model, collection)) - .withShacl(getShaclFromModel(model)) - .withEventSourceRetentionPolicies(getEventSourceRetentionPolicies(model)) - .build(); - } - - @Override - public Model toModel(EventStreamTO eventStreamTO) { - String prefix = prefixConstructor.buildPrefix(); - final Resource subject = getIRIFromCollectionName(eventStreamTO.getCollection(), prefix); - final Statement collectionNameStmt = createStatement(subject, RDF_SYNTAX_TYPE, createResource(EVENT_STREAM_TYPE)); - final Statement dcatTypeStmt = createStatement(subject, RDF_SYNTAX_TYPE, createResource(DATASET_TYPE)); - final Model dataset = eventStreamTO.getDcatDataset().getModelWithIdentity(prefix); - final List eventSourceStatements = getEventSourceStatements(eventStreamTO.getEventSourceRetentionPolicies(), subject); - - Model eventStreamModel = createDefaultModel() - .add(collectionNameStmt) - .add(dcatTypeStmt) - .add(getVersionOfStatements(subject, eventStreamTO)) - .add(getTimestampPathStatements(subject, eventStreamTO)) - .add(getCreateVersionsStatements(subject, eventStreamTO)) - .add(eventStreamTO.getShacl()) - .add(getViewReferenceStatements(eventStreamTO.getViews(), subject, prefix)) - .add(getViewStatements(eventStreamTO.getViews())) - .add(eventSourceStatements) - .add(dataset); - - Statement shaclStatement = getShaclReferenceStatement(eventStreamTO.getShacl(), subject); - - eventStreamModel.add(shaclStatement); - - return prefixAdder.addPrefixesToModel(eventStreamModel); - } - - private List getTimestampPathStatements(Resource subject, EventStreamTO eventStreamTO) { - if (isNotBlank(eventStreamTO.getVersionOfPath())) { - return List.of(createStatement(subject, LDES_TIMESTAMP_PATH, - createProperty(eventStreamTO.getTimestampPath()))); - } else { - return List.of(); - } - } - - private List getVersionOfStatements(Resource subject, EventStreamTO eventStreamTO) { - if (isNotBlank(eventStreamTO.getVersionOfPath())) { - return List.of(createStatement(subject, LDES_VERSION_OF, - createProperty(eventStreamTO.getVersionOfPath()))); - } else { - return List.of(); - } - } - - private List getCreateVersionsStatements(Resource subject, EventStreamTO eventStreamTO) { - return List.of( - createStatement(subject, LDES_CREATE_VERSIONS, createTypedLiteral(eventStreamTO.isVersionCreationEnabled())) - ); - } - - private List getViewReferenceStatements(List views, Resource subject, String prefix) { - return views.stream() - .map(ViewSpecification::getName) - .map(viewName -> createStatement(subject, createProperty(VIEW), - viewSpecificationConverter.getIRIFromViewName(viewName, prefix))) - .toList(); - } - - private List getViewStatements(List views) { - return views.stream() - .map(viewSpecificationConverter::modelFromView) - .flatMap(model -> model.listStatements().toList().stream()) - .toList(); - } - - private Statement getShaclReferenceStatement(Model shacl, Resource subject) { - return getIdentifier(shacl, createResource(NODE_SHAPE_TYPE)) - .map(resource -> createStatement(subject, TREE_SHAPE, resource)) - .orElse(createStatement(subject, TREE_MEMBER, createResource())); - } - - private List getEventSourceStatements(List eventSourceRetentionModels, Resource subject) { - List statements = new ArrayList<>(); - Resource eventSourceResource = createResource(); - statements.add( - createStatement(subject, LDES_EVENT_SOURCE, eventSourceResource)); - statements.add( - createStatement(eventSourceResource, RDF_SYNTAX_TYPE, createResource(LDES_EVENT_SOURCE_URI))); - eventSourceRetentionModels.forEach(retentionModel -> { - Resource retentionResource = createResource(); - retentionModel.listStatements().forEach(statement -> statements - .add(createStatement(retentionResource, statement.getPredicate(), statement.getObject()))); - statements.add( - createStatement(eventSourceResource, createProperty(RETENTION_TYPE), retentionResource)); - }); - return statements; - } - - private Resource getIRIFromCollectionName(String name, String prefix) { - return createResource(prefix + "/" + name); - } - - private Optional getIdentifier(Model model, Resource object) { - Optional stmtOptional = model.listStatements(null, RDF_SYNTAX_TYPE, object).nextOptional(); - return stmtOptional.map(Statement::getSubject); - } - - private Optional getResource(Model model, Property predicate) { - return model.listObjectsOfProperty(predicate) - .filterKeep(RDFNode::isResource) - .nextOptional() - .map(RDFNode::toString); - } - - private Optional getBooleanResource(Model model, Property predicate) { - return model.listStatements(null, predicate, (Resource) null) - .nextOptional() - .map(statement -> statement.getObject().asLiteral()) - .map(Literal::getBoolean); - } - - private Model getShaclFromModel(Model model) { - final Model shaclModel = ModelFactory.createDefaultModel(); - model.listStatements(null, TREE_SHAPE, (Resource) null) - .nextOptional() - .ifPresent(statement -> shaclModel.add(retrieveAllStatements(statement.getResource(), model))); - return shaclModel; - } - - private List getViews(Model model, String collection) { - return model.listStatements(null, createProperty(TREE_VIEW_DESCRIPTION), (Resource) null).toList().stream() - .map(statement -> { - List statements = retrieveAllStatements((Resource) statement.getObject(), model); - statements.add(statement); - return statements; - }) - .map(statements -> createDefaultModel().add(statements)) - .map(viewModel -> viewSpecificationConverter.viewFromModel(viewModel, collection)) - .toList(); - } - - private List getEventSourceRetentionPolicies(Model model) { - Optional eventSourceStatement = model.listStatements(null, LDES_EVENT_SOURCE, (RDFNode) null).nextOptional(); - if (eventSourceStatement.isEmpty()) { - return List.of(); - } else { - Model eventSourceModel = ModelFactory.createDefaultModel().add(retrieveAllStatements(eventSourceStatement.get().getResource(), model)); - return retentionModelExtractor.extractRetentionStatements(eventSourceModel); - } - } - - private List retrieveAllStatements(Resource resource, Model model) { - StmtIterator iterator = model.listStatements(resource, null, (Resource) null); - List statements = new ArrayList<>(); - - while (iterator.hasNext()) { - Statement statement = iterator.nextStatement(); - statements.add(statement); - - if (statement.getObject().isResource()) { - statements.addAll(retrieveAllStatements(statement.getResource(), model)); - } - } - - return statements; - } - -} diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamConverterImplTest.java b/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamConverterImplTest.java deleted file mode 100644 index f4e763a50b..0000000000 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/domain/eventstream/services/EventStreamConverterImplTest.java +++ /dev/null @@ -1,296 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities.DcatDataset; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.*; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdder; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdderImpl; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.FragmentationConfig; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.rest.PrefixConstructor; -import org.apache.commons.io.FileUtils; -import org.apache.jena.rdf.model.Model; -import org.apache.jena.rdf.model.RDFNode; -import org.apache.jena.riot.Lang; -import org.apache.jena.riot.RDFDataMgr; -import org.apache.jena.riot.RDFParser; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; -import org.springframework.util.ResourceUtils; - -import java.io.File; -import java.io.IOException; -import java.io.UncheckedIOException; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -import static org.apache.jena.rdf.model.ResourceFactory.*; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -class EventStreamConverterImplTest { - public static final String TIMESTAMP_PATH = "http://purl.org/dc/terms/created"; - public static final String VERSION_OF_PATH = "http://purl.org/dc/terms/isVersionOf"; - private EventStreamConverter eventStreamConverter; - private Model shacl; - private Model dataSetModel; - private List eventSourceRetentionModels; - - @BeforeEach - void setUp() throws URISyntaxException { - String hostName = "http://localhost:8080"; - PrefixConstructor prefixConstructor = new PrefixConstructor(hostName, false); - RetentionModelExtractor retentionModelExtractor = new RetentionModelExtractor(); - ViewSpecificationConverter viewSpecificationConverter = new ViewSpecificationConverter(retentionModelExtractor, - new FragmentationConfigExtractor(), prefixConstructor); - PrefixAdder prefixAdder = new PrefixAdderImpl(); - eventStreamConverter = new EventStreamConverterImpl(viewSpecificationConverter, retentionModelExtractor, prefixAdder, prefixConstructor); - shacl = readModelFromFile("shacl/collection-shape.ttl"); - dataSetModel = readModelFromFile("dcat/dataset/valid.ttl"); - Model retentionModel = readModelFromFile("retention/example_timebased.ttl"); - eventSourceRetentionModels = List.of(retentionModel); - } - - @Nested - class EventStreamWithViews { - private List views; - private Model eventStreamModel; - - - @BeforeEach - void setUp() throws URISyntaxException { - FragmentationConfig fragmentationConfig = new FragmentationConfig(); - fragmentationConfig.setName("ExampleFragmentation"); - fragmentationConfig.setConfig(Map.of("property", "ldes:propertyPath")); - views = List.of( - new ViewSpecification( - new ViewName("collectionName1", "view2"), - List.of(), - List.of(fragmentationConfig), 100), - new ViewSpecification( - new ViewName("collectionName1", "view1"), - List.of(), - List.of(fragmentationConfig), 100)); - eventStreamModel = readModelFromFile("eventstream/streams/ldes-with-named-views.ttl"); - } - - @Test - void when_modelHasViews_then_convertToEventStreamResponse() { - EventStreamTO expectedEventStreamTO = getBaseBuilder() - .withViews(views) - .withShacl(shacl) - .build(); - - EventStreamTO result = eventStreamConverter.fromModel(eventStreamModel); - - assertEquals(expectedEventStreamTO, result); - } - - @Test - void when_modelCreateVersions_then_convertToEventStreamResponse() { - EventStreamTO expectedEventStreamTO = getBaseBuilder() - .withViews(views) - .withShacl(shacl) - .withVersionCreationEnabled(true) - .build(); - eventStreamModel.remove(eventStreamModel.listStatements(null, - createProperty("https://w3id.org/ldes#createVersions"), (RDFNode) null)); - eventStreamModel.add(createResource("http://localhost:8080/collectionName1"), - createProperty("https://w3id.org/ldes#createVersions"), createTypedLiteral(true)); - - EventStreamTO result = eventStreamConverter.fromModel(eventStreamModel); - - assertEquals(expectedEventStreamTO, result); - } - - @Test - void when_eventStreamHasViews_then_convertToModel() { - final EventStreamTO eventStream = getBaseBuilder() - .withViews(views) - .withShacl(shacl) - .withEventSourceRetentionPolicies(eventSourceRetentionModels) - .build(); - - final Model convertedModel = eventStreamConverter.toModel(eventStream); - - assertThat(convertedModel).matches(eventStreamModel::isIsomorphicWith); - } - - private static EventStreamTO.Builder getBaseBuilder() { - return new EventStreamTO.Builder() - .withCollection("collectionName1") - .withTimestampPath(TIMESTAMP_PATH) - .withVersionOfPath(VERSION_OF_PATH); - } - } - - @Nested - class EventStreamWithoutViews { - private Model eventStreamModel; - - @BeforeEach - void setUp() throws URISyntaxException { - eventStreamModel = readModelFromFile("eventstream/streams/ldes-empty.ttl"); - } - - @Test - void when_modelHasNoViews_then_convertToEventStreamResponse() { - EventStreamTO expectedEventStreamTO = getBaseBuilder().withShacl(shacl).build(); - - assertEquals(expectedEventStreamTO, eventStreamConverter.fromModel(eventStreamModel)); - } - - @Test - void when_eventStreamResponseHasNoViews_then_convertToModel() { - final EventStreamTO eventStream = getBaseBuilder() - .withShacl(shacl) - .withEventSourceRetentionPolicies(eventSourceRetentionModels) - .build(); - final Model convertedModel = eventStreamConverter.toModel(eventStream); - assertThat(convertedModel).matches(eventStreamModel::isIsomorphicWith); - } - - @Test - void when_eventStreamCreateVersions_then_convertToModel() { - final EventStreamTO eventStream = getBaseBuilder() - .withShacl(shacl) - .withVersionCreationEnabled(true) - .withEventSourceRetentionPolicies(eventSourceRetentionModels) - .build(); - final Model convertedModel = eventStreamConverter.toModel(eventStream); - - eventStreamModel.remove(eventStreamModel.listStatements(null, - createProperty("https://w3id.org/ldes#createVersions"), (RDFNode) null)); - eventStreamModel.add(createResource("http://localhost:8080/collectionName1"), - createProperty("https://w3id.org/ldes#createVersions"), createTypedLiteral(true)); - - assertThat(convertedModel).matches(eventStreamModel::isIsomorphicWith); - } - - @Test - void when_eventStreamResponseHasTimestampAndVersionOf_then_convertToModel() { - EventStreamTO eventStream = getBaseBuilder() - .withShacl(shacl) - .withTimestampPath(null) - .withVersionOfPath(null) - .withEventSourceRetentionPolicies(eventSourceRetentionModels) - .build(); - - eventStreamModel.remove(eventStreamModel.listStatements(null, - createProperty("https://w3id.org/ldes#versionOfPath"), (RDFNode) null)); - eventStreamModel.remove(eventStreamModel.listStatements(null, - createProperty("https://w3id.org/ldes#timestampPath"), (RDFNode) null)); - - final Model convertedModel = eventStreamConverter.toModel(eventStream); - - assertThat(convertedModel).matches(eventStreamModel::isIsomorphicWith); - } - - private EventStreamTO.Builder getBaseBuilder() { - return new EventStreamTO.Builder() - .withCollection("collectionName1") - .withTimestampPath(TIMESTAMP_PATH) - .withVersionOfPath(VERSION_OF_PATH); - } - } - - @Nested - class EventStreamWithViewsAndDataset { - private List views; - private Model eventStreamModel; - - @BeforeEach - void setUp() throws URISyntaxException { - FragmentationConfig fragmentationConfig = new FragmentationConfig(); - fragmentationConfig.setName("ExampleFragmentation"); - fragmentationConfig.setConfig(Map.of("property", "ldes:propertyPath")); - views = List.of( - new ViewSpecification( - new ViewName("collectionName1", "view2"), - List.of(), - List.of(fragmentationConfig), 100), - new ViewSpecification( - new ViewName("collectionName1", "view1"), - List.of(), - List.of(fragmentationConfig), 100)); - - eventStreamModel = readModelFromFile("eventstream/streams/ldes-and-dataset-with-named-views.ttl"); - } - - @Test - void when_eventStreamHasViewsAndDataset_Then_ConvertToModel() { - String collectionName = "collectionName1"; - final EventStreamTO eventStream = new EventStreamTO.Builder() - .withCollection(collectionName) - .withTimestampPath(TIMESTAMP_PATH) - .withVersionOfPath(VERSION_OF_PATH) - .withVersionCreationEnabled(true) - .withViews(views) - .withShacl(shacl) - .withEventSourceRetentionPolicies(eventSourceRetentionModels) - .withDcatDataset(new DcatDataset(collectionName, dataSetModel)) - .build(); - final Model convertedModel = eventStreamConverter.toModel(eventStream); - - assertThat(convertedModel).matches(eventStreamModel::isIsomorphicWith); - } - } - - @Nested - class EventStreamWithSkoleminationDomain { - private static final String LDES_SKOLEMIZATION_DOMAIN_KEY = "#LDES_SKOLEMIZATION_DOMAIN_LINE"; - private static final String SKOLEMIZATION_DOMAIN = "http://example.org"; - - @Test - void given_ModelWithSkolemizationDomainLiteral_when_FromModel_then_ReturnEventStreamToWithSkolemizationDomain() { - final String modelString = readModelString() - .replace(LDES_SKOLEMIZATION_DOMAIN_KEY, "ldes:skolemizationDomain \"" + SKOLEMIZATION_DOMAIN + "\" ;"); - final Model model = RDFParser.fromString(modelString).lang(Lang.TTL).toModel(); - - final EventStreamTO eventStreamTO = eventStreamConverter.fromModel(model); - - assertThat(eventStreamTO.getSkolemizationDomain()).isNull(); - } - - @Test - void given_ModelWithSkolemizationDomainResource_when_FromModel_then_ReturnEventStreamToWithSkolemizationDomain() { - final String modelString = readModelString() - .replace(LDES_SKOLEMIZATION_DOMAIN_KEY, "ldes:skolemizationDomain <" + SKOLEMIZATION_DOMAIN + "> ;"); - final Model model = RDFParser.fromString(modelString).lang(Lang.TTL).toModel(); - - final EventStreamTO eventStreamTO = eventStreamConverter.fromModel(model); - - assertThat(eventStreamTO.getSkolemizationDomain()).isEqualTo(SKOLEMIZATION_DOMAIN); - } - - @Test - void given_ModelWithoutSkolemization_when_FromModel_then_ReturnEventStreamToWitouthSkolemizationDomain() { - final String modelString = readModelString().replace(LDES_SKOLEMIZATION_DOMAIN_KEY, ""); - final Model model = RDFParser.fromString(modelString).lang(Lang.TTL).toModel(); - - final EventStreamTO eventStreamTO = eventStreamConverter.fromModel(model); - - assertThat(eventStreamTO.getSkolemizationDomain()).isNull(); - } - - private String readModelString() { - try { - final File file = ResourceUtils.getFile("classpath:eventstream/streams/ldes-with-skol-dom.ttl"); - return FileUtils.readFileToString(file, StandardCharsets.UTF_8); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - } - - private Model readModelFromFile(String fileName) throws URISyntaxException { - ClassLoader classLoader = getClass().getClassLoader(); - String uri = Objects.requireNonNull(classLoader.getResource(fileName)).toURI().toString(); - return RDFDataMgr.loadModel(uri); - } - -} diff --git a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerSteps.java b/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerSteps.java deleted file mode 100644 index 96010276e8..0000000000 --- a/ldes-server-admin/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/rest/controllers/DcatDatasetRestControllerSteps.java +++ /dev/null @@ -1,112 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.controllers; - -import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatdataset.entities.DcatDataset; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.config.SpringIntegrationTest; -import io.cucumber.java.After; -import io.cucumber.java.en.And; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import org.apache.commons.io.FileUtils; -import org.apache.jena.rdf.model.Model; -import org.apache.jena.rdf.model.ModelFactory; -import org.apache.jena.riot.Lang; -import org.apache.jena.riot.RDFParser; -import org.springframework.test.web.servlet.ResultActions; -import org.springframework.util.ResourceUtils; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.Optional; - -import static be.vlaanderen.informatievlaanderen.ldes.server.admin.rest.controllers.DcatDatasetRestController.BASE_URL; -import static org.mockito.Mockito.*; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -public class DcatDatasetRestControllerSteps extends SpringIntegrationTest { - private final static String COLLECTION_NAME = "collectionName"; - private ResultActions resultActions; - private String datasetString; - - @After - public void cleanup() { - resourceRemover.removeUsedResources(); - } - - @Given("I have a valid dcat dataset") - public void iHaveAValidDcatDataset() throws Exception { - datasetString = readDataFromFile("dcat/dataset/valid.ttl"); - } - - @Given("I have a invalid dcat dataset") - public void iHaveAnInvalidDcatDataset() throws Exception { - datasetString = readDataFromFile("dcat/dataset/not-valid.ttl"); - } - - @When("I POST this dataset") - public void iCanPOSTThisDataset() throws Exception { - resultActions = mockMvc.perform(post(BASE_URL, COLLECTION_NAME) - .contentType(Lang.TURTLE.getHeaderString()) - .content(datasetString)); - } - - @When("I PUT this dataset") - public void iPUTThisDataset() throws Exception { - resultActions = mockMvc.perform(put(BASE_URL, COLLECTION_NAME) - .contentType(Lang.TURTLE.getHeaderString()) - .content(datasetString)); - } - - @When("I DELETE this dataset") - public void iDELETEThisDataservice() throws Exception { - resultActions = mockMvc.perform(delete(BASE_URL, COLLECTION_NAME)); - } - - private String readDataFromFile(String filename) throws IOException { - File file = ResourceUtils.getFile("classpath:" + filename); - return FileUtils.readFileToString(file, StandardCharsets.UTF_8); - } - - @And("The dataset will be stored") - public void theMetadataWillBeStored() { - Model model = RDFParser.fromString(datasetString).lang(Lang.TURTLE).build().toModel(); - DcatDataset dataset = new DcatDataset(COLLECTION_NAME, model); - verify(dcatDatasetRepository).saveDataset(dataset); - } - - @And("The dataset will not be stored") - public void theMetadataWillNotBeStored() { - Model model = RDFParser.fromString(datasetString).lang(Lang.TURTLE).build().toModel(); - DcatDataset dataset = new DcatDataset(COLLECTION_NAME, model); - verify(dcatDatasetRepository, never()).saveDataset(dataset); - } - - @Then("The dataset will be deleted") - public void theDataserviceMetadataWillBeDeleted() { - verify(dcatDatasetRepository, times(1)).deleteDataset(COLLECTION_NAME); - } - - @Then("The dataset will not be deleted") - public void theDataserviceMetadataWillNotBeDeleted() { - verify(dcatDatasetRepository, never()).deleteDataset(COLLECTION_NAME); - } - - @And("Response with http {int} will be returned for dataset") - public void responseWithHttpWillBeReturned(int httpCode) throws Exception { - resultActions.andExpect(status().is(httpCode)); - } - - @And("The dataset already exists") - public void theDataserviceAlreadyExists() { - when(dcatDatasetRepository.exitsByCollectionName(COLLECTION_NAME)).thenReturn(true); - when(dcatDatasetRepository.retrieveDataset(COLLECTION_NAME)).thenReturn(Optional.of(new DcatDataset(COLLECTION_NAME, ModelFactory.createDefaultModel()))); - } - - @And("The dataset does not yet exist") - public void theDataserviceDoesNotYetExist() { - when(dcatDatasetRepository.exitsByCollectionName(COLLECTION_NAME)).thenReturn(false); - } - -} diff --git a/ldes-server-application/pom.xml b/ldes-server-application/pom.xml index 0f939a6ef0..d06ac875f5 100644 --- a/ldes-server-application/pom.xml +++ b/ldes-server-application/pom.xml @@ -5,13 +5,22 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT ldes-server-application + + + be.vlaanderen.informatievlaanderen.vsds + postgres-liquibase + ${project.version} + + + + org.springframework.boot spring-boot-autoconfigure @@ -32,6 +41,10 @@ org.springframework.boot spring-boot-starter-aop + + io.pyroscope + agent + org.springframework.boot spring-boot-starter-actuator @@ -80,6 +93,19 @@ org.springframework.boot spring-boot-maven-plugin + + + com.github.ferstl + depgraph-maven-plugin + 4.0.3 + + true + compile + be.vlaanderen.informatievlaanderen.vsds* + be.vlaanderen.informatievlaanderen.vsds:*domain* + puml + + @@ -89,12 +115,7 @@ be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-ingest - ${project.version} - - - be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-ingest-rest + ldes-server-ingest-rest ${project.version} @@ -109,127 +130,77 @@ be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-fetch-rest - ${project.version} - - - - - fragmentation-geospatial - - - be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-geospatial + ldes-server-fetch-rest ${project.version} be.vlaanderen.informatievlaanderen.vsds - postgres-fragmentation-repository + postgres-fetch-repository ${project.version} - fragmentation-timebased-hierarchical + fragmentation be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-timebased-hierarchical - ${project.version} - - - be.vlaanderen.informatievlaanderen.vsds - postgres-fragmentation-repository - ${project.version} - - - - - fragmentation-reference - - - be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-reference - ${project.version} - - - be.vlaanderen.informatievlaanderen.vsds - postgres-fragmentation-repository + postgres-pagination-repository ${project.version} - pagination + fragmentation-geospatial be.vlaanderen.informatievlaanderen.vsds - ldes-server-pagination - ${project.version} - - - be.vlaanderen.informatievlaanderen.vsds - postgres-pagination-repository + ldes-server-fragmentation-geospatial ${project.version} - http-admin + fragmentation-timebased-hierarchical be.vlaanderen.informatievlaanderen.vsds - ldes-server-admin - ${project.version} - - - be.vlaanderen.informatievlaanderen.vsds - postgres-admin-repository + ldes-server-fragmentation-timebased-hierarchical ${project.version} - retention + fragmentation-reference be.vlaanderen.informatievlaanderen.vsds - ldes-server-retention - ${project.version} - - - be.vlaanderen.informatievlaanderen.vsds - postgres-retention-repository + ldes-server-fragmentation-reference ${project.version} - compaction + http-admin be.vlaanderen.informatievlaanderen.vsds - ldes-server-compaction + ldes-server-admin-rest ${project.version} - - - - instrumentation - be.vlaanderen.informatievlaanderen.vsds - ldes-server-instrumentation + postgres-admin-repository ${project.version} - liquibase-changesets + maintenance be.vlaanderen.informatievlaanderen.vsds - postgres-liquibase + postgres-maintenance-repository ${project.version} diff --git a/ldes-server-instrumentation/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/instrumentation/PyroscopeInitialiser.java b/ldes-server-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/instrumentation/PyroscopeInitialiser.java similarity index 100% rename from ldes-server-instrumentation/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/instrumentation/PyroscopeInitialiser.java rename to ldes-server-application/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/instrumentation/PyroscopeInitialiser.java diff --git a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionCandidateService.java b/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionCandidateService.java deleted file mode 100644 index 21ca0dc4d8..0000000000 --- a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionCandidateService.java +++ /dev/null @@ -1,49 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.compaction.domain.entities.ViewCapacity; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.CompactionCandidate; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories.PageRepository; -import org.springframework.stereotype.Component; - -import java.util.Collection; -import java.util.List; -import java.util.Set; - -import static be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services.CompactionCandidateSorter.getCompactionCandidateList; - -@Component -public class CompactionCandidateService { - private final PageRepository pageRepository; - - - public CompactionCandidateService(PageRepository pageRepository) { - this.pageRepository = pageRepository; - } - - /** - * Preparation step for the Compaction Service. - * Will retrieve an aggregated view of the allocation table where the size of members is lower than the - * maximum view capacity. - * If these fragments are connected, these will be returned in the same group. - * - * @param viewCapacity Contains the name and capacity for a view - * @return a structured group of Fragments for a view that can be compacted - */ - public Collection> getCompactionTaskList(ViewCapacity viewCapacity) { - List possibleCompactionCandidates = getPossibleCompactionCandidates(viewCapacity); - - if (possibleCompactionCandidates.isEmpty()) { - return List.of(); - } - - return getCompactionCandidateList(possibleCompactionCandidates, viewCapacity.getCapacityPerPage()); - } - - protected List getPossibleCompactionCandidates(ViewCapacity viewCapacity) { - var compactionCandidates = pageRepository.getPossibleCompactionCandidates(viewCapacity.getViewName(), viewCapacity.getCapacityPerPage()) - .toList(); - return compactionCandidates.stream() - .filter(CompactionCandidate::isCompactable) - .toList(); - } -} diff --git a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionCandidateSorter.java b/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionCandidateSorter.java deleted file mode 100644 index 2f4eff7a66..0000000000 --- a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionCandidateSorter.java +++ /dev/null @@ -1,56 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.CompactionCandidate; - -import java.util.*; -import java.util.concurrent.atomic.AtomicInteger; - -public class CompactionCandidateSorter { - private CompactionCandidateSorter() { - } - - public static Collection> getCompactionCandidateList(List candidatesList, int capacity) { - - List firstElements = candidatesList.stream() - .filter(candidate -> hasNoConnections(candidate, candidatesList.stream() - .toList())).toList(); - - AtomicInteger index = new AtomicInteger(); - Map> compactionDesign = new HashMap<>(); - - firstElements.forEach(candidate -> { - int currentCapacity = 0; - Set splitList = new HashSet<>(); - Optional currentCandidate = Optional.of(candidate); - while (currentCandidate.isPresent()) { - currentCapacity += currentCandidate.get().getSize(); - if (currentCapacity > capacity) { - currentCapacity = 0; - if(splitList.size() > 1) { - compactionDesign.put(index.incrementAndGet(), splitList); - splitList = new HashSet<>(); - } - } - else { - splitList.add(currentCandidate.get()); - } - long nextId = currentCandidate.get().getNextPageId(); - currentCandidate = candidatesList.stream().filter(c->c.getId() == nextId).findFirst(); - } - - if(splitList.size() > 1) { - compactionDesign.put(index.incrementAndGet(), splitList); - } - }); - - return compactionDesign.values(); - } - - public static boolean hasNoConnections(CompactionCandidate fragment, List fragments) { - return fragments.stream().noneMatch(fragment1 -> isConnectedTo(fragment1, fragment)); - } - - public static boolean isConnectedTo(CompactionCandidate treeNode, CompactionCandidate otherTreeNode) { - return treeNode.getNextPageId() == otherTreeNode.getId(); - } -} diff --git a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionScheduler.java b/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionScheduler.java deleted file mode 100644 index b2dad97f67..0000000000 --- a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionScheduler.java +++ /dev/null @@ -1,52 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.compaction.domain.repository.ViewCollection; -import be.vlaanderen.informatievlaanderen.ldes.server.retention.spi.RetentionPolicyEmptinessChecker; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Service; - -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.ServerConfig.COMPACTION_CRON_KEY; - -@Service -public class CompactionScheduler { - private static final Logger LOGGER = LoggerFactory.getLogger(CompactionScheduler.class); - private final ViewCollection viewCollection; - private final PaginationCompactionService paginationCompactionService; - private final CompactionCandidateService compactionCandidateService; - private final RetentionPolicyEmptinessChecker retentionPolicyEmptinessChecker; - - public CompactionScheduler(ViewCollection viewCollection, - PaginationCompactionService paginationCompactionService, - CompactionCandidateService compactionCandidateService, - RetentionPolicyEmptinessChecker retentionPolicyEmptinessChecker) { - this.viewCollection = viewCollection; - this.paginationCompactionService = paginationCompactionService; - this.compactionCandidateService = compactionCandidateService; - this.retentionPolicyEmptinessChecker = retentionPolicyEmptinessChecker; - } - - @SuppressWarnings("java:S6857") - @Scheduled(cron = COMPACTION_CRON_KEY) - public void compactFragments() { - if (retentionPolicyEmptinessChecker.isEmpty()) { - LOGGER.info("Compaction skipped: no retention policies found."); - return; - } - viewCollection.getAllViewCapacities() - .parallelStream() - .forEach(viewCapacity -> { - - var compactionTaskList = compactionCandidateService.getCompactionTaskList(viewCapacity); - - if (compactionTaskList.isEmpty()) { - LOGGER.info("No compaction candidates available for {}", viewCapacity.getViewName().getViewName()); - } else { - LOGGER.info("Processing {} compaction candidates available for {}", compactionTaskList.size(), viewCapacity.getViewName().getViewName()); - - compactionTaskList.forEach(paginationCompactionService::applyCompactionForFragments); - } - }); - } -} diff --git a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/FragmentDeletionScheduler.java b/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/FragmentDeletionScheduler.java deleted file mode 100644 index cc84ed01bd..0000000000 --- a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/FragmentDeletionScheduler.java +++ /dev/null @@ -1,34 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories.PageRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.retention.spi.RetentionPolicyEmptinessChecker; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; - -import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.ServerConfig.DELETION_CRON_KEY; - -@Service -public class FragmentDeletionScheduler { - private static final Logger LOGGER = LoggerFactory.getLogger(FragmentDeletionScheduler.class); - private final PageRepository pageRepository; - private final RetentionPolicyEmptinessChecker retentionPolicyEmptinessChecker; - - public FragmentDeletionScheduler(PageRepository pageRepository, RetentionPolicyEmptinessChecker retentionPolicyEmptinessChecker) { - this.pageRepository = pageRepository; - this.retentionPolicyEmptinessChecker = retentionPolicyEmptinessChecker; - } - - @SuppressWarnings("java:S6857") - @Scheduled(cron = DELETION_CRON_KEY) - public void deleteFragments() { - if(retentionPolicyEmptinessChecker.isEmpty()) { - LOGGER.atDebug().log("Fragment deletion skipped: no retention policies found."); - return; - } - pageRepository.deleteOutdatedFragments(LocalDateTime.now()); - } -} diff --git a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/FragmentationConfigCompaction.java b/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/FragmentationConfigCompaction.java deleted file mode 100644 index 0b79fad278..0000000000 --- a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/FragmentationConfigCompaction.java +++ /dev/null @@ -1,15 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.FragmentationStrategy; -import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.FragmentationStrategyImpl; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class FragmentationConfigCompaction { - - @Bean("compactionFragmentation") - public FragmentationStrategy compactionFragmentationStrategy() { - return new FragmentationStrategyImpl(); - } -} diff --git a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/PaginationCompactionService.java b/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/PaginationCompactionService.java deleted file mode 100644 index 632b902512..0000000000 --- a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/PaginationCompactionService.java +++ /dev/null @@ -1,43 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.compaction.domain.entities.CompactedFragmentCreator; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.CompactionCandidate; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories.PageRelationRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.retention.repositories.PageMemberRepository; -import io.micrometer.observation.Observation; -import io.micrometer.observation.ObservationRegistry; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Set; - -@Component -public class PaginationCompactionService { - private final PageRelationRepository pageRelationRepository; - private final PageMemberRepository pageMemberRepository; - private final CompactedFragmentCreator compactedFragmentCreator; - private final PageDeletionTimeSetter pageDeletionTimeSetter; - private final ObservationRegistry observationRegistry; - - public PaginationCompactionService(PageRelationRepository pageRelationRepository, PageMemberRepository pageMemberRepository, - CompactedFragmentCreator compactedFragmentCreator, PageDeletionTimeSetter pageDeletionTimeSetter, ObservationRegistry observationRegistry) { - this.pageRelationRepository = pageRelationRepository; - this.pageMemberRepository = pageMemberRepository; - this.compactedFragmentCreator = compactedFragmentCreator; - this.pageDeletionTimeSetter = pageDeletionTimeSetter; - this.observationRegistry = observationRegistry; - } - - public void applyCompactionForFragments(Set toBeCompactedFragments) { - Observation compactionObservation = Observation.createNotStarted("compaction", observationRegistry).start(); - - long compactedFragmentId = compactedFragmentCreator.createCompactedPage(toBeCompactedFragments); - List compactedPageIds = toBeCompactedFragments.stream().map(CompactionCandidate::getId).toList(); - - pageMemberRepository.setPageMembersToNewPage(compactedFragmentId, compactedPageIds); - pageRelationRepository.updateCompactionBucketRelations(compactedPageIds, compactedFragmentId); - pageDeletionTimeSetter.setDeleteTimeOfFragment(compactedPageIds); - - compactionObservation.stop(); - } -} diff --git a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/SchedulingConfigCompaction.java b/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/SchedulingConfigCompaction.java deleted file mode 100644 index 06292ce3e5..0000000000 --- a/ldes-server-compaction/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/SchedulingConfigCompaction.java +++ /dev/null @@ -1,10 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.annotation.EnableScheduling; - -@Configuration -@EnableScheduling -public class SchedulingConfigCompaction { - -} \ No newline at end of file diff --git a/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionCandidateServiceTest.java b/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionCandidateServiceTest.java deleted file mode 100644 index f45c5ee745..0000000000 --- a/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionCandidateServiceTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.compaction.domain.entities.ViewCapacity; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.CompactionCandidate; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories.PageRepository; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import java.time.LocalDateTime; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -class CompactionCandidateServiceTest { - PageRepository pagePostgresRepository = mock(PageRepository.class); - CompactionCandidateService service = new CompactionCandidateService(pagePostgresRepository); - - List candidates = List.of( - new CompactionCandidate(1L, 2, 2L, true, null, 1L, "/ex/p"), - new CompactionCandidate(2L, 3, 3L, true, null, 1L, "/ex/p"), - new CompactionCandidate(3L, 8, 4L, true, null, 1L, "/ex/p"), - new CompactionCandidate(4L, 3, 5L, true, null, 1L, "/ex/p"), - new CompactionCandidate(5L, 3, 6L, true, null, 1L, "/ex/p"), - new CompactionCandidate(6L, 2, 7L, true, LocalDateTime.now(), 1L, "/ex/p"), - new CompactionCandidate(7L, 2, 8L, false, null, 1L, "/ex/p") - ); - - @BeforeEach - void setup() { - when(pagePostgresRepository.getPossibleCompactionCandidates(any(), anyInt())) - .thenReturn(candidates.stream()); - } - - @Test - void testGetPossibleCompactionCandidates() { - var compactionCandidates = service.getPossibleCompactionCandidates( - new ViewCapacity(ViewName.fromString("ex/p"), 10)); - - assertEquals(5, compactionCandidates.size()); - assertEquals(1L, compactionCandidates.get(0).getId()); - assertEquals(2L, compactionCandidates.get(1).getId()); - assertEquals(3L, compactionCandidates.get(2).getId()); - assertEquals(4L, compactionCandidates.get(3).getId()); - assertEquals(5L, compactionCandidates.get(4).getId()); - } - - @Test - void testGetCompactionTaskList() { - var taskList = service.getCompactionTaskList(new ViewCapacity(ViewName.fromString("c/v"), 10)); - - assertEquals(2, taskList.size()); - - var firstCompaction = taskList.stream().toList().get(0); - assertEquals(2, firstCompaction.size()); - assertTrue(firstCompaction.stream().anyMatch(candidate -> candidate.getId() == 1L)); - assertTrue(firstCompaction.stream().anyMatch(candidate -> candidate.getId() == 2L)); - - var secondCompaction = taskList.stream().toList().get(1); - assertEquals(2, secondCompaction.size()); - assertTrue(secondCompaction.stream().anyMatch(candidate -> candidate.getId() == 4L)); - assertTrue(secondCompaction.stream().anyMatch(candidate -> candidate.getId() == 5L)); - } -} diff --git a/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionSchedulerTest.java b/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionSchedulerTest.java deleted file mode 100644 index 567a981286..0000000000 --- a/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/CompactionSchedulerTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.compaction.domain.repository.ViewCollection; -import be.vlaanderen.informatievlaanderen.ldes.server.retention.repositories.RetentionPolicyCollection; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import static org.mockito.Mockito.*; - -@ExtendWith(MockitoExtension.class) -class CompactionSchedulerTest { - @Mock - private ViewCollection viewCollection; - @Mock - private PaginationCompactionService paginationCompactionService; - @Mock - private CompactionCandidateService compactionCandidateService; - @Mock - private RetentionPolicyCollection retentionPolicyCollection; - - @InjectMocks - private CompactionScheduler compactionScheduler; - - - @Test - void given_RetentionPoliciesCollectionIsEmpty_when_CompactFragments_then_DoNotRun() { - when(retentionPolicyCollection.isEmpty()).thenReturn(true); - - compactionScheduler.compactFragments(); - - verify(retentionPolicyCollection).isEmpty(); - verifyNoMoreInteractions(viewCollection, paginationCompactionService, compactionCandidateService, retentionPolicyCollection); - } - - @Test - void given_RetentionPoliciesCollectionIsNotEmpty_when_CompactFragments_then_DoRun() { - when(retentionPolicyCollection.isEmpty()).thenReturn(false); - - compactionScheduler.compactFragments(); - - verify(retentionPolicyCollection).isEmpty(); - verify(viewCollection).getAllViewCapacities(); - verifyNoMoreInteractions(viewCollection, paginationCompactionService, compactionCandidateService, retentionPolicyCollection); - } - - -} \ No newline at end of file diff --git a/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/FragmentDeletionSchedulerTest.java b/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/FragmentDeletionSchedulerTest.java deleted file mode 100644 index 3a973f092d..0000000000 --- a/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/FragmentDeletionSchedulerTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories.PageRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.retention.spi.RetentionPolicyEmptinessChecker; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import static org.mockito.Mockito.*; - -@ExtendWith(MockitoExtension.class) -class FragmentDeletionSchedulerTest { - @Mock - private RetentionPolicyEmptinessChecker retentionPolicyEmptinessChecker; - @Mock - private PageRepository pageRepository; - private FragmentDeletionScheduler fragmentDeletionScheduler; - - @BeforeEach - void setUp() { - fragmentDeletionScheduler = new FragmentDeletionScheduler(pageRepository, retentionPolicyEmptinessChecker); - } - - @Test - void when_FragmentHasDeleteTimeEarlierThanCurrentTime_then_ItIsDeletedAndEventIsSent() { - when(retentionPolicyEmptinessChecker.isEmpty()).thenReturn(false); - - fragmentDeletionScheduler.deleteFragments(); - - verify(pageRepository).deleteOutdatedFragments(any()); - } - - @Test - void given_RetentionPolicyCollectionIsEmpty_when_CompactFragments_then_DoNotRun() { - when(retentionPolicyEmptinessChecker.isEmpty()).thenReturn(true); - - fragmentDeletionScheduler.deleteFragments(); - - verifyNoInteractions(pageRepository); - } -} \ No newline at end of file diff --git a/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/PaginationCompactionServiceTest.java b/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/PaginationCompactionServiceTest.java deleted file mode 100644 index f175853530..0000000000 --- a/ldes-server-compaction/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/compaction/application/services/PaginationCompactionServiceTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.compaction.application.services; - -import be.vlaanderen.informatievlaanderen.ldes.server.compaction.domain.entities.CompactedFragmentCreator; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.CompactionCandidate; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories.PageRelationRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.retention.repositories.PageMemberRepository; -import io.micrometer.observation.ObservationRegistry; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.InOrder; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static org.mockito.Mockito.*; - -class PaginationCompactionServiceTest { - private final PageRelationRepository pageRelationRepository = mock(PageRelationRepository.class); - private final PageMemberRepository pageMemberRepository = mock(PageMemberRepository.class); - private final CompactedFragmentCreator compactedFragmentCreator = mock(CompactedFragmentCreator.class); - private final PageDeletionTimeSetter pageDeletionTimeSetter = mock(PageDeletionTimeSetter.class); - private final ObservationRegistry observationRegistry = ObservationRegistry.create(); - private PaginationCompactionService paginationCompactionService; - private Set candidates; - - @BeforeEach - void setUp() { - candidates = new HashSet<>(); - paginationCompactionService = new PaginationCompactionService(pageRelationRepository, pageMemberRepository, - compactedFragmentCreator, pageDeletionTimeSetter, observationRegistry); - } - - @Test - void when_CompactPages_Then_PagesAreCompacted() { - List ids = List.of(3L, 2L, 1L); - long newId = 10L; - candidates.add(new CompactionCandidate(1L, 5, 2L, true, - null, 1L, "http://example.com")); - candidates.add(new CompactionCandidate(2L, 5, 3L, true, - null, 1L, "http://example.com")); - candidates.add(new CompactionCandidate(3L, 5, 4L, true, - null, 1L, "http://example.com")); - when(compactedFragmentCreator.createCompactedPage(candidates)).thenReturn(newId); - - paginationCompactionService.applyCompactionForFragments(candidates); - - InOrder inOrder = inOrder(pageRelationRepository, pageMemberRepository, - compactedFragmentCreator, pageDeletionTimeSetter); - inOrder.verify(compactedFragmentCreator).createCompactedPage(candidates); - inOrder.verify(pageMemberRepository).setPageMembersToNewPage(newId, ids); - inOrder.verify(pageRelationRepository).updateCompactionBucketRelations(ids, newId); - inOrder.verify(pageDeletionTimeSetter).setDeleteTimeOfFragment(ids); - inOrder.verifyNoMoreInteractions(); - } -} \ No newline at end of file diff --git a/ldes-server-domain/pom.xml b/ldes-server-domain/pom.xml index e9c9c7d654..91adc29ce1 100644 --- a/ldes-server-domain/pom.xml +++ b/ldes-server-domain/pom.xml @@ -5,7 +5,7 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT ldes-server-domain diff --git a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/RdfConstants.java b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/RdfConstants.java index 9e0df84149..63ec22d858 100644 --- a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/RdfConstants.java +++ b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/RdfConstants.java @@ -26,6 +26,7 @@ private RdfConstants() { public static final Property LDES_VERSION_OF = createProperty(LDES, "versionOfPath"); public static final Property LDES_TIMESTAMP_PATH = createProperty(LDES, "timestampPath"); public static final Property LDES_CREATE_VERSIONS = createProperty(LDES, "createVersions"); + public static final Property LDES_VERSION_DELIMITER = createProperty(LDES, "versionDelimiter"); public static final Property LDES_EVENT_SOURCE = createProperty(LDES, "eventSource"); public static final Property LDES_SKOLEMIZATION_DOMAIN = createProperty(LDES, "skolemizationDomain"); public static final String RDF_SYNTAX = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; diff --git a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConfig.java b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConfig.java index 524637185c..679079cbfa 100644 --- a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConfig.java +++ b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConfig.java @@ -12,18 +12,16 @@ public class ServerConfig { private static final String DEFAULT_USE_RELATIVE_URL = "false"; private static final String DEFAULT_MAX_JSONLD_CACHE_CAPACITY = "100"; public static final String HOST_NAME_KEY = "${ldes-server.host-name}"; - public static final String RETENTION_CRON_KEY = "${ldes-server.retention-cron: " + DEFAULT_BACKGROUND_CRON + "}"; - public static final String DELETION_CRON_KEY = "${ldes-server.deletion-cron:" + DEFAULT_BACKGROUND_CRON + "}"; - public static final String COMPACTION_CRON_KEY = "${ldes-server.compaction-cron:" + DEFAULT_BACKGROUND_CRON + "}"; + public static final String MAINTENANCE_CRON_KEY = "${ldes-server.maintenance-cron: " + DEFAULT_BACKGROUND_CRON + "}"; public static final String FRAGMENTATION_CRON = "${ldes-server.fragmentation-cron:" + DEFAULT_FRAGMENTATION_CRON + "}"; public static final String USE_RELATIVE_URL_KEY = "${ldes-server.use-relative-url:" + DEFAULT_USE_RELATIVE_URL + "}"; public static final String MAX_JSONLD_CACHE_CAPACITY = "${ldes-server.max-jsonld-cache-capacity:" + DEFAULT_MAX_JSONLD_CACHE_CAPACITY + "}"; + private String hostName; private String compactionDuration; - private String retentionCron; - private String deletionCron; - private String compactionCron; + private String maintenanceCron; + private String fragmentationCron; private Boolean useRelativeUrl; private Integer maxJsonldCacheCapacity; @@ -35,16 +33,12 @@ public String getCompactionDuration() { return compactionDuration != null ? compactionDuration : DEFAULT_COMPACTION_DURATION; } - public String getRetentionCron() { - return retentionCron != null ? retentionCron : DEFAULT_BACKGROUND_CRON; - } - - public String getDeletionCron() { - return deletionCron != null ? deletionCron : DEFAULT_BACKGROUND_CRON; + public String getMaintenanceCron() { + return maintenanceCron != null ? maintenanceCron : DEFAULT_BACKGROUND_CRON; } - public String getCompactionCron() { - return compactionCron != null ? compactionCron : DEFAULT_BACKGROUND_CRON; + public String getFragmentationCron() { + return fragmentationCron != null ? fragmentationCron : DEFAULT_FRAGMENTATION_CRON; } public Boolean getUseRelativeUrl() { @@ -63,16 +57,12 @@ public void setCompactionDuration(String compactionDuration) { this.compactionDuration = compactionDuration; } - public void setRetentionCron(String retentionCron) { - this.retentionCron = retentionCron; - } - - public void setDeletionCron(String deletionCron) { - this.deletionCron = deletionCron; + public void setMaintenanceCron(String maintenanceCron) { + this.maintenanceCron = maintenanceCron; } - public void setCompactionCron(String compactionCron) { - this.compactionCron = compactionCron; + public void setFragmentationCron(String fragmentationCron) { + this.fragmentationCron = fragmentationCron; } public void setUseRelativeUrl(Boolean useRelativeUrl) { diff --git a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConstants.java b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConstants.java index 5ea1266e0f..2bde9da1ef 100644 --- a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConstants.java +++ b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConstants.java @@ -17,4 +17,6 @@ private ServerConstants() { Lang.RDFPROTO, Lang.RDFTHRIFT ); + + public static final Lang SERIALISATION_LANG = Lang.RDFPROTO; } diff --git a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/LocalDateTimeConverter.java b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/LocalDateTimeConverter.java index 2bb4799a88..fc066c7deb 100644 --- a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/LocalDateTimeConverter.java +++ b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/LocalDateTimeConverter.java @@ -1,11 +1,17 @@ package be.vlaanderen.informatievlaanderen.ldes.server.domain.converter; import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.datatypes.xsd.XSDDatatype; import org.apache.jena.datatypes.xsd.XSDDateTime; import org.apache.jena.rdf.model.Literal; import java.time.LocalDateTime; import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeFormatterBuilder; +import java.time.temporal.TemporalAccessor; import java.util.Calendar; import java.util.TimeZone; @@ -13,10 +19,33 @@ public class LocalDateTimeConverter { public LocalDateTime getLocalDateTime(Literal literal) { RDFDatatype datatype = literal.getDatatype(); - XSDDateTime parse = (XSDDateTime) datatype.parse(literal.getValue().toString()); - Calendar calendar = parse.asCalendar(); + if (XSDDatatype.XSDdateTime.equals(datatype)) { + XSDDateTime dateTime = (XSDDateTime) literal.getValue(); + return fromXsdDateTime(dateTime); + } + if (XSDDatatype.XSDstring.equals(datatype)) { + return fromString(literal.getString()); + } + throw new IllegalArgumentException("Provided datatype cannot be used for conversion: " + datatype); + } + + private LocalDateTime fromXsdDateTime(XSDDateTime dateTime) { + Calendar calendar = dateTime.asCalendar(); TimeZone tz = calendar.getTimeZone(); ZoneId zoneId = tz.toZoneId(); return LocalDateTime.ofInstant(calendar.toInstant(), zoneId); } + + private LocalDateTime fromString(String dateTime) { + final DateTimeFormatter formatter = new DateTimeFormatterBuilder() + .append(DateTimeFormatter.ISO_LOCAL_DATE_TIME) + .appendPattern("[XXX][X]") + .toFormatter(); + TemporalAccessor temporalAccessor = formatter.parseBest(dateTime, ZonedDateTime::from, LocalDateTime::from); + return switch (temporalAccessor) { + case ZonedDateTime zonedDateTime -> zonedDateTime.withZoneSameInstant(ZoneOffset.UTC).toLocalDateTime(); + case LocalDateTime localDateTime -> localDateTime; + default -> throw new IllegalArgumentException("Could not parse date time: " + dateTime); + }; + } } diff --git a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/RetentionModelSerializer.java b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/RetentionModelSerializer.java index 5b7e1b12fe..15ebfb4e68 100644 --- a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/RetentionModelSerializer.java +++ b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/RetentionModelSerializer.java @@ -19,9 +19,7 @@ public List serialize(List models) { public List deserialize(List retentionPolicies) { return retentionPolicies .stream() - .map(retentionModel -> RDFParser.fromString(retentionModel) - .lang(dbSavedLang) - .toModel()) + .map(retentionModel -> RDFParser.create().fromString(retentionModel).lang(dbSavedLang).toModel()) .toList(); } } diff --git a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/encodig/CharsetEncodingConfig.java b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/encodig/CharsetEncodingConfig.java new file mode 100644 index 0000000000..6cae4bc215 --- /dev/null +++ b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/encodig/CharsetEncodingConfig.java @@ -0,0 +1,16 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.domain.encodig; + +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class CharsetEncodingConfig { + @Bean + public FilterRegistrationBean registerCharsetFilter() { + FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean<>(); + filterRegistrationBean.setFilter(new CharsetFilter()); + filterRegistrationBean.addUrlPatterns("/*"); + return filterRegistrationBean; + } +} diff --git a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/encodig/CharsetFilter.java b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/encodig/CharsetFilter.java new file mode 100644 index 0000000000..488be18c8d --- /dev/null +++ b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/encodig/CharsetFilter.java @@ -0,0 +1,14 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.domain.encodig; + +import jakarta.servlet.*; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +public class CharsetFilter implements Filter { + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + response.setCharacterEncoding(StandardCharsets.UTF_8.name()); + chain.doFilter(request, response); + } +} diff --git a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/model/EventStream.java b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/model/EventStream.java index f963b88e6c..e5910ba5eb 100644 --- a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/model/EventStream.java +++ b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/model/EventStream.java @@ -8,34 +8,36 @@ public class EventStream { private final String collection; private final String timestampPath; private final String versionOfPath; - private final boolean versionCreationEnabled; + private final VersionCreationProperties versionCreationProperties; private final boolean isClosed; private final String skolemizationDomain; public EventStream(String collection, String timestampPath, String versionOfPath, - boolean versionCreationEnabled) { - this(collection, timestampPath, versionOfPath, versionCreationEnabled, false, null); + VersionCreationProperties versionCreationProperties) { + this(collection, timestampPath, versionOfPath, versionCreationProperties, false, null); } public EventStream(String collection, String timestampPath, String versionOfPath, - boolean versionCreationEnabled, String skolemizationDomain) { - this(collection, timestampPath, versionOfPath, versionCreationEnabled, false, skolemizationDomain); + VersionCreationProperties versionCreationProperties, + String skolemizationDomain) { + this(collection, timestampPath, versionOfPath, versionCreationProperties, false, skolemizationDomain); } public EventStream(String collection, String timestampPath, String versionOfPath, - boolean versionCreationEnabled, - boolean isClosed, String skolemizationDomain) { + VersionCreationProperties versionCreationProperties, + boolean isClosed, + String skolemizationDomain) { this.collection = collection; this.timestampPath = timestampPath; this.versionOfPath = versionOfPath; - this.versionCreationEnabled = versionCreationEnabled; - this.isClosed = isClosed; + this.versionCreationProperties = versionCreationProperties; + this.isClosed = isClosed; this.skolemizationDomain = skolemizationDomain; } @@ -51,8 +53,16 @@ public String getVersionOfPath() { return versionOfPath; } + public VersionCreationProperties getVersionCreationProperties() { + return versionCreationProperties; + } + + public String getVersionDelimiter() { + return versionCreationProperties.getVersionDelimiter(); + } + public boolean isVersionCreationEnabled() { - return versionCreationEnabled; + return versionCreationProperties.isVersionCreationEnabled(); } public boolean isClosed() { diff --git a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/model/VersionCreationProperties.java b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/model/VersionCreationProperties.java new file mode 100644 index 0000000000..fc216e8e58 --- /dev/null +++ b/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/model/VersionCreationProperties.java @@ -0,0 +1,43 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.domain.model; + +import java.util.Objects; + +public final class VersionCreationProperties { + private final String versionDelimiter; + + private VersionCreationProperties(String versionDelimiter) { + this.versionDelimiter = versionDelimiter; + } + + public String getVersionDelimiter() { + return versionDelimiter; + } + + public boolean isVersionCreationEnabled() { + return versionDelimiter != null; + } + + public static VersionCreationProperties disabled() { + return new VersionCreationProperties(null); + } + + public static VersionCreationProperties enabledWithDefault() { + return new VersionCreationProperties("/"); + } + + public static VersionCreationProperties ofNullableDelimiter(String versionDelimiter) { + return new VersionCreationProperties(versionDelimiter); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof VersionCreationProperties that)) return false; + return Objects.equals(versionDelimiter, that.versionDelimiter); + } + + @Override + public int hashCode() { + return 17 * 31 + Objects.hashCode(versionDelimiter); + } +} diff --git a/ldes-server-domain/src/main/java/module-info.java b/ldes-server-domain/src/main/java/module-info.java index ec845fd5ae..9ac61dfb02 100644 --- a/ldes-server-domain/src/main/java/module-info.java +++ b/ldes-server-domain/src/main/java/module-info.java @@ -5,6 +5,7 @@ exports be.vlaanderen.informatievlaanderen.ldes.server.domain.constants; exports be.vlaanderen.informatievlaanderen.ldes.server.domain.model; exports be.vlaanderen.informatievlaanderen.ldes.server.domain.rest; + exports be.vlaanderen.informatievlaanderen.ldes.server.domain.encodig; // Events exports be.vlaanderen.informatievlaanderen.ldes.server.domain.events.retention; diff --git a/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConfigTest.java b/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConfigTest.java index 84cfc35cb2..cd70e9fb4a 100644 --- a/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConfigTest.java +++ b/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/constants/ServerConfigTest.java @@ -11,29 +11,27 @@ void when_PropertiesAreFilledIn_TheyCanBeConsulted() { serverConfig.setHostName("LOCALHOST"); serverConfig.setUseRelativeUrl(true); serverConfig.setCompactionDuration("PT1M"); - serverConfig.setRetentionCron("*/20 * * * * *"); - serverConfig.setDeletionCron("*/30 * * * * *"); - serverConfig.setCompactionCron("*/45 * * * * *"); + serverConfig.setFragmentationCron("*/20 * * * * *"); + serverConfig.setMaintenanceCron("*/30 * * * * *"); assertThat(serverConfig.getHostName()).isEqualTo("LOCALHOST"); assertThat(serverConfig.getUseRelativeUrl()).isTrue(); assertThat(serverConfig.getCompactionDuration()).isEqualTo("PT1M"); - assertThat(serverConfig.getRetentionCron()).isEqualTo("*/20 * * * * *"); - assertThat(serverConfig.getDeletionCron()).isEqualTo("*/30 * * * * *"); - assertThat(serverConfig.getCompactionCron()).isEqualTo("*/45 * * * * *"); + assertThat(serverConfig.getFragmentationCron()).isEqualTo("*/20 * * * * *"); + assertThat(serverConfig.getMaintenanceCron()).isEqualTo("*/30 * * * * *"); } @Test void when_PropertiesAreEmpty_NullOrDefaultValuesAreReturned() { final String backgroundCron = "0 0 0 * * *"; + final String fragmentationCron = "*/30 * * * * *"; ServerConfig serverConfig = new ServerConfig(); assertThat(serverConfig.getHostName()).isNull(); assertThat(serverConfig.getUseRelativeUrl()).isFalse(); assertThat(serverConfig.getCompactionDuration()).isEqualTo("P7D"); - assertThat(serverConfig.getRetentionCron()).isEqualTo(backgroundCron); - assertThat(serverConfig.getDeletionCron()).isEqualTo(backgroundCron); - assertThat(serverConfig.getCompactionCron()).isEqualTo(backgroundCron); + assertThat(serverConfig.getMaintenanceCron()).isEqualTo(backgroundCron); + assertThat(serverConfig.getFragmentationCron()).isEqualTo(fragmentationCron); } } \ No newline at end of file diff --git a/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/LocalDateTimeConverterTest.java b/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/LocalDateTimeConverterTest.java index cc13437f60..4866934937 100644 --- a/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/LocalDateTimeConverterTest.java +++ b/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/LocalDateTimeConverterTest.java @@ -1,37 +1,86 @@ package be.vlaanderen.informatievlaanderen.ldes.server.domain.converter; -import org.apache.jena.datatypes.TypeMapper; -import org.apache.jena.rdf.model.impl.LiteralImpl; -import org.junit.jupiter.api.Test; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.datatypes.xsd.XSDDatatype; +import org.apache.jena.rdf.model.Literal; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import java.time.LocalDateTime; +import java.time.format.DateTimeParseException; +import java.time.temporal.ChronoUnit; +import java.util.stream.Stream; import static org.apache.jena.rdf.model.ResourceFactory.createTypedLiteral; -import static org.junit.jupiter.api.Assertions.*; +import static org.assertj.core.api.Assertions.*; class LocalDateTimeConverterTest { private final LocalDateTimeConverter localDateTimeConverter = new LocalDateTimeConverter(); - @Test - void test_conversionOfXsdTimeToLocalTime() { - LiteralImpl typedLiteral = (LiteralImpl) createTypedLiteral("2022-05-20T09:58:15Z", - TypeMapper.getInstance().getTypeByName("http://www.w3.org/2001/XMLSchema#dateTime")); + static Stream datatypes() { + return Stream.of(XSDDatatype.XSDdateTime, XSDDatatype.XSDstring); + } - LocalDateTime actualLocalDateTime = localDateTimeConverter.getLocalDateTime(typedLiteral); + static Stream invalidDatatypes() { + return Stream.of( + createTypedLiteral("1729774515", XSDDatatype.XSDint), + createTypedLiteral("2022-05-20", XSDDatatype.XSDdate), + createTypedLiteral("09:58:15Z", XSDDatatype.XSDtime), + createTypedLiteral("true", XSDDatatype.XSDboolean) + ); + } + @ParameterizedTest + @MethodSource("datatypes") + void test_conversionOfXsdTimeToLocalTime(RDFDatatype dataType) { LocalDateTime expectedLocalDateTime = LocalDateTime.of(2022, 5, 20, 9, 58, 15); - assertEquals(expectedLocalDateTime, actualLocalDateTime); + Literal typedLiteral = createTypedLiteral("2022-05-20T09:58:15Z", dataType); + + LocalDateTime actualLocalDateTime = localDateTimeConverter.getLocalDateTime(typedLiteral); + + assertThat(actualLocalDateTime).isEqualTo(expectedLocalDateTime); } - @Test - void test_conversionOfXsdTimeWithoutTimeZone() { - LiteralImpl typedLiteral = (LiteralImpl) createTypedLiteral("2023-04-14T12:10:30.629238", - TypeMapper.getInstance().getTypeByName("http://www.w3.org/2001/XMLSchema#dateTime")); + @ParameterizedTest + @MethodSource("datatypes") + void test_conversionOfXsdTimeToLocalTimeWithOffset(RDFDatatype dataType) { + LocalDateTime expectedLocalDateTime = LocalDateTime.of(2022, 5, 20, 8, 58, 15); + Literal typedLiteral = createTypedLiteral("2022-05-20T09:58:15+01:00", dataType); LocalDateTime actualLocalDateTime = localDateTimeConverter.getLocalDateTime(typedLiteral); + assertThat(actualLocalDateTime).isEqualTo(expectedLocalDateTime); + } + + @ParameterizedTest + @MethodSource("datatypes") + void test_conversionOfXsdTimeWithoutTimeZone(RDFDatatype dataType) { LocalDateTime expectedLocalDateTime = LocalDateTime.of(2023, 4, 14, 12, 10, 30, 629000000); - assertEquals(expectedLocalDateTime, actualLocalDateTime); + Literal typedLiteral = createTypedLiteral("2023-04-14T12:10:30.629238", dataType); + + LocalDateTime actualLocalDateTime = localDateTimeConverter.getLocalDateTime(typedLiteral); + + assertThat(actualLocalDateTime) + .isCloseTo(expectedLocalDateTime, within(238000, ChronoUnit.NANOS)); + } + + @ParameterizedTest + @MethodSource("invalidDatatypes") + void test_conversionOfInvalidTimestamp(Literal literalWithInvalidDatatype) { + assertThatThrownBy(() -> localDateTimeConverter.getLocalDateTime(literalWithInvalidDatatype)) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("Provided datatype cannot be used for conversion: " + literalWithInvalidDatatype.getDatatype()); } + + @ParameterizedTest + @ValueSource(strings = {"not-a-timestamp", "2022-05-20T09:58:15Z+1:00", "2022-05-20T09:58:15Z[UTC]", "2022-05-20T09:58:15.999999999999999"}) + void test_conversionOfInvalidValues(String value) { + Literal literalWithInvalidValue = createTypedLiteral(value, XSDDatatype.XSDstring); + + assertThatThrownBy(() -> localDateTimeConverter.getLocalDateTime(literalWithInvalidValue)) + .isInstanceOf(DateTimeParseException.class); + } + } \ No newline at end of file diff --git a/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/VersionObjectModelBuilderTest.java b/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/VersionObjectModelBuilderTest.java index bf27dd33d4..696477aa0c 100644 --- a/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/VersionObjectModelBuilderTest.java +++ b/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/converter/VersionObjectModelBuilderTest.java @@ -11,38 +11,39 @@ import static org.assertj.core.api.Assertions.assertThat; class VersionObjectModelBuilderTest { - private static final String MEMBER_ID = "http://example.org/measurement/1/2024-03-14T18:00:15"; - private static final String TIMESTAMP_STRING = "2024-03-14T18:00:15"; - private static final String VERSION_OF = "http://example.org/measurement/1"; - private static final String DC_TERMS = "http://purl.org/dc/terms/"; + private static final String MEMBER_ID = "http://example.org/measurement/1/2024-03-14T18:00:15"; + private static final String TIMESTAMP_STRING = "2024-03-14T18:00:15"; + private static final String VERSION_OF = "http://example.org/measurement/1"; + private static final String DC_TERMS = "http://purl.org/dc/terms/"; - @Test - void given_NonEmptyModel_test_BuildVersionObjectModel() { - final Model startingModel = RDFParser.fromString(""" - . - _:Bc71573ec37565ce5dfbf75c37234fa44 . - _:Bc71573ec37565ce5dfbf75c37234fa44 "MULTILINESTRING ((-6.24031410164351 53.3756072010337, -6.2403628016435 53.3756159010337, -6.2404272016435 53.3756267010337, -6.24122490164335 53.3757483010336, -6.24161280164327 53.3758069010336, -6.24174840164325 53.3758198010336, -6.24215590164318 53.3758540010335, -6.24229640164315 53.3758841010335))"^^ . - """) - .lang(Lang.NQ) - .toModel(); - final Model actualVersionObject = VersionObjectModelBuilder.create() - .withMemberSubject(MEMBER_ID) - .withVersionOfProperties(DC_TERMS + "isVersionOf", VERSION_OF) - .withTimestampProperties(DC_TERMS + "created", LocalDateTime.parse(TIMESTAMP_STRING)) - .withModel(startingModel) - .buildVersionObjectModel(); + @Test + void given_NonEmptyModel_test_BuildVersionObjectModel() { + final Model startingModel = RDFParser.create() + .fromString(""" + . + _:Bc71573ec37565ce5dfbf75c37234fa44 . + _:Bc71573ec37565ce5dfbf75c37234fa44 "MULTILINESTRING ((-6.24031410164351 53.3756072010337, -6.2403628016435 53.3756159010337, -6.2404272016435 53.3756267010337, -6.24122490164335 53.3757483010336, -6.24161280164327 53.3758069010336, -6.24174840164325 53.3758198010336, -6.24215590164318 53.3758540010335, -6.24229640164315 53.3758841010335))"^^ . + """) + .lang(Lang.NQ) + .toModel(); + final Model actualVersionObject = VersionObjectModelBuilder.create() + .withMemberSubject(MEMBER_ID) + .withVersionOfProperties(DC_TERMS + "isVersionOf", VERSION_OF) + .withTimestampProperties(DC_TERMS + "created", LocalDateTime.parse(TIMESTAMP_STRING)) + .withModel(startingModel) + .buildVersionObjectModel(); - assertThat(actualVersionObject).matches(createExpectedModel()::isIsomorphicWith); - } + assertThat(actualVersionObject).matches(createExpectedModel()::isIsomorphicWith); + } - private Model createExpectedModel() { - final String content = """ - . - "%s"^^ . - . - _:Bc71573ec37565ce5dfbf75c37234fa44 . - _:Bc71573ec37565ce5dfbf75c37234fa44 "MULTILINESTRING ((-6.24031410164351 53.3756072010337, -6.2403628016435 53.3756159010337, -6.2404272016435 53.3756267010337, -6.24122490164335 53.3757483010336, -6.24161280164327 53.3758069010336, -6.24174840164325 53.3758198010336, -6.24215590164318 53.3758540010335, -6.24229640164315 53.3758841010335))"^^ . - """.formatted(LocalDateTime.parse(TIMESTAMP_STRING).atZone(TimeZone.getDefault().toZoneId()).toInstant()); - return RDFParser.fromString(content).lang(Lang.NQ).toModel(); - } + private Model createExpectedModel() { + final String content = """ + . + "%s"^^ . + . + _:Bc71573ec37565ce5dfbf75c37234fa44 . + _:Bc71573ec37565ce5dfbf75c37234fa44 "MULTILINESTRING ((-6.24031410164351 53.3756072010337, -6.2403628016435 53.3756159010337, -6.2404272016435 53.3756267010337, -6.24122490164335 53.3757483010336, -6.24161280164327 53.3758069010336, -6.24174840164325 53.3758198010336, -6.24215590164318 53.3758540010335, -6.24229640164315 53.3758841010335))"^^ . + """.formatted(LocalDateTime.parse(TIMESTAMP_STRING).atZone(TimeZone.getDefault().toZoneId()).toInstant()); + return RDFParser.create().fromString(content).lang(Lang.NQ).toModel(); + } } \ No newline at end of file diff --git a/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/model/VersionCreationPropertiesTest.java b/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/model/VersionCreationPropertiesTest.java new file mode 100644 index 0000000000..ef04946e9a --- /dev/null +++ b/ldes-server-domain/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/model/VersionCreationPropertiesTest.java @@ -0,0 +1,81 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.domain.model; + +import org.assertj.core.api.Condition; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +class VersionCreationPropertiesTest { + @Test + void test_DisabledVersionCreationProperties() { + VersionCreationProperties versionCreationProperties = VersionCreationProperties.disabled(); + + assertThat(versionCreationProperties.isVersionCreationEnabled()).isFalse(); + assertThat(versionCreationProperties.getVersionDelimiter()).isNull(); + } + + @Test + void test_OfNullableDelimiter() { + VersionCreationProperties versionCreationProperties = VersionCreationProperties.ofNullableDelimiter(null); + + assertThat(versionCreationProperties.isVersionCreationEnabled()).isFalse(); + assertThat(versionCreationProperties.getVersionDelimiter()).isNull(); + } + + @Test + void test_EnabledDefaultVersionCreationProperties() { + VersionCreationProperties versionCreationProperties = VersionCreationProperties.enabledWithDefault(); + + assertThat(versionCreationProperties.isVersionCreationEnabled()).isTrue(); + assertThat(versionCreationProperties.getVersionDelimiter()).isEqualTo("/"); + } + + @Test + void test_EnabledWithCustomDelimiterVersionCreationProperties() { + VersionCreationProperties versionCreationProperties = VersionCreationProperties.ofNullableDelimiter("&version="); + + assertThat(versionCreationProperties.isVersionCreationEnabled()).isTrue(); + assertThat(versionCreationProperties.getVersionDelimiter()).isEqualTo("&version="); + } + + @Test + void test_equality() { + VersionCreationProperties versionCreationProperties = VersionCreationProperties.enabledWithDefault(); + VersionCreationProperties other = VersionCreationProperties.ofNullableDelimiter("/"); + + assertThat(versionCreationProperties) + .isEqualTo(versionCreationProperties) + .hasSameHashCodeAs(other) + .isEqualTo(other); + } + + @ParameterizedTest + @MethodSource + void test_inequality(Object other) { + VersionCreationProperties versionCreationProperties = VersionCreationProperties.enabledWithDefault(); + + assertThat(versionCreationProperties) + .isNotEqualTo(other) + .has(differentHashCode(other)); + } + + private static Stream test_inequality() { + return Stream.of( + VersionCreationProperties.disabled(), + VersionCreationProperties.ofNullableDelimiter("#"), + "/", + null + ); + } + + private Condition differentHashCode(Object other) { + return new Condition<>( + actual -> other == null || actual.hashCode() != other.hashCode(), + "The two objects must have a different hashCode" + ); + } +} \ No newline at end of file diff --git a/ldes-server-port-fetch/pom.xml b/ldes-server-fetch/ldes-server-fetch-common/pom.xml similarity index 79% rename from ldes-server-port-fetch/pom.xml rename to ldes-server-fetch/ldes-server-fetch-common/pom.xml index 651edbeb98..7d86b3ec8d 100644 --- a/ldes-server-port-fetch/pom.xml +++ b/ldes-server-fetch/ldes-server-fetch-common/pom.xml @@ -5,11 +5,11 @@ 4.0.0 be.vlaanderen.informatievlaanderen.vsds - ldes-server - 3.4.1-SNAPSHOT + ldes-server-fetch + 3.5.0-SNAPSHOT - ldes-server-port-fetch + ldes-server-fetch-common @@ -18,16 +18,6 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server-domain - - be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-ingest - ${project.version} - - - be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-common - ${project.version} - org.springframework.boot diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/Member.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/Member.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/Member.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/Member.java diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/MemberAllocation.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/MemberAllocation.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/MemberAllocation.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/MemberAllocation.java diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/TreeNode.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/TreeNode.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/TreeNode.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/TreeNode.java diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/exceptions/LdesFragmentIdentifierParseException.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/exceptions/LdesFragmentIdentifierParseException.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/exceptions/LdesFragmentIdentifierParseException.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/exceptions/LdesFragmentIdentifierParseException.java diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/repository/TreeMemberRepository.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/repository/TreeMemberRepository.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/repository/TreeMemberRepository.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/repository/TreeMemberRepository.java diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/repository/TreeNodeRepository.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/repository/TreeNodeRepository.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/repository/TreeNodeRepository.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/repository/TreeNodeRepository.java index 7413027bdb..73df505e71 100644 --- a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/repository/TreeNodeRepository.java +++ b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/repository/TreeNodeRepository.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fetching.repository; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; import java.util.Optional; diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactory.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactory.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactory.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactory.java index fb3714560b..8b22895878 100644 --- a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactory.java +++ b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactory.java @@ -1,8 +1,8 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fetching.services; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; import java.util.stream.Stream; diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImpl.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImpl.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImpl.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImpl.java index 19381dd578..ab9c98109b 100644 --- a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImpl.java +++ b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImpl.java @@ -1,11 +1,11 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fetching.services; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.repository.TreeMemberRepository; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.repository.TreeNodeRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; import org.springframework.stereotype.Component; import java.util.stream.Stream; diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcher.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcher.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcher.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcher.java index 0d9cd50ed7..338451fc61 100644 --- a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcher.java +++ b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcher.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fetching.services; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentRequest; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentRequest; public interface TreeNodeFetcher { TreeNode getFragment(LdesFragmentRequest ldesFragmentRequest); diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImpl.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImpl.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImpl.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImpl.java index 203d5a5cb8..6db0dd3c45 100644 --- a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImpl.java +++ b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImpl.java @@ -1,11 +1,11 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fetching.services; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentRequest; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.repository.TreeNodeRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentRequest; import org.springframework.stereotype.Component; @Component diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreator.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreator.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreator.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreator.java diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreatorFactory.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreatorFactory.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreatorFactory.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreatorFactory.java diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreatorImpl.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreatorImpl.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreatorImpl.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/versioncreation/VersionObjectCreatorImpl.java diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/FragmentPair.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/FragmentPair.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/FragmentPair.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/FragmentPair.java diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentIdentifier.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentIdentifier.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentIdentifier.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentIdentifier.java index d3d97928a9..5829f9c77b 100644 --- a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentIdentifier.java +++ b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentIdentifier.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.exceptions.LdesFragmentIdentifierParseException; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.exceptions.LdesFragmentIdentifierParseException; import java.util.ArrayList; import java.util.HashSet; diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentRequest.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentRequest.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentRequest.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentRequest.java diff --git a/ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/TreeRelation.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/TreeRelation.java similarity index 100% rename from ldes-server-port-fetch/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/TreeRelation.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/TreeRelation.java diff --git a/ldes-server-port-fetch/src/main/java/module-info.java b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/module-info.java similarity index 84% rename from ldes-server-port-fetch/src/main/java/module-info.java rename to ldes-server-fetch/ldes-server-fetch-common/src/main/java/module-info.java index 5d665cae1a..92a536c197 100644 --- a/ldes-server-port-fetch/src/main/java/module-info.java +++ b/ldes-server-fetch/ldes-server-fetch-common/src/main/java/module-info.java @@ -6,14 +6,10 @@ exports be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects; requires ldes.domain; - requires ldes.ingest.domain; - requires ldes.fragmentation.domain; requires spring.context; requires spring.beans; requires micrometer.core; requires org.jetbrains.annotations; requires org.apache.jena.core; - requires spring.tx; - } \ No newline at end of file diff --git a/ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/TreeNodeTest.java b/ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/TreeNodeTest.java similarity index 100% rename from ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/TreeNodeTest.java rename to ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/entities/TreeNodeTest.java diff --git a/ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImplTest.java b/ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImplTest.java similarity index 100% rename from ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImplTest.java rename to ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImplTest.java index bb657b1349..0aa7f61777 100644 --- a/ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImplTest.java +++ b/ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/StreamingTreeNodeFactoryImplTest.java @@ -1,13 +1,13 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fetching.services; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.FragmentPair; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.repository.TreeMemberRepository; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.repository.TreeNodeRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.FragmentPair; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; import org.apache.jena.rdf.model.ModelFactory; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImplTest.java b/ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImplTest.java similarity index 100% rename from ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImplTest.java rename to ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImplTest.java index a252a5dac1..f45894c0a4 100644 --- a/ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImplTest.java +++ b/ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/services/TreeNodeFetcherImplTest.java @@ -1,12 +1,12 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fetching.services; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.FragmentPair; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentRequest; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.repository.TreeNodeRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.FragmentPair; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentRequest; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentIdentifierTest.java b/ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentIdentifierTest.java similarity index 100% rename from ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentIdentifierTest.java rename to ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentIdentifierTest.java diff --git a/ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentRequestTest.java b/ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentRequestTest.java similarity index 100% rename from ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentRequestTest.java rename to ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/LdesFragmentRequestTest.java diff --git a/ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/TreeRelationTest.java b/ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/TreeRelationTest.java similarity index 95% rename from ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/TreeRelationTest.java rename to ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/TreeRelationTest.java index 7207a70994..cf3bac8a4a 100644 --- a/ldes-server-port-fetch/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/TreeRelationTest.java +++ b/ldes-server-fetch/ldes-server-fetch-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fetching/valueobjects/TreeRelationTest.java @@ -10,7 +10,8 @@ import java.util.stream.Stream; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; class TreeRelationTest { diff --git a/ldes-server-port-fetch-rest/pom.xml b/ldes-server-fetch/ldes-server-fetch-rest/pom.xml similarity index 89% rename from ldes-server-port-fetch-rest/pom.xml rename to ldes-server-fetch/ldes-server-fetch-rest/pom.xml index 9dd629d843..344da0dd9b 100644 --- a/ldes-server-port-fetch-rest/pom.xml +++ b/ldes-server-fetch/ldes-server-fetch-rest/pom.xml @@ -4,17 +4,17 @@ be.vlaanderen.informatievlaanderen.vsds - ldes-server - 3.4.1-SNAPSHOT + ldes-server-fetch + 3.5.0-SNAPSHOT - ldes-server-port-fetch-rest + ldes-server-fetch-rest be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-fetch + ldes-server-fetch-common ${project.version} @@ -57,7 +57,7 @@ be.vlaanderen.informatievlaanderen.vsds - ldes-server-admin + ldes-server-admin-common ${project.version} compile diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/CachingStrategy.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/CachingStrategy.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/CachingStrategy.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/CachingStrategy.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/EtagCachingStrategy.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/EtagCachingStrategy.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/EtagCachingStrategy.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/EtagCachingStrategy.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/JsonLDMimeMapping.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/JsonLDMimeMapping.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/JsonLDMimeMapping.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/JsonLDMimeMapping.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/RestConfig.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/RestConfig.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/RestConfig.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/RestConfig.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/EventStreamController.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/EventStreamController.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/EventStreamController.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/EventStreamController.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/OpenApiEventStreamController.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/OpenApiEventStreamController.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/OpenApiEventStreamController.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/OpenApiEventStreamController.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/config/EventStreamWebConfig.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/config/EventStreamWebConfig.java similarity index 86% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/config/EventStreamWebConfig.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/config/EventStreamWebConfig.java index 9d9633bd6b..736537af21 100644 --- a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/config/EventStreamWebConfig.java +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/config/EventStreamWebConfig.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.rest.eventstream.config; import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamConverter; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamWriter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.HttpModelConverter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdder; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.RdfModelConverter; @@ -17,8 +17,8 @@ public class EventStreamWebConfig { @Bean public HttpMessageConverter eventStreamResponseHttpMessageConverter( - EventStreamConverter eventStreamConverter, RdfModelConverter rdfModelConverter) { - return new EventStreamResponseHttpConverter(eventStreamConverter, rdfModelConverter); + EventStreamWriter eventStreamWriter, RdfModelConverter rdfModelConverter) { + return new EventStreamResponseHttpConverter(eventStreamWriter, rdfModelConverter); } @ConditionalOnMissingBean diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/converters/EventStreamResponseHttpConverter.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/converters/EventStreamResponseHttpConverter.java similarity index 87% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/converters/EventStreamResponseHttpConverter.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/converters/EventStreamResponseHttpConverter.java index 1d191fa544..4b32a07a59 100644 --- a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/converters/EventStreamResponseHttpConverter.java +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/converters/EventStreamResponseHttpConverter.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.rest.eventstream.converters; import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamConverter; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamWriter; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.RdfModelConverter; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.Lang; @@ -20,11 +20,10 @@ import static be.vlaanderen.informatievlaanderen.ldes.server.rest.eventstream.config.EventStreamWebConfig.DEFAULT_RDF_MEDIA_TYPE; public class EventStreamResponseHttpConverter implements HttpMessageConverter { - private final EventStreamConverter eventStreamConverter; + private final EventStreamWriter eventStreamWriter; private final RdfModelConverter rdfModelConverter; - - public EventStreamResponseHttpConverter(EventStreamConverter eventStreamConverter, RdfModelConverter rdfModelConverter) { - this.eventStreamConverter = eventStreamConverter; + public EventStreamResponseHttpConverter(EventStreamWriter eventStreamWriter, RdfModelConverter rdfModelConverter) { + this.eventStreamWriter = eventStreamWriter; this.rdfModelConverter = rdfModelConverter; } @@ -54,7 +53,7 @@ public void write(EventStreamTO eventStreamTO, MediaType contentType, HttpOutput throws IOException, HttpMessageNotWritableException { Lang rdfFormat = rdfModelConverter.getLangOrDefault(contentType, FETCH); rdfModelConverter.checkLangForRelativeUrl(rdfFormat); - Model eventStreamModel = eventStreamConverter.toModel(eventStreamTO); + Model eventStreamModel = eventStreamWriter.write(eventStreamTO); RDFDataMgr.write(outputMessage.getBody(), eventStreamModel, rdfFormat); } } diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/exceptionhandling/RestResponseEntityExceptionHandler.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/exceptionhandling/RestResponseEntityExceptionHandler.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/exceptionhandling/RestResponseEntityExceptionHandler.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/exceptionhandling/RestResponseEntityExceptionHandler.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/exceptionhandling/exceptions/ConnectionException.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/exceptionhandling/exceptions/ConnectionException.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/exceptionhandling/exceptions/ConnectionException.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/exceptionhandling/exceptions/ConnectionException.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/OpenApiTreeNodeController.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/OpenApiTreeNodeController.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/OpenApiTreeNodeController.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/OpenApiTreeNodeController.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeController.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeController.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeController.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeController.java index 3b8ca530f3..f84716bb5f 100644 --- a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeController.java +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeController.java @@ -1,12 +1,12 @@ package be.vlaanderen.informatievlaanderen.ldes.server.rest.treenode; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.FragmentPair; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentRequest; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.services.StreamingTreeNodeFactory; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.services.TreeNodeFetcher; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.FragmentPair; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentRequest; import be.vlaanderen.informatievlaanderen.ldes.server.rest.caching.CachingStrategy; import be.vlaanderen.informatievlaanderen.ldes.server.rest.config.RestConfig; import be.vlaanderen.informatievlaanderen.ldes.server.rest.exceptionhandling.exceptions.ConnectionException; diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/config/TreeViewWebConfig.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/config/TreeViewWebConfig.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/config/TreeViewWebConfig.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/config/TreeViewWebConfig.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/converters/TreeNodeHttpConverter.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/converters/TreeNodeHttpConverter.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/converters/TreeNodeHttpConverter.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/converters/TreeNodeHttpConverter.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/EventStreamInfoResponse.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/EventStreamInfoResponse.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/EventStreamInfoResponse.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/EventStreamInfoResponse.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverter.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverter.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverter.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverter.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverterImpl.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverterImpl.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverterImpl.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverterImpl.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeInfoResponse.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeInfoResponse.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeInfoResponse.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeInfoResponse.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStatementCreator.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStatementCreator.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStatementCreator.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStatementCreator.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStatementCreatorImpl.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStatementCreatorImpl.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStatementCreatorImpl.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStatementCreatorImpl.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStreamConverter.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStreamConverter.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStreamConverter.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStreamConverter.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStreamConverterImpl.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStreamConverterImpl.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStreamConverterImpl.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeStreamConverterImpl.java diff --git a/ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeRelationResponse.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeRelationResponse.java similarity index 100% rename from ldes-server-port-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeRelationResponse.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeRelationResponse.java diff --git a/ldes-server-port-fetch-rest/src/main/java/module-info.java b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/module-info.java similarity index 88% rename from ldes-server-port-fetch-rest/src/main/java/module-info.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/main/java/module-info.java index 9dd47409d2..9d90ab9ec9 100644 --- a/ldes-server-port-fetch-rest/src/main/java/module-info.java +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/main/java/module-info.java @@ -3,7 +3,6 @@ requires ldes.admin; requires ldes.domain; requires ldes.fetch.domain; - requires ldes.ingest.domain; requires spring.web; requires spring.beans; @@ -19,6 +18,5 @@ requires micrometer.observation; requires org.slf4j; requires org.jetbrains.annotations; - requires ldes.fragmentation.domain; } \ No newline at end of file diff --git a/ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/EtagCachingStrategyTest.java b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/EtagCachingStrategyTest.java similarity index 100% rename from ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/EtagCachingStrategyTest.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/EtagCachingStrategyTest.java index d918cc0753..14945adc73 100644 --- a/ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/EtagCachingStrategyTest.java +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/caching/EtagCachingStrategyTest.java @@ -1,10 +1,10 @@ package be.vlaanderen.informatievlaanderen.ldes.server.rest.caching; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.TreeRelation; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.TreeRelation; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; diff --git a/ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/RestConfigTest.java b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/RestConfigTest.java similarity index 100% rename from ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/RestConfigTest.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/config/RestConfigTest.java diff --git a/ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/EventStreamControllerTest.java b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/EventStreamControllerTest.java similarity index 94% rename from ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/EventStreamControllerTest.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/EventStreamControllerTest.java index 2e45fa69e7..fad0329f5f 100644 --- a/ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/EventStreamControllerTest.java +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/eventstream/EventStreamControllerTest.java @@ -12,7 +12,6 @@ import be.vlaanderen.informatievlaanderen.ldes.server.rest.config.RestConfig; import be.vlaanderen.informatievlaanderen.ldes.server.rest.eventstream.converters.EventStreamResponseHttpConverter; import be.vlaanderen.informatievlaanderen.ldes.server.rest.exceptionhandling.RestResponseEntityExceptionHandler; -import org.apache.http.HttpHeaders; import org.apache.jena.rdf.model.*; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFParser; @@ -32,6 +31,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; +import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; @@ -59,7 +59,7 @@ @ActiveProfiles({"test", "rest"}) @Import({EventStreamControllerTest.EventStreamControllerTestConfiguration.class}) @ContextConfiguration(classes = {EventStreamController.class, RestConfig.class, - RestResponseEntityExceptionHandler.class, EventStreamConverterImpl.class, + RestResponseEntityExceptionHandler.class, EventStreamWriter.class, EventStreamReader.class, ViewSpecificationConverter.class, PrefixAdderImpl.class, EventStreamResponseHttpConverter.class, RetentionModelExtractor.class, HttpModelConverter.class, FragmentationConfigExtractor.class, PrefixConstructor.class, RdfModelConverter.class @@ -98,7 +98,7 @@ void when_GetRequestOnCollectionName_EventStreamIsReturned(String mediaType, Lan MvcResult result = resultActions.andReturn(); - String etagHeaderValue = result.getResponse().getHeader(HttpHeaders.ETAG).replace("\"", ""); + String etagHeaderValue = Objects.requireNonNull(result.getResponse().getHeader(HttpHeaders.ETAG)).replace("\"", ""); assertNotNull(etagHeaderValue); assertEquals(expectedEtagHeaderValue, etagHeaderValue); @@ -124,7 +124,7 @@ private String getObjectURI(Model model, Property property) { } private Integer extractMaxAge(MvcResult result) { - String header = result.getResponse().getHeader(HttpHeaders.CACHE_CONTROL); + String header = Objects.requireNonNull(result.getResponse().getHeader(HttpHeaders.CACHE_CONTROL)); Matcher matcher = Pattern.compile("(.*,)?(max-age=([0-9]+))(,.*)?").matcher(header); if (matcher.matches()) { @@ -177,7 +177,7 @@ void should_ReturnDcat_when_Valid() throws Exception { .andExpect(status().isOk()) .andExpect(result -> { String contentAsString = result.getResponse().getContentAsString(); - Model actualModel = RDFParser.fromString(contentAsString).lang(Lang.TURTLE).toModel(); + Model actualModel = RDFParser.create().fromString(contentAsString).lang(Lang.TURTLE).toModel(); actualModel.isIsomorphicWith(model); }); diff --git a/ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeControllerTest.java b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeControllerTest.java similarity index 83% rename from ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeControllerTest.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeControllerTest.java index 4746c30e58..bb865639d4 100644 --- a/ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeControllerTest.java +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/TreeNodeControllerTest.java @@ -3,9 +3,11 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdder; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdderImpl; import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.RdfModelConverter; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.encodig.CharsetEncodingConfig; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamCreatedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.*; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.domain.rest.PrefixConstructor; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; @@ -48,6 +50,7 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -59,6 +62,7 @@ import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.ServerConfig.HOST_NAME_KEY; import static org.apache.jena.riot.WebContent.contentTypeTurtle; import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.containsString; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; @@ -70,7 +74,7 @@ RestConfig.class, TreeViewWebConfig.class, RestResponseEntityExceptionHandler.class, PrefixConstructor.class, RdfModelConverter.class, TreeNodeStreamConverterImpl.class, PrefixAdderImpl.class, - TreeNodeStatementCreatorImpl.class}) + TreeNodeStatementCreatorImpl.class, CharsetEncodingConfig.class}) class TreeNodeControllerTest { private static final String COLLECTION_NAME = "ldes-1"; private static final String FRAGMENTATION_VALUE_1 = "2020-12-28T09:36:09.72Z"; @@ -93,7 +97,6 @@ class TreeNodeControllerTest { private RestConfig restConfig; @Autowired private CachingStrategy cachingStrategy; - private WebTestClient client; @BeforeEach void setUp() { @@ -103,8 +106,8 @@ void setUp() { @ParameterizedTest(name = "Correct getting of an open LdesFragment from the REST Service with mediatype{0}") @ArgumentsSource(MediaTypeRdfFormatsArgumentsProvider.class) void when_GETRequestIsPerformed_ResponseContainsAnLDesFragment(String mediaType, Lang lang, boolean immutable, - String expectedHeaderValue, String expectedEtag) throws Exception { - EventStream eventStream = new EventStream(COLLECTION_NAME, null, null, false); + String expectedHeaderValue, String expectedEtag) throws Exception { + EventStream eventStream = new EventStream(COLLECTION_NAME, null, null, null); eventPublisher.publishEvent(new EventStreamCreatedEvent(eventStream)); LdesFragmentRequest ldesFragmentRequest = new LdesFragmentRequest(ViewName.fromString(fullViewName), @@ -129,7 +132,8 @@ void when_GETRequestIsPerformed_ResponseContainsAnLDesFragment(String mediaType, .andExpect(status().isOk()) .andExpect(header().string("Cache-Control", expectedHeaderValue)) .andExpect(header().string("Etag", "\"" + expectedEtag + "\"")) - .andExpect(content().contentType(expectedContentType)) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(expectedContentType)) .andReturn(); Optional maxAge = extractMaxAge(result.getResponse().getHeader("Cache-Control")); @@ -141,6 +145,39 @@ void when_GETRequestIsPerformed_ResponseContainsAnLDesFragment(String mediaType, verify(treeNodeFetcher, times(1)).getFragment(ldesFragmentRequest); } + + @Test + void given_MemberWithSpecialChars_when_GetRequestIsPerformed_then_CharsAreRightfullyEncoded() throws Exception { + EventStream eventStream = new EventStream(COLLECTION_NAME, null, null, null); + eventPublisher.publishEvent(new EventStreamCreatedEvent(eventStream)); + + LdesFragmentRequest ldesFragmentRequest = new LdesFragmentRequest(ViewName.fromString(fullViewName), + List.of(new FragmentPair(GENERATED_AT_TIME, FRAGMENTATION_VALUE_1))); + final String fragmentId = new LdesFragmentIdentifier(ldesFragmentRequest.viewName(), + ldesFragmentRequest.fragmentPairs()) + .asDecodedFragmentId(); + final Member member = createMember(); + TreeNode treeNode = new TreeNode(fragmentId, true, false, List.of(), + List.of(member), COLLECTION_NAME, null); + + when(treeNodeFetcher.getFragment(ldesFragmentRequest)).thenReturn(treeNode); + + + String mediaType = "text/turtle"; + mockMvc + .perform(get("/{collectionName}/{viewName}", COLLECTION_NAME, VIEW_NAME) + .param("generatedAtTime", FRAGMENTATION_VALUE_1) + .accept(mediaType)) + .andExpect(status().isOk()) + .andExpect(content().encoding(StandardCharsets.UTF_8)) + .andExpect(content().contentTypeCompatibleWith(mediaType)) + .andExpect(content().string(containsString("ë"))) + .andExpect(content().string(containsString("你好"))) + .andReturn(); + + verify(treeNodeFetcher, times(1)).getFragment(ldesFragmentRequest); + } + private List getObjectURIs(Model model, Property property) { return model .listStatements(null, property, (Resource) null) @@ -202,14 +239,12 @@ void when_GETRequestIsPerformedOnOtherCollectionName_ResponseIs404() throws Exce static class MediaTypeRdfFormatsArgumentsProvider implements ArgumentsProvider { @Override + @SuppressWarnings("java:S1874") // deprecated Lang used for testing backwards compatibility public Stream provideArguments(ExtensionContext context) { return Stream.of( Arguments.of("application/n-quads", Lang.NQUADS, true, "public,max-age=" + CONFIGURED_MAX_AGE_IMMUTABLE + ",immutable", "4dad435c3bea4079e22a38b5320483522442960e435ae47682b8eb7d0d64e034"), - Arguments.of("application/ld+json", Lang.JSONLD10, true, - "public,max-age=" + CONFIGURED_MAX_AGE_IMMUTABLE + ",immutable", - "10235d5bcd85b9450bfcbb423d4a8f0f9da876542c3f9690a24794cef459fbd8"), Arguments.of("application/rdf+protobuf", Lang.RDFPROTO, true, "public,max-age=" + CONFIGURED_MAX_AGE_IMMUTABLE + ",immutable", "cfc950c3f081507614d7b4f0f9d4ef65fe59a45048f62c9b80486ff4c7346e49"), @@ -228,7 +263,7 @@ public Stream provideArguments(ExtensionContext context) { @Test @DisplayName("Requesting LDES fragment stream") void when_GETRequestIsPerformedForStreaming_ResponseContainsAnLDesFragment() { - EventStream eventStream = new EventStream(COLLECTION_NAME, null, null, false); + EventStream eventStream = new EventStream(COLLECTION_NAME, null, null, null); eventPublisher.publishEvent(new EventStreamCreatedEvent(eventStream)); LdesFragmentIdentifier identifier = new LdesFragmentIdentifier(ViewName.fromString(fullViewName), @@ -241,7 +276,7 @@ void when_GETRequestIsPerformedForStreaming_ResponseContainsAnLDesFragment() { when(streamingTreeNodeFactory.getMembersOfFragment(identifier)) .thenReturn(Stream.of(new Member("member1", ModelFactory.createDefaultModel()), new Member("member2", ModelFactory.createDefaultModel()))); - client = WebTestClient.bindToController(new TreeNodeController(restConfig, treeNodeFetcher, + WebTestClient client = WebTestClient.bindToController(new TreeNodeController(restConfig, treeNodeFetcher, streamingTreeNodeFactory, treeNodeStreamConverter, cachingStrategy)).build(); client.get() @@ -272,4 +307,10 @@ public CachingStrategy cachingStrategy(@Value(HOST_NAME_KEY) String hostName) { return new EtagCachingStrategy(hostName); } } + + private static Member createMember() { + final String subject = "http://data.lblod.info/id/public-service-snapshot/46969c9a-a803-ef11-9f8a-000d3aad8fb9"; + final Model model = RDFParser.source("member-utf8-charset.nq").toModel(); + return new Member(subject, model); + } } diff --git a/ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/EventStreamInfoResponseTest.java b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/EventStreamInfoResponseTest.java similarity index 93% rename from ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/EventStreamInfoResponseTest.java rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/EventStreamInfoResponseTest.java index 35e6718170..02d4d1f75e 100644 --- a/ldes-server-port-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/EventStreamInfoResponseTest.java +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/EventStreamInfoResponseTest.java @@ -30,7 +30,7 @@ void convertToStatements_IncludesMandatoryStatements() { @Test void convertToStatements_AddsShapeIfPresent() { - Model shape = RDFParser.fromString("[ a ]").lang(Lang.TURTLE).toModel(); + Model shape = RDFParser.create().fromString("[ a ]").lang(Lang.TURTLE).toModel(); EventStreamInfoResponse response = new EventStreamInfoResponse("http://example.com/eventStream", "", "", shape, List.of()); diff --git a/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverterImplTest.java b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverterImplTest.java new file mode 100644 index 0000000000..b081099ccc --- /dev/null +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeNodeConverterImplTest.java @@ -0,0 +1,192 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.rest.treenode.services; + +import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdder; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.converter.PrefixAdderImpl; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.*; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.DcatView; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.rest.PrefixConstructor; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.TreeRelation; +import org.apache.jena.datatypes.xsd.XSDDatatype; +import org.apache.jena.rdf.model.*; +import org.apache.jena.riot.Lang; +import org.apache.jena.riot.RDFParser; +import org.apache.jena.riot.RDFParserBuilder; +import org.apache.jena.vocabulary.RDF; +import org.assertj.core.api.Condition; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.*; +import static org.apache.jena.rdf.model.ResourceFactory.createProperty; +import static org.apache.jena.rdf.model.ResourceFactory.createResource; +import static org.assertj.core.api.Assertions.*; + +class TreeNodeConverterImplTest { + + private static final String HOST_NAME = "http://localhost:8080"; + private static final String COLLECTION_NAME = "mobility-hindrances"; + public static final Resource COLLECTION_URI = createResource(HOST_NAME + "/" + COLLECTION_NAME); + private static final String PREFIX = HOST_NAME + "/" + COLLECTION_NAME + "/"; + private static final String VIEW_NAME = "view"; + private static final Resource VIEW_URI = createResource(HOST_NAME + "/" + COLLECTION_NAME + "/" + VIEW_NAME); + private final PrefixAdder prefixAdder = new PrefixAdderImpl(); + private final PrefixConstructor prefixConstructor = new PrefixConstructor(HOST_NAME, false); + private final TreeNodeStatementCreatorImpl treeNodeStatementCreator = new TreeNodeStatementCreatorImpl(); + private TreeNodeConverterImpl treeNodeConverter; + + @BeforeEach + void setUp() { + Model shacl = RDFParser.source("eventstream/streams/example-shape.ttl").lang(Lang.TURTLE).build().toModel(); + + EventStream eventStream = new EventStream(COLLECTION_NAME, + "http://www.w3.org/ns/prov#generatedAtTime", + "http://purl.org/dc/terms/isVersionOf", null); + + treeNodeConverter = new TreeNodeConverterImpl(prefixAdder, prefixConstructor, treeNodeStatementCreator); + treeNodeStatementCreator.handleEventStreamInitEvent(new EventStreamCreatedEvent(eventStream)); + treeNodeStatementCreator.handleShaclInitEvent(new ShaclChangedEvent(COLLECTION_NAME, shacl)); + } + + @Test + void when_TreeNodeHasNoMembersAndIsAView_ModelHasTreeNodeAndLdesStatements() { + TreeNode treeNode = new TreeNode("/" + COLLECTION_NAME + "/" + VIEW_NAME, false, true, List.of(), List.of(), + COLLECTION_NAME, null); + ViewName viewName = new ViewName(COLLECTION_NAME, VIEW_NAME); + Model dcat = RDFParser.source("eventstream/streams/dcat-view-valid.ttl").lang(Lang.TURTLE).build().toModel(); + DcatView dcatView = DcatView.from(viewName, dcat); + treeNodeStatementCreator.handleDcatViewSavedEvent(new DcatViewSavedEvent(dcatView)); + + Model model = treeNodeConverter.toModel(treeNode); + + assertThat(model) + .has(size(25)) + .has(treeNodeStatement()) + .has(ldesStatements()); + } + + @Test + void when_TreeNodeHasNoMembersAndIsNotAView_ModelHasTreeNodeAndPartOfStatements() { + TreeNode treeNode = new TreeNode("/" + COLLECTION_NAME + "/" + VIEW_NAME, false, false, List.of(), List.of(), + COLLECTION_NAME, null); + + Model model = treeNodeConverter.toModel(treeNode); + + assertThat(model) + .has(size(3)) + .has(treeNodeStatement()) + .has(isPartOfStatement()) + .has(not(remainingItemsStatement())); + } + + @Test + void when_TreeNodeHasMembersAndARelations_ModelHasMultipleStatements() { + Model ldesMemberModel = RDFParserBuilder.create().fromString(""" + + + .""").lang(Lang.NQUADS).toModel(); + String memberUri = "https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10228622/165"; + Member member = new Member( + memberUri, ldesMemberModel); + TreeRelation treeRelation = new TreeRelation("path", + new LdesFragmentIdentifier("mobility-hindrances/node", List.of()), "value", + "http://www.w3.org/2001/XMLSchema#dateTime", "relation"); + TreeNode treeNode = new TreeNode("/" + COLLECTION_NAME + "/" + VIEW_NAME, false, false, List.of(treeRelation), + List.of(member), COLLECTION_NAME, null); + + Model model = treeNodeConverter.toModel(treeNode); + + assertThat(model) + .has(size(9)) + .has(relationStatements(model.listObjectsOfProperty(TREE_RELATION).nextNode().asResource())) + .has(treeNodeStatement()) + .has(isPartOfStatement()) + .has(statement(COLLECTION_URI, TREE_MEMBER, createResource(memberUri))) + .has(not(remainingItemsStatement())); + } + + private Condition ldesStatements() { + return allOf( + statement(COLLECTION_URI, RDF.type, createResource(LDES_EVENT_STREAM_URI)), + statement(COLLECTION_URI, LDES_TIMESTAMP_PATH, createResource("http://www.w3.org/ns/prov#generatedAtTime")), + statement(COLLECTION_URI, LDES_VERSION_OF, createResource("http://purl.org/dc/terms/isVersionOf")), + statementsWithSubjectCountedTimes("http://localhost:8080/mobility-hindrances/view/description", 8), + statementsWithSubjectCountedTimes("http://localhost:8080/collectionName1/shape", 3), + statement(COLLECTION_URI, TREE_VIEW, VIEW_URI)); + } + + private Condition statementsWithSubjectCountedTimes(String subject, int expectedCount) { + return new Condition<>( + model -> model.listObjectsOfProperty(createResource(subject), null).toList().size() == expectedCount, + "TreeNode must have %d statements with subject %s", expectedCount, subject + ); + } + + private Condition relationStatements(Resource relationObject) { + Model expectedModel = ModelFactory.createDefaultModel() + .add(VIEW_URI, TREE_RELATION, relationObject) + .add(relationObject, RDF.type, createResource("relation")) + .add(relationObject, TREE_PATH, createProperty("path")) + .add(relationObject, TREE_NODE, createResource(HOST_NAME + "/" + COLLECTION_NAME + "/node")) + .add(relationObject, TREE_VALUE, "value", XSDDatatype.XSDdateTime); + return new Condition<>(model -> model.containsAll(expectedModel), "TreeNode must have expected relation statements"); + } + + private Condition treeNodeStatement() { + return statement(VIEW_URI, RDF.type, createResource(TREE_NODE_RESOURCE)); + } + + public Condition isPartOfStatement() { + return statement(VIEW_URI, IS_PART_OF_PROPERTY, COLLECTION_URI); + } + + public Condition statement(Resource subject, Property predicate, RDFNode object) { + return new Condition<>( + model -> model.contains(subject, predicate, object), + "TreeNode must have a statement [%s, %s, %s]", subject, predicate, object + ); + } + + private Condition remainingItemsStatement() { + return new Condition<>( + model -> model.listStatements(null, createProperty(TREE_REMAINING_ITEMS), (Resource) null).hasNext(), + "TreeNode must have a remainingItems statement" + ); + } + + private Condition size(int size) { + return new Condition<>(model -> model.size() == size, "Model must have %d statements", size); + } + + @Test + void testHandleDcatViewEvents() { + final TreeNode treeNode = new TreeNode(PREFIX + VIEW_NAME, false, true, List.of(), List.of(), + COLLECTION_NAME, null); + final ViewName viewName = new ViewName(COLLECTION_NAME, VIEW_NAME); + final Model dcat = RDFParser.source("eventstream/streams/dcat-view-valid.ttl").lang(Lang.TURTLE).build().toModel(); + final DcatView dcatView = DcatView.from(viewName, dcat); + + assertThat(treeNodeConverter.toModel(treeNode).size()).isEqualTo(11); + treeNodeStatementCreator.handleDcatViewSavedEvent(new DcatViewSavedEvent(dcatView)); + assertThat(treeNodeConverter.toModel(treeNode).size()).isEqualTo(25); + treeNodeStatementCreator.handleDcatViewDeletedEvent(new DcatViewDeletedEvent(dcatView.getViewName())); + assertThat(treeNodeConverter.toModel(treeNode).size()).isEqualTo(11); + } + + @Test + void test_HandleEventStreamDeleted() { + final TreeNode treeNode = new TreeNode(PREFIX + VIEW_NAME, false, true, List.of(), List.of(), + COLLECTION_NAME, null); + + treeNodeStatementCreator.handleEventStreamDeletedEvent(new EventStreamDeletedEvent(COLLECTION_NAME)); + + assertThatThrownBy(() -> treeNodeConverter.toModel(treeNode)).isInstanceOf(MissingResourceException.class); + } +} diff --git a/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeRelationResponseTest.java b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeRelationResponseTest.java new file mode 100644 index 0000000000..f1d4fc039c --- /dev/null +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/rest/treenode/services/TreeRelationResponseTest.java @@ -0,0 +1,82 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.rest.treenode.services; + +import org.apache.jena.datatypes.xsd.XSDDatatype; +import org.apache.jena.rdf.model.Property; +import org.apache.jena.rdf.model.RDFNode; +import org.apache.jena.rdf.model.Resource; +import org.apache.jena.rdf.model.Statement; +import org.apache.jena.vocabulary.RDF; +import org.assertj.core.api.Condition; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.TREE_VALUE; +import static org.apache.jena.rdf.model.ResourceFactory.*; +import static org.assertj.core.api.Assertions.allOf; +import static org.assertj.core.api.Assertions.assertThat; + +class TreeRelationResponseTest { + + private static final String HOST_NAME = "http://localhost:8080"; + private static final String COLLECTION_NAME = "mobility-hindrances"; + private static final String VIEW_NAME = "view"; + + @Test + void when_RelationsAreNotEmpty_MultipleStatementsAreReturned() { + TreeRelationResponse treeRelation = new TreeRelationResponse("path", + HOST_NAME + "/" + COLLECTION_NAME + "/node", "value", + "http://www.w3.org/2001/XMLSchema#dateTime", "relation"); + + List statements = treeRelation + .convertToStatements(HOST_NAME + "/" + COLLECTION_NAME + "/" + VIEW_NAME); + + assertThat(statements) + .hasSize(5) + .has(relationStatements()); + } + + @Test + void given_ByReferenceTreeNode_when_ConvertToStatements_then_StatementsContainTreeValueAsResource() { + TreeRelationResponse treeRelation = new TreeRelationResponse("path", + HOST_NAME + "/" + COLLECTION_NAME + "/node", "https://data.vlaanderen.be/ns/verkeersmetingen#Verkeersmeetpunt", + XSDDatatype.XSDanyURI.getURI(), "relation"); + + List statements = treeRelation + .convertToStatements(HOST_NAME + "/" + COLLECTION_NAME + "/" + VIEW_NAME); + + assertThat(statements) + .hasSize(5) + .filteredOn(statement -> statement.getPredicate().equals(TREE_VALUE)) + .first() + .matches(statement -> statement.getObject().isResource()); + } + + + private Condition> relationStatements() { + return allOf( + containingSubject(createResource(HOST_NAME + "/" + COLLECTION_NAME + "/" + VIEW_NAME), createProperty("https://w3id.org/tree#relation")), + containingObject(RDF.type, createResource("relation")), + containingObject(createProperty("https://w3id.org/tree#path"), createProperty("path")), + containingObject(createProperty("https://w3id.org/tree#node"), createResource("http://localhost:8080/mobility-hindrances/node")), + containingObject(createProperty("https://w3id.org/tree#value"), createTypedLiteral("value", XSDDatatype.XSDdateTime)) + ); + } + + private Condition> containingSubject(Resource subject, Property predicate) { + return new Condition<>( + statements -> statements.stream() + .anyMatch(statement -> statement.getSubject().equals(subject) && statement.getPredicate().equals(predicate)), + "TreeNode must contain statement with subject %s and predicate %s", subject, predicate + ); + } + + private Condition> containingObject(Property predicate, RDFNode object) { + return new Condition<>( + statements -> statements.stream() + .anyMatch(statement -> statement.getPredicate().equals(predicate) && statement.getObject().equals(object)), + "TreeNode must contain statement with predicate %s and object %s", predicate, object + ); + } + +} \ No newline at end of file diff --git a/ldes-server-port-fetch-rest/src/test/resources/application-rest.yml b/ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/application-rest.yml similarity index 100% rename from ldes-server-port-fetch-rest/src/test/resources/application-rest.yml rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/application-rest.yml diff --git a/ldes-server-port-fetch-rest/src/test/resources/application-test.yml b/ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/application-test.yml similarity index 100% rename from ldes-server-port-fetch-rest/src/test/resources/application-test.yml rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/application-test.yml diff --git a/ldes-server-port-fetch-rest/src/test/resources/dcat/valid-server-dcat.ttl b/ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/dcat/valid-server-dcat.ttl similarity index 100% rename from ldes-server-port-fetch-rest/src/test/resources/dcat/valid-server-dcat.ttl rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/dcat/valid-server-dcat.ttl diff --git a/ldes-server-port-fetch-rest/src/test/resources/eventstream/streams/dcat-view-valid.ttl b/ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/eventstream/streams/dcat-view-valid.ttl similarity index 100% rename from ldes-server-port-fetch-rest/src/test/resources/eventstream/streams/dcat-view-valid.ttl rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/eventstream/streams/dcat-view-valid.ttl diff --git a/ldes-server-port-fetch-rest/src/test/resources/eventstream/streams/example-shape.ttl b/ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/eventstream/streams/example-shape.ttl similarity index 100% rename from ldes-server-port-fetch-rest/src/test/resources/eventstream/streams/example-shape.ttl rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/eventstream/streams/example-shape.ttl diff --git a/ldes-server-port-fetch-rest/src/test/resources/example-ldes-fragment.nq b/ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/example-ldes-fragment.nq similarity index 100% rename from ldes-server-port-fetch-rest/src/test/resources/example-ldes-fragment.nq rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/example-ldes-fragment.nq diff --git a/ldes-server-port-fetch-rest/src/test/resources/example-ldes-member.nq b/ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/example-ldes-member.nq similarity index 100% rename from ldes-server-port-fetch-rest/src/test/resources/example-ldes-member.nq rename to ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/example-ldes-member.nq diff --git a/ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/member-utf8-charset.nq b/ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/member-utf8-charset.nq new file mode 100644 index 0000000000..988f98bcce --- /dev/null +++ b/ldes-server-fetch/ldes-server-fetch-rest/src/test/resources/member-utf8-charset.nq @@ -0,0 +1,11 @@ + "2024-04-29T14:57:19Z"^^ . + . + . + _:Bac223c44717bb273efd762e7f709484c . + "Subsidie verfraaiing handelspanden aanvragen"@nl-be-x-informal . + . + . +_:Bac223c44717bb273efd762e7f709484c "Hoeveel bedraagt de subsidie?"@nl-be-x-informal . +_:Bac223c44717bb273efd762e7f709484c "

Mede dankzij de extra financiële ondersteuning van VLAIO (het Vlaams Agentschap voor Innoveren en Ondernemen)"@nl-be-x-informal . +_:Bac223c44717bb273efd762e7f709484c "你好"@nl-be-x-informal . +_:Bac223c44717bb273efd762e7f709484c . \ No newline at end of file diff --git a/ldes-server-fetch/pom.xml b/ldes-server-fetch/pom.xml new file mode 100644 index 0000000000..a25422d5b0 --- /dev/null +++ b/ldes-server-fetch/pom.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + + be.vlaanderen.informatievlaanderen.vsds + ldes-server + 3.5.0-SNAPSHOT + + pom + ldes-server-fetch + + + ldes-server-fetch-common + ldes-server-fetch-rest + + + \ No newline at end of file diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/pom.xml b/ldes-server-fragmentation/ldes-server-fragmentation-common/pom.xml similarity index 86% rename from ldes-fragmentisers/ldes-fragmentisers-common/pom.xml rename to ldes-server-fragmentation/ldes-server-fragmentation-common/pom.xml index a1267fbca0..3d9ecede3f 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-common/pom.xml +++ b/ldes-server-fragmentation/ldes-server-fragmentation-common/pom.xml @@ -3,22 +3,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - ldes-fragmentisers + ldes-server-fragmentation be.vlaanderen.informatievlaanderen.vsds - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT 4.0.0 - ldes-fragmentisers-common + ldes-server-fragmentation-common - - be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-ingest - ${project.version} - - org.springframework.boot diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationService.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationService.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationService.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationService.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategy.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategy.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategy.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategy.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchCollection.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchCollection.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchCollection.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchCollection.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchExecutor.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchExecutor.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchExecutor.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchExecutor.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyCollection.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyCollection.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyCollection.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyCollection.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyDecorator.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyDecorator.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyDecorator.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyDecorator.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyImpl.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyImpl.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyImpl.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyImpl.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyWrapper.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyWrapper.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyWrapper.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyWrapper.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/SchedulingConfigFragmentation.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/SchedulingConfigFragmentation.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/SchedulingConfigFragmentation.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/SchedulingConfigFragmentation.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BatchConfiguration.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BatchConfiguration.java similarity index 99% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BatchConfiguration.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BatchConfiguration.java index d05bccf3b9..cb13f332aa 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BatchConfiguration.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BatchConfiguration.java @@ -10,6 +10,7 @@ @Configuration public class BatchConfiguration { public static final String ASYNC_JOB_LAUNCHER = "asyncJobLauncher"; + @Bean(name = ASYNC_JOB_LAUNCHER) public JobLauncher simpleJobLauncher(JobRepository jobRepository) throws Exception { TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher(); diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketJobDefinitions.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketJobDefinitions.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketJobDefinitions.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketJobDefinitions.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketMetricUpdater.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketMetricUpdater.java similarity index 60% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketMetricUpdater.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketMetricUpdater.java index 120227aaa5..d7c5e598c2 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketMetricUpdater.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketMetricUpdater.java @@ -1,6 +1,6 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.batch; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.ServerMetrics; +import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.metrics.FragmentationMetricsService; import org.jetbrains.annotations.NotNull; import org.springframework.batch.core.ExitStatus; import org.springframework.batch.core.StepExecution; @@ -11,15 +11,15 @@ @Component public class BucketMetricUpdater implements StepExecutionListener { - private final ServerMetrics serverMetrics; + private final FragmentationMetricsService fragmentationMetricsService; - public BucketMetricUpdater(ServerMetrics serverMetrics) { - this.serverMetrics = serverMetrics; + public BucketMetricUpdater(FragmentationMetricsService fragmentationMetricsService) { + this.fragmentationMetricsService = fragmentationMetricsService; } @Override public ExitStatus afterStep(@NotNull StepExecution stepExecution) { - serverMetrics.updateBucketCounts(stepExecution.getJobParameters().getString(COLLECTION_NAME)); + fragmentationMetricsService.updateBucketCounts(stepExecution.getJobParameters().getString(COLLECTION_NAME)); return StepExecutionListener.super.afterStep(stepExecution); } } diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketProcessors.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketProcessors.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketProcessors.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/batch/BucketProcessors.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/Bucket.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/Bucket.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/Bucket.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/Bucket.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/BucketisedMember.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/BucketisedMember.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/BucketisedMember.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/BucketisedMember.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/ChildBucket.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/ChildBucket.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/ChildBucket.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/ChildBucket.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/FragmentationMember.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/FragmentationMember.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/FragmentationMember.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/FragmentationMember.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/UnprocessedView.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/UnprocessedView.java similarity index 99% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/UnprocessedView.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/UnprocessedView.java index fc51e6d948..0becbeca9f 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/UnprocessedView.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/UnprocessedView.java @@ -1,5 +1,4 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities; public record UnprocessedView(int collectionId, String collectionName, int viewId, String viewName) { - } diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/BucketDescriptorParseException.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/BucketDescriptorParseException.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/BucketDescriptorParseException.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/BucketDescriptorParseException.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/DuplicateFragmentPairException.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/DuplicateFragmentPairException.java old mode 100755 new mode 100644 similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/DuplicateFragmentPairException.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/DuplicateFragmentPairException.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/FragmentationJobException.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/FragmentationJobException.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/FragmentationJobException.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/FragmentationJobException.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/MissingFragmentValueException.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/MissingFragmentValueException.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/MissingFragmentValueException.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/MissingFragmentValueException.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/MissingRootFragmentException.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/MissingRootFragmentException.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/MissingRootFragmentException.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/exceptions/MissingRootFragmentException.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/FragmentationStrategyCreator.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/FragmentationStrategyCreator.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/FragmentationStrategyCreator.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/FragmentationStrategyCreator.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/FragmentationStrategyCreatorImpl.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/FragmentationStrategyCreatorImpl.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/FragmentationStrategyCreatorImpl.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/FragmentationStrategyCreatorImpl.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/RootBucketCreator.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/RootBucketCreator.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/RootBucketCreator.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/RootBucketCreator.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/RootBucketCreatorImpl.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/RootBucketCreatorImpl.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/RootBucketCreatorImpl.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/factory/RootBucketCreatorImpl.java diff --git a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/services/ServerMetrics.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/metrics/FragmentationMetricsService.java similarity index 74% rename from ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/services/ServerMetrics.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/metrics/FragmentationMetricsService.java index bf8dd3943a..48dcd57f4e 100644 --- a/ldes-server-domain/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/domain/services/ServerMetrics.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/metrics/FragmentationMetricsService.java @@ -1,10 +1,11 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.domain.services; +package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.metrics; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamCreatedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamDeletedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.ViewDeletedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.ViewInitializationEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.FragmentationMetricsRepository; import io.micrometer.core.instrument.Metrics; import io.micrometer.core.instrument.Tags; import io.micrometer.core.instrument.config.MeterFilter; @@ -16,48 +17,22 @@ import java.util.concurrent.atomic.AtomicInteger; @Component -public class ServerMetrics { - public static final String INGEST = "ldes_server_ingested_members_count"; +public class FragmentationMetricsService { public static final String BUCKET = "ldes_server_bucket_members_count"; public static final String PAGINATE = "ldes_server_pagination_members_count"; public static final String COLLECTION = "collection"; public static final String VIEW = "view"; private final FragmentationMetricsRepository fragmentationMetricsRepository; - private final MemberMetricsRepository memberMetricsRepository; - private final Map membersIngested = new HashMap<>(); private final Map membersBucketised = new HashMap<>(); private final Map membersPaginated = new HashMap<>(); - public ServerMetrics(FragmentationMetricsRepository fragmentationMetricsRepository, MemberMetricsRepository memberMetricsRepository) { + public FragmentationMetricsService(FragmentationMetricsRepository fragmentationMetricsRepository) { this.fragmentationMetricsRepository = fragmentationMetricsRepository; - this.memberMetricsRepository = memberMetricsRepository; Metrics.globalRegistry.config() .meterFilter(MeterFilter.denyNameStartsWith("spring.batch.item")) .meterFilter(MeterFilter.denyNameStartsWith("spring.batch.chunk")); } - public synchronized void incrementIngestCount(String collection, int count) { - membersIngested.computeIfAbsent(collection, s -> - Metrics.gauge(INGEST, Tags.of(COLLECTION, collection), - new AtomicInteger(0))); - membersIngested.get(collection).addAndGet(count); - } - - public synchronized void resetIngestCount(String collection) { - membersIngested.computeIfAbsent(collection, s -> - Metrics.gauge(INGEST, Tags.of(COLLECTION, collection), - new AtomicInteger(0))); - membersIngested.get(collection).set(0); - } - - public synchronized void updateIngestCount(String collection) { - int count = memberMetricsRepository.getTotalCount(collection); - membersIngested.computeIfAbsent(collection, s -> - Metrics.gauge(INGEST, Tags.of(COLLECTION, collection), - new AtomicInteger(count))); - membersIngested.get(collection).set(count); - } - public synchronized void updateBucketCounts(String collection) { fragmentationMetricsRepository.getBucketisedMemberCounts(collection) .forEach(metric -> { @@ -100,8 +75,6 @@ public synchronized void resetPaginationCount(ViewName viewName) { @EventListener public void handleEvenStreamCreated(EventStreamCreatedEvent event){ - resetIngestCount(event.eventStream().getCollection()); - membersBucketised.keySet() .stream() .filter(viewName -> viewName.getCollectionName().equals(event.eventStream().getCollection())) @@ -114,8 +87,6 @@ public void handleEvenStreamCreated(EventStreamCreatedEvent event){ @EventListener public void handleEventStreamDeletedEvent(EventStreamDeletedEvent event) { - resetIngestCount(event.collectionName()); - membersBucketised.keySet() .stream() .filter(viewName -> viewName.getCollectionName().equals(event.collectionName())) @@ -128,7 +99,6 @@ public void handleEventStreamDeletedEvent(EventStreamDeletedEvent event) { @EventListener public void handleViewCreatedEvent(ViewInitializationEvent event) { - updateIngestCount(event.getViewName().getCollectionName()); updateBucketCounts(event.getViewName().getCollectionName()); updatePaginationCounts(event.getViewName().getCollectionName()); } diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/metrics/MetricsConstants.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/metrics/MetricsConstants.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/metrics/MetricsConstants.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/metrics/MetricsConstants.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/relations/RelationsAttributer.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/relations/RelationsAttributer.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/relations/RelationsAttributer.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/relations/RelationsAttributer.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/repository/BucketRepository.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/repository/BucketRepository.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/repository/BucketRepository.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/repository/BucketRepository.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/repository/UnprocessedViewRepository.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/repository/UnprocessedViewRepository.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/repository/UnprocessedViewRepository.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/repository/UnprocessedViewRepository.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptor.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptor.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptor.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptor.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptorPair.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptorPair.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptorPair.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptorPair.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketRelation.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketRelation.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketRelation.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketRelation.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/EventStreamProperties.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/EventStreamProperties.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/EventStreamProperties.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/EventStreamProperties.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/TreeRelation.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/TreeRelation.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/TreeRelation.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/TreeRelation.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/module-info.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/module-info.java similarity index 95% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/module-info.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/module-info.java index a139eaa489..a9005d06fc 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-common/src/main/java/module-info.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/main/java/module-info.java @@ -1,5 +1,4 @@ open module ldes.fragmentation.domain { - requires ldes.ingest.domain; requires ldes.domain; requires spring.batch.core; requires spring.batch.infrastructure; diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationServiceTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationServiceTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationServiceTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationServiceTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchCollectionTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchCollectionTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchCollectionTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchCollectionTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchExecutorTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchExecutorTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchExecutorTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyBatchExecutorTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyCreatorImplTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyCreatorImplTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyCreatorImplTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyCreatorImplTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyDecoratorTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyDecoratorTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyDecoratorTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyDecoratorTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyImplTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyImplTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyImplTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/FragmentationStrategyImplTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/RootBucketCreatorImplTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/RootBucketCreatorImplTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/RootBucketCreatorImplTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/RootBucketCreatorImplTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/SpringBatchConfiguration.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/SpringBatchConfiguration.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/SpringBatchConfiguration.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/SpringBatchConfiguration.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/BucketTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/BucketTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/BucketTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/BucketTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/FragmentationMemberTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/FragmentationMemberTest.java similarity index 92% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/FragmentationMemberTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/FragmentationMemberTest.java index 435a0eaa2a..efd0c48c92 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/FragmentationMemberTest.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/entities/FragmentationMemberTest.java @@ -33,7 +33,7 @@ void given_versionObject_test_GetVersionModel() { @Test void given_stateObject_test_GetVersionModel() { final EventStreamProperties eventStreamProperties = new EventStreamProperties(COLLECTION_NAME, VERSION_OF_PATH, TIMESTAMP_PATH, false); - final Model model = RDFParser.fromString(" \"Bart\" .").lang(Lang.TTL).toModel(); + final Model model = RDFParser.create().fromString(" \"Bart\" .").lang(Lang.TTL).toModel(); final FragmentationMember fragmentationMember = new FragmentationMember(1, SUBJECT, IS_VERSION_OF, TIMESTAMP, eventStreamProperties, model ); final Model actual = fragmentationMember.getVersionModel(); diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptorTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptorTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptorTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/valueobjects/BucketDescriptorTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/resources/application-test.yml b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/resources/application-test.yml similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/resources/application-test.yml rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/resources/application-test.yml diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/resources/example-ldes-member.nq b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/resources/example-ldes-member.nq similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/resources/example-ldes-member.nq rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/resources/example-ldes-member.nq diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/resources/state-member.ttl b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/resources/state-member.ttl similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/resources/state-member.ttl rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/resources/state-member.ttl diff --git a/ldes-fragmentisers/ldes-fragmentisers-common/src/test/resources/version-member.ttl b/ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/resources/version-member.ttl similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-common/src/test/resources/version-member.ttl rename to ldes-server-fragmentation/ldes-server-fragmentation-common/src/test/resources/version-member.ttl diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/content/geospatial_algorithm.drawio b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/content/geospatial_algorithm.drawio similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/content/geospatial_algorithm.drawio rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/content/geospatial_algorithm.drawio diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/content/geospatial_algorithm.drawio.png b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/content/geospatial_algorithm.drawio.png similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/content/geospatial_algorithm.drawio.png rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/content/geospatial_algorithm.drawio.png diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/pom.xml b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/pom.xml similarity index 91% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/pom.xml rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/pom.xml index b65945a328..52cbe74d8b 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-geospatial/pom.xml +++ b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/pom.xml @@ -1,13 +1,13 @@ - ldes-fragmentisers + ldes-server-fragmentation be.vlaanderen.informatievlaanderen.vsds - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT 4.0.0 - ldes-fragmentisers-geospatial + ldes-server-fragmentation-geospatial jar @@ -27,7 +27,7 @@ be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-common + ldes-server-fragmentation-common ${project.version} diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategy.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategy.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategy.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategy.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyAutoConfiguration.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyAutoConfiguration.java similarity index 95% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyAutoConfiguration.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyAutoConfiguration.java index e74226a055..32ef4a84d2 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyAutoConfiguration.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyAutoConfiguration.java @@ -30,7 +30,7 @@ public GeospatialFragmentationStrategyWrapper geospatialFragmentationStrategyWra @PostConstruct void triggerEspgDatabaseInitializationOnStartup() { String example = " \" POINT (0,0)\"^^ ."; - RDFParser.fromString(example).lang(Lang.NQUADS).build().toModel(); + RDFParser.create().fromString(example).lang(Lang.NQUADS).build().toModel(); } } diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyWrapper.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyWrapper.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyWrapper.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyWrapper.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/CoordinateToTileStringConverter.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/CoordinateToTileStringConverter.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/CoordinateToTileStringConverter.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/CoordinateToTileStringConverter.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/GeospatialBucketiser.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/GeospatialBucketiser.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/GeospatialBucketiser.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/GeospatialBucketiser.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/config/GeospatialConfig.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/config/GeospatialConfig.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/config/GeospatialConfig.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/config/GeospatialConfig.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/config/GeospatialProperties.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/config/GeospatialProperties.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/config/GeospatialProperties.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/config/GeospatialProperties.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/BoundingBox.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/BoundingBox.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/BoundingBox.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/BoundingBox.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/relations/TileBucketRelationsAttributer.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/relations/TileBucketRelationsAttributer.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/relations/TileBucketRelationsAttributer.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/relations/TileBucketRelationsAttributer.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/constants/GeospatialConstants.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/constants/GeospatialConstants.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/constants/GeospatialConstants.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/constants/GeospatialConstants.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/BoundingBoxConverter.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/BoundingBoxConverter.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/BoundingBoxConverter.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/BoundingBoxConverter.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/TileConverter.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/TileConverter.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/TileConverter.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/TileConverter.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/fragments/GeospatialBucketCreator.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/fragments/GeospatialBucketCreator.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/fragments/GeospatialBucketCreator.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/fragments/GeospatialBucketCreator.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/model/Tile.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/model/Tile.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/model/Tile.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/model/Tile.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/model/TileGrid.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/model/TileGrid.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/model/TileGrid.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/model/TileGrid.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyAutoConfigurationTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyAutoConfigurationTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyAutoConfigurationTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyAutoConfigurationTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyWrapperTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyWrapperTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyWrapperTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/GeospatialFragmentationStrategyWrapperTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/CoordinateToTileStringConverterTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/CoordinateToTileStringConverterTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/CoordinateToTileStringConverterTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/CoordinateToTileStringConverterTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/GeospatialBucketiserTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/GeospatialBucketiserTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/GeospatialBucketiserTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/bucketising/GeospatialBucketiserTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/relations/TileBucketRelationsAttributerTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/relations/TileBucketRelationsAttributerTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/relations/TileBucketRelationsAttributerTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/connected/relations/TileBucketRelationsAttributerTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/BoundingBoxConverterTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/BoundingBoxConverterTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/BoundingBoxConverterTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/converter/BoundingBoxConverterTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/fragments/GeospatialBucketCreatorTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/fragments/GeospatialBucketCreatorTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/fragments/GeospatialBucketCreatorTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/geospatial/fragments/GeospatialBucketCreatorTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/resources/examples/ldes-member-2-geo-props-bucketising-faulty.nq b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/resources/examples/ldes-member-2-geo-props-bucketising-faulty.nq similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/resources/examples/ldes-member-2-geo-props-bucketising-faulty.nq rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/resources/examples/ldes-member-2-geo-props-bucketising-faulty.nq diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/resources/examples/ldes-member-2-geo-props-bucketising.nq b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/resources/examples/ldes-member-2-geo-props-bucketising.nq similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/resources/examples/ldes-member-2-geo-props-bucketising.nq rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/resources/examples/ldes-member-2-geo-props-bucketising.nq diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/resources/examples/ldes-member-bucketising-faulty.nq b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/resources/examples/ldes-member-bucketising-faulty.nq similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/resources/examples/ldes-member-bucketising-faulty.nq rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/resources/examples/ldes-member-bucketising-faulty.nq diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/resources/examples/ldes-member-bucketising-invalid-coordinates.nq b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/resources/examples/ldes-member-bucketising-invalid-coordinates.nq similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/resources/examples/ldes-member-bucketising-invalid-coordinates.nq rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/resources/examples/ldes-member-bucketising-invalid-coordinates.nq diff --git a/ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/resources/examples/ldes-member-bucketising.nq b/ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/resources/examples/ldes-member-bucketising.nq similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-geospatial/src/test/resources/examples/ldes-member-bucketising.nq rename to ldes-server-fragmentation/ldes-server-fragmentation-geospatial/src/test/resources/examples/ldes-member-bucketising.nq diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/content/reference_algorithm.svg b/ldes-server-fragmentation/ldes-server-fragmentation-reference/content/reference_algorithm.svg similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/content/reference_algorithm.svg rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/content/reference_algorithm.svg diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/pom.xml b/ldes-server-fragmentation/ldes-server-fragmentation-reference/pom.xml similarity index 82% rename from ldes-fragmentisers/ldes-fragmentisers-reference/pom.xml rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/pom.xml index b42c62e5eb..2076ca036f 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-reference/pom.xml +++ b/ldes-server-fragmentation/ldes-server-fragmentation-reference/pom.xml @@ -3,19 +3,19 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - ldes-fragmentisers + ldes-server-fragmentation be.vlaanderen.informatievlaanderen.vsds - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT 4.0.0 jar - ldes-fragmentisers-reference + ldes-server-fragmentation-reference be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-common + ldes-server-fragmentation-common ${project.version} compile diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategy.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategy.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategy.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategy.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyAutoConfiguration.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyAutoConfiguration.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyAutoConfiguration.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyAutoConfiguration.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyWrapper.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyWrapper.java similarity index 92% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyWrapper.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyWrapper.java index 6bbae30efe..aa085c9fc8 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyWrapper.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyWrapper.java @@ -8,13 +8,14 @@ import be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.fragmentation.ReferenceBucketCreator; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.relations.ReferenceFragmentRelationsAttributer; import io.micrometer.observation.ObservationRegistry; -import org.apache.jena.vocabulary.RDF; import org.springframework.context.ApplicationContext; +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.RDF_SYNTAX_TYPE; + public class ReferenceFragmentationStrategyWrapper implements FragmentationStrategyWrapper { public static final String FRAGMENTATION_PATH = "fragmentationPath"; - public static final String DEFAULT_FRAGMENTATION_PATH = RDF.type.getURI(); + public static final String DEFAULT_FRAGMENTATION_PATH = RDF_SYNTAX_TYPE.getURI(); public static final String FRAGMENTATION_KEY = "fragmentationKey"; public static final String DEFAULT_FRAGMENTATION_KEY = "reference"; diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/bucketising/ReferenceBucketiser.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/bucketising/ReferenceBucketiser.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/bucketising/ReferenceBucketiser.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/bucketising/ReferenceBucketiser.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/config/ReferenceConfig.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/config/ReferenceConfig.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/config/ReferenceConfig.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/config/ReferenceConfig.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/fragmentation/ReferenceBucketCreator.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/fragmentation/ReferenceBucketCreator.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/fragmentation/ReferenceBucketCreator.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/fragmentation/ReferenceBucketCreator.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/relations/ReferenceFragmentRelationsAttributer.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/relations/ReferenceFragmentRelationsAttributer.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/relations/ReferenceFragmentRelationsAttributer.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/relations/ReferenceFragmentRelationsAttributer.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyWrapperTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyWrapperTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyWrapperTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/ReferenceFragmentationStrategyWrapperTest.java diff --git a/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/bucketising/ReferenceBucketiserTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/bucketising/ReferenceBucketiserTest.java new file mode 100644 index 0000000000..ebcc668eff --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/bucketising/ReferenceBucketiserTest.java @@ -0,0 +1,62 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.bucketising; + +import be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.config.ReferenceConfig; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.riot.RDFParser; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.RDF_SYNTAX_TYPE; +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.ServerConstants.DEFAULT_BUCKET_STRING; +import static org.assertj.core.api.Assertions.assertThat; + +class ReferenceBucketiserTest { + + private ReferenceBucketiser referenceBucketiser; + + private final String memberId = "https://data.vlaanderen.be/id/perceel/13374D0779-00D003/2022-11-29T11:37:27+01:00"; + + @BeforeEach + void setUp() { + final ReferenceConfig referenceConfig = new ReferenceConfig(RDF_SYNTAX_TYPE.getURI()); + referenceBucketiser = new ReferenceBucketiser(referenceConfig); + } + + @Test + void shouldReturnSetOfFoundResources() { + Model model = RDFParser.source("member-with-two-types.ttl").toModel(); + + assertThat(referenceBucketiser.createReferences(memberId, model)) + .hasSize(2) + .contains("https://basisregisters.vlaanderen.be/implementatiemodel/gebouwenregister#Perceel") + .contains("https://basisregisters.vlaanderen.be/implementatiemodel/gebouwenregister#Gebouw"); + } + + @Test + void shouldReturnDefaultBucketString() { + Model model = RDFParser.source("member-with-two-types.ttl").toModel(); + + assertThat(referenceBucketiser.createReferences("faulty", model)) + .hasSize(1) + .contains(DEFAULT_BUCKET_STRING); + } + + @Test + void when_MemberHasInvalidURI_Then_ReturnOnlyCorrectBucket() { + Model model = RDFParser.source("member-with-two-types-faulty.ttl").toModel(); + + assertThat(referenceBucketiser.createReferences(memberId, model)) + .hasSize(1) + .contains("https://basisregisters.vlaanderen.be/implementatiemodel/gebouwenregister#Perceel"); + } + + @Test + void shouldSkipResultsThatAreNotUris() { + Model model = RDFParser.source("member-with-string-type.ttl").toModel(); + + assertThat(referenceBucketiser.createReferences(memberId, model)) + .hasSize(1) + .contains(DEFAULT_BUCKET_STRING); + } + +} \ No newline at end of file diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/fragmentation/ReferenceBucketCreatorTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/fragmentation/ReferenceBucketCreatorTest.java similarity index 94% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/fragmentation/ReferenceBucketCreatorTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/fragmentation/ReferenceBucketCreatorTest.java index 405e5650c2..470b11e042 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/fragmentation/ReferenceBucketCreatorTest.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/fragmentation/ReferenceBucketCreatorTest.java @@ -5,13 +5,13 @@ import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.valueobjects.BucketDescriptor; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.valueobjects.BucketDescriptorPair; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.relations.ReferenceFragmentRelationsAttributer; -import org.apache.jena.vocabulary.RDF; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.RDF_SYNTAX_TYPE; import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.ServerConstants.DEFAULT_BUCKET_STRING; import static be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.ReferenceFragmentationStrategyWrapper.DEFAULT_FRAGMENTATION_KEY; import static be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.fragmentation.ReferenceBucketCreator.FRAGMENT_KEY_REFERENCE_ROOT; @@ -23,7 +23,7 @@ class ReferenceBucketCreatorTest { private static final ViewName viewName = new ViewName("collectionName", "view"); private static final BucketDescriptorPair timebasedPair = new BucketDescriptorPair("year", "2023"); private static final BucketDescriptorPair referenceRootPair = new BucketDescriptorPair(DEFAULT_FRAGMENTATION_KEY, FRAGMENT_KEY_REFERENCE_ROOT); - private static final BucketDescriptorPair referencePair = new BucketDescriptorPair(DEFAULT_FRAGMENTATION_KEY, RDF.type.getURI()); + private static final BucketDescriptorPair referencePair = new BucketDescriptorPair(DEFAULT_FRAGMENTATION_KEY, RDF_SYNTAX_TYPE.getURI()); private static final BucketDescriptorPair defaultPair = new BucketDescriptorPair(DEFAULT_FRAGMENTATION_KEY, DEFAULT_BUCKET_STRING); private ReferenceBucketCreator referenceBucketCreator; @Mock @@ -41,9 +41,9 @@ void when_ReferenceFragmentDoesExist_RetrievedReferenceFragmentIsReturned() { Bucket referenceBucket = bucket.createChild(referencePair); when(relationsAttributer.addRelationFromRootToBottom(rootBucket, bucket.createChild(referencePair))).thenReturn(referenceBucket); - Bucket childBucket = referenceBucketCreator.getOrCreateBucket(bucket, RDF.type.getURI(), rootBucket); + Bucket childBucket = referenceBucketCreator.getOrCreateBucket(bucket, RDF_SYNTAX_TYPE.getURI(), rootBucket); - assertThat(childBucket.getBucketDescriptorAsString()).isEqualTo("year=2023&reference=%s", RDF.type.getURI()); + assertThat(childBucket.getBucketDescriptorAsString()).isEqualTo("year=2023&reference=%s", RDF_SYNTAX_TYPE.getURI()); verify(relationsAttributer).addRelationFromRootToBottom(rootBucket, referenceBucket); } diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/relations/ReferenceFragmentRelationsAttributerTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/relations/ReferenceFragmentRelationsAttributerTest.java similarity index 95% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/relations/ReferenceFragmentRelationsAttributerTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/relations/ReferenceFragmentRelationsAttributerTest.java index 42c5a8ab58..31a3b43db8 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/relations/ReferenceFragmentRelationsAttributerTest.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/reference/relations/ReferenceFragmentRelationsAttributerTest.java @@ -7,12 +7,12 @@ import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.valueobjects.BucketDescriptorPair; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.valueobjects.TreeRelation; import org.apache.jena.datatypes.xsd.XSDDatatype; -import org.apache.jena.vocabulary.RDF; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.RDF_SYNTAX_TYPE; import static be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.ReferenceFragmentationStrategyWrapper.DEFAULT_FRAGMENTATION_KEY; import static be.vlaanderen.informatievlaanderen.ldes.server.fragmentisers.reference.relations.ReferenceFragmentRelationsAttributer.TREE_REFERENCE_EQUALS_RELATION; import static org.assertj.core.api.Assertions.assertThat; @@ -26,7 +26,7 @@ class ReferenceFragmentRelationsAttributerTest { private static final ViewName viewName = new ViewName("collectionName", "view"); private static final Bucket parentBucket = new Bucket(BucketDescriptor.empty(), viewName); - private final String fragmentationPath = RDF.type.getURI(); + private final String fragmentationPath = RDF_SYNTAX_TYPE.getURI(); private ReferenceFragmentRelationsAttributer relationsAttributer; diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/resources/member-with-string-type.ttl b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/resources/member-with-string-type.ttl similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/test/resources/member-with-string-type.ttl rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/resources/member-with-string-type.ttl diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/resources/member-with-two-types-faulty.ttl b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/resources/member-with-two-types-faulty.ttl similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/test/resources/member-with-two-types-faulty.ttl rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/resources/member-with-two-types-faulty.ttl diff --git a/ldes-fragmentisers/ldes-fragmentisers-reference/src/test/resources/member-with-two-types.ttl b/ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/resources/member-with-two-types.ttl similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-reference/src/test/resources/member-with-two-types.ttl rename to ldes-server-fragmentation/ldes-server-fragmentation-reference/src/test/resources/member-with-two-types.ttl diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/pom.xml b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/pom.xml similarity index 85% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/pom.xml rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/pom.xml index 42851309bc..5ffc84b11d 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/pom.xml +++ b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/pom.xml @@ -5,11 +5,11 @@ 4.0.0 be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers - 3.4.1-SNAPSHOT + ldes-server-fragmentation + 3.5.0-SNAPSHOT - ldes-fragmentisers-timebased-hierarchical + ldes-server-fragmentation-timebased-hierarchical @@ -28,7 +28,7 @@ be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-common + ldes-server-fragmentation-common ${project.version} diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategy.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategy.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategy.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategy.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyAutoConfiguration.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyAutoConfiguration.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyAutoConfiguration.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyAutoConfiguration.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyWrapper.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyWrapper.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyWrapper.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyWrapper.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/config/TimeBasedConfig.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/config/TimeBasedConfig.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/config/TimeBasedConfig.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/config/TimeBasedConfig.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/config/TimeBasedProperties.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/config/TimeBasedProperties.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/config/TimeBasedProperties.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/config/TimeBasedProperties.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/constants/Granularity.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/constants/Granularity.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/constants/Granularity.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/constants/Granularity.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/constants/TimeBasedConstants.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/constants/TimeBasedConstants.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/constants/TimeBasedConstants.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/constants/TimeBasedConstants.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/exceptions/FragmentiserConfigException.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/exceptions/FragmentiserConfigException.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/exceptions/FragmentiserConfigException.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/exceptions/FragmentiserConfigException.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/model/FragmentationTimestamp.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/model/FragmentationTimestamp.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/model/FragmentationTimestamp.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/model/FragmentationTimestamp.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketCreator.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketCreator.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketCreator.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketCreator.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketFinder.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketFinder.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketFinder.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketFinder.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedRelationsAttributer.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedRelationsAttributer.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedRelationsAttributer.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedRelationsAttributer.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalHierarchicalTimeBasedFragmentationStrategyWrapperTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalHierarchicalTimeBasedFragmentationStrategyWrapperTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalHierarchicalTimeBasedFragmentationStrategyWrapperTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalHierarchicalTimeBasedFragmentationStrategyWrapperTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyTest.java similarity index 90% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyTest.java index 466855288e..e3518d294c 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyTest.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/HierarchicalTimeBasedFragmentationStrategyTest.java @@ -16,6 +16,8 @@ import org.apache.jena.rdf.model.Model; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.mockito.InOrder; import org.mockito.Mockito; @@ -25,7 +27,8 @@ import static org.apache.jena.riot.RDFDataMgr.loadModel; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; class HierarchicalTimeBasedFragmentationStrategyTest { @@ -50,9 +53,10 @@ void setUp() { childBucket = new Bucket(new BucketDescriptor(List.of(new BucketDescriptorPair("is", "child"))), VIEW_NAME); } - @Test - void when_BucketisationCalled_Then_FunctionsAreCalled() { - Model model = loadModel("member_with_created_property.nq"); + @ParameterizedTest + @ValueSource(strings = {"member_with_created_property.nq", "member_with_string_created_property.nq", "member_without_created_property.nq"}) + void when_BucketisationCalled_Then_FunctionsAreCalled(String filename) { + Model model = loadModel(filename); FragmentationMember member = new FragmentationMember(1, "subject", "versionOf", TIME, EVENT_STREAM_PROPERTIES, model); FragmentationTimestamp fragmentationTimestamp = new FragmentationTimestamp(TIME, GRANULARITY); when(bucketFinder.getLowestBucket(parentBucket, fragmentationTimestamp, Granularity.YEAR)) diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/model/FragmentationTimestampTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/model/FragmentationTimestampTest.java similarity index 99% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/model/FragmentationTimestampTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/model/FragmentationTimestampTest.java index 3f2233827e..5df89f840a 100644 --- a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/model/FragmentationTimestampTest.java +++ b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/model/FragmentationTimestampTest.java @@ -81,7 +81,7 @@ public Stream provideArguments(ExtensionContext extensionCo Arguments.of(TIME6am, Granularity.SECOND, "2023-01-02T06:30:40"), Arguments.of(TIME6pm, Granularity.SECOND, "2023-01-02T18:30:40")); } - }; + } static class EqualityTestProvider implements ArgumentsProvider { private static final FragmentationTimestamp time = new FragmentationTimestamp( diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketCreatorTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketCreatorTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketCreatorTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketCreatorTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketFinderTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketFinderTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketFinderTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedBucketFinderTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedRelationsAttributerTest.java b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedRelationsAttributerTest.java similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedRelationsAttributerTest.java rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentisers/timebasedhierarchical/services/TimeBasedRelationsAttributerTest.java diff --git a/ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/resources/member_with_created_property.nq b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/resources/member_with_created_property.nq similarity index 100% rename from ldes-fragmentisers/ldes-fragmentisers-timebased-hierarchical/src/test/resources/member_with_created_property.nq rename to ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/resources/member_with_created_property.nq diff --git a/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/resources/member_with_string_created_property.nq b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/resources/member_with_string_created_property.nq new file mode 100644 index 0000000000..3bb323b999 --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/resources/member_with_string_created_property.nq @@ -0,0 +1,3 @@ +_:b0 "2023-01-01T00:00:00.000Z"^^ . +_:b0 "Professor" . +_:b0 "Jane Doe" . \ No newline at end of file diff --git a/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/resources/member_without_created_property.nq b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/resources/member_without_created_property.nq new file mode 100644 index 0000000000..f3cb97b7d4 --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-fragmentation-timebased-hierarchical/src/test/resources/member_without_created_property.nq @@ -0,0 +1,3 @@ +_:b0 "2023-01-01T00:00:00.000Z" . +_:b0 "Professor" . +_:b0 "Jane Doe" . \ No newline at end of file diff --git a/ldes-server-pagination/pom.xml b/ldes-server-fragmentation/ldes-server-pagination/pom.xml similarity index 83% rename from ldes-server-pagination/pom.xml rename to ldes-server-fragmentation/ldes-server-pagination/pom.xml index 2e025d18d4..2d20f0414f 100644 --- a/ldes-server-pagination/pom.xml +++ b/ldes-server-fragmentation/ldes-server-pagination/pom.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + ldes-server-fragmentation be.vlaanderen.informatievlaanderen.vsds - ldes-server - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT ldes-server-pagination @@ -26,18 +26,9 @@ spring-boot-configuration-processor - - ${project.groupId} - ldes-server-domain - - - be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-common - ${project.version} - be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-fetch + ldes-server-fragmentation-common ${project.version} diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginationJobDefinitions.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginationJobDefinitions.java similarity index 100% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginationJobDefinitions.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginationJobDefinitions.java diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginationMetricUpdater.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginationMetricUpdater.java similarity index 60% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginationMetricUpdater.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginationMetricUpdater.java index caeb7bb018..101c40eb6a 100644 --- a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginationMetricUpdater.java +++ b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginationMetricUpdater.java @@ -1,6 +1,6 @@ package be.vlaanderen.informatievlaanderen.ldes.server.pagination.batch; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.ServerMetrics; +import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.metrics.FragmentationMetricsService; import org.jetbrains.annotations.NotNull; import org.springframework.batch.core.ExitStatus; import org.springframework.batch.core.StepExecution; @@ -11,15 +11,15 @@ @Component public class PaginationMetricUpdater implements StepExecutionListener { - private final ServerMetrics serverMetrics; + private final FragmentationMetricsService fragmentationMetricsService; - public PaginationMetricUpdater(ServerMetrics serverMetrics) { - this.serverMetrics = serverMetrics; + public PaginationMetricUpdater(FragmentationMetricsService fragmentationMetricsService) { + this.fragmentationMetricsService = fragmentationMetricsService; } @Override public ExitStatus afterStep(@NotNull StepExecution stepExecution) { - serverMetrics.updatePaginationCounts(stepExecution.getJobParameters().getString(COLLECTION_NAME)); + fragmentationMetricsService.updatePaginationCounts(stepExecution.getJobParameters().getString(COLLECTION_NAME)); return StepExecutionListener.super.afterStep(stepExecution); } } diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/Paginator.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/Paginator.java similarity index 79% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/Paginator.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/Paginator.java index 69a6664a0f..e15d32d9bc 100644 --- a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/Paginator.java +++ b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/Paginator.java @@ -8,6 +8,7 @@ import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.repeat.RepeatStatus; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Component; import java.util.List; @@ -16,10 +17,12 @@ public class Paginator implements Tasklet { private final PageMemberRepository pageMemberRepository; private final PageRepository pageRepository; + private final JdbcTemplate jdbcTemplate; - public Paginator(PageMemberRepository pageMemberRepository, PageRepository pageRepository) { + public Paginator(PageMemberRepository pageMemberRepository, PageRepository pageRepository, JdbcTemplate jdbcTemplate) { this.pageMemberRepository = pageMemberRepository; this.pageRepository = pageRepository; + this.jdbcTemplate = jdbcTemplate; } @Override @@ -48,6 +51,8 @@ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkCon openPage = fillPageWithMembers(openPage, pageMembers); } + updateViewStats(members.size(), Long.parseLong(chunkContext.getStepContext().getJobParameters().get("viewId").toString())); + return RepeatStatus.FINISHED; } @@ -62,4 +67,14 @@ private Page fillPageWithMembers(Page openPage, List pageMembers) { return openPage; } } + + private void updateViewStats(long uniqueMemberCount, long viewId) { + String sql = """ + update view_stats vs set + paginated_count = vs.paginated_count + ? + where view_id = ?; + """; + + jdbcTemplate.update(sql, uniqueMemberCount, viewId); + } } diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/config/PaginationConfig.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/config/PaginationConfig.java similarity index 100% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/config/PaginationConfig.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/config/PaginationConfig.java diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/config/PaginationProperties.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/config/PaginationProperties.java similarity index 100% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/config/PaginationProperties.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/config/PaginationProperties.java diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/constants/PaginationConstants.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/constants/PaginationConstants.java similarity index 100% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/constants/PaginationConstants.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/constants/PaginationConstants.java diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/Page.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/Page.java similarity index 100% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/Page.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/Page.java diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/UnpagedMember.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/UnpagedMember.java similarity index 100% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/UnpagedMember.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/UnpagedMember.java diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageMemberRepository.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageMemberRepository.java similarity index 100% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageMemberRepository.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageMemberRepository.java diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageRelationRepository.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageRelationRepository.java similarity index 64% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageRelationRepository.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageRelationRepository.java index 0339e1e3ed..fee04120e1 100644 --- a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageRelationRepository.java +++ b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageRelationRepository.java @@ -1,9 +1,5 @@ package be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories; -import java.util.List; - public interface PageRelationRepository { void insertGenericBucketRelation(long fromPageId, long toPageId); - - void updateCompactionBucketRelations(List compactedPageIds, long targetId); } diff --git a/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageRepository.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageRepository.java new file mode 100644 index 0000000000..1b7f72110d --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/repositories/PageRepository.java @@ -0,0 +1,9 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories; + +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.entities.Page; + +public interface PageRepository { + Page getOpenPage(long bucketId); + Page createNextPage(Page parentPage); + void markAllPagesImmutableByCollectionName(String collectionName); +} diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/EventStreamClosedEventHandler.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/EventStreamClosedEventHandler.java similarity index 100% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/EventStreamClosedEventHandler.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/EventStreamClosedEventHandler.java diff --git a/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/PageNumberParser.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/PageNumberParser.java new file mode 100644 index 0000000000..a80806449e --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/PageNumberParser.java @@ -0,0 +1,23 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.pagination.services; + +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.NumericPageNumber; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.PageNumber; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.UuidPageNumber; +import org.apache.commons.lang3.math.NumberUtils; + +import static be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.PageNumber.PAGE_NUMBER_KEY; + +public class PageNumberParser { + public static PageNumber parse(String pageNumberString) { + if (!pageNumberString.contains(PAGE_NUMBER_KEY)) { + throw new IllegalArgumentException("Invalid page number: %s - Expected format: %s=".formatted(pageNumberString, PAGE_NUMBER_KEY)); + } + final String value = pageNumberString.replace(PAGE_NUMBER_KEY + "=", ""); + if(NumberUtils.isCreatable(value)) { + return new NumericPageNumber(Integer.parseInt(value)); + } + return UuidPageNumber.fromString(value); + } + + private PageNumberParser() {} +} diff --git a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrl.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrl.java similarity index 71% rename from ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrl.java rename to ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrl.java index 4db246bd54..8470aeaf6d 100644 --- a/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrl.java +++ b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrl.java @@ -1,6 +1,10 @@ package be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects; -import static be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.PageNumber.PAGE_NUMBER; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.services.PageNumberParser; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.NumericPageNumber; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.PageNumber; + +import static be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.PageNumber.PAGE_NUMBER_KEY; public class PartialUrl { private final String viewName; @@ -27,7 +31,7 @@ public PartialUrl createChild() { return new PartialUrl( viewName, bucketDescriptor, - pageNumber == null ? PageNumber.startPageNumber() : pageNumber.increment() + pageNumber == null ? NumericPageNumber.startPageNumber() : pageNumber.getNextPageNumber() ); } @@ -42,7 +46,7 @@ public static PartialUrl fromUrl(String url) { } if (isUrlOnlyPaged(parts[1])) { - return new PartialUrl(viewName, "", PageNumber.fromString(parts[1])); + return new PartialUrl(viewName, "", PageNumberParser.parse(parts[1])); } return createCompletePartialUrl(viewName, parts[1]); @@ -53,17 +57,17 @@ public boolean isNumberLess() { } private static boolean isUrlNumberless(String extendedDescriptor) { - return !extendedDescriptor.contains(PAGE_NUMBER); + return !extendedDescriptor.contains(PAGE_NUMBER_KEY); } private static boolean isUrlOnlyPaged(String extendedDescriptor) { - return extendedDescriptor.startsWith(PAGE_NUMBER); + return extendedDescriptor.startsWith(PAGE_NUMBER_KEY); } private static PartialUrl createCompletePartialUrl(String viewName, String extendedDescriptor) { final int lastIndex = extendedDescriptor.lastIndexOf("&"); final String bucketDescriptor = extendedDescriptor.substring(0, lastIndex); - final PageNumber pageNumber = PageNumber.fromString(extendedDescriptor.substring(lastIndex + 1)); + final PageNumber pageNumber = PageNumberParser.parse(extendedDescriptor.substring(lastIndex + 1)); return new PartialUrl(viewName, bucketDescriptor, pageNumber); } } diff --git a/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/NumericPageNumber.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/NumericPageNumber.java new file mode 100644 index 0000000000..5a5559cef1 --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/NumericPageNumber.java @@ -0,0 +1,37 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber; + +public class NumericPageNumber implements PageNumber { + private final int value; + + public NumericPageNumber(int value) { + this.value = value; + } + + @Override + public String asString() { + return PAGE_NUMBER_KEY + "=" + value; + } + + @Override + public PageNumber getNextPageNumber() { + return new NumericPageNumber(value + 1); + } + + public static PageNumber startPageNumber() { + return new NumericPageNumber(1); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof NumericPageNumber that)) return false; + return value == that.value; + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + value; + return result; + } +} diff --git a/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/PageNumber.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/PageNumber.java new file mode 100644 index 0000000000..6809268b3d --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/PageNumber.java @@ -0,0 +1,9 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber; + +public interface PageNumber { + String PAGE_NUMBER_KEY = "pageNumber"; + + String asString(); + + PageNumber getNextPageNumber(); +} diff --git a/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/UuidPageNumber.java b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/UuidPageNumber.java new file mode 100644 index 0000000000..fa66a6c957 --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-pagination/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/UuidPageNumber.java @@ -0,0 +1,46 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber; + +import java.util.Objects; +import java.util.UUID; + +public class UuidPageNumber implements PageNumber { + private final String value; + + public UuidPageNumber(UUID uuid) { + this.value = uuid.toString(); + } + + public UuidPageNumber() { + this.value = UUID.randomUUID().toString(); + } + + public static UuidPageNumber fromString(String value) { + final UUID uuid = UUID.fromString(value); + return new UuidPageNumber(uuid); + } + + @Override + public String asString() { + return PAGE_NUMBER_KEY + "=" + value; + } + + @Override + public PageNumber getNextPageNumber() { + return new UuidPageNumber(); + } + + @Override + public final boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof UuidPageNumber that)) return false; + + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(value); + return result; + } +} diff --git a/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/SpringBatchConfiguration.java b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/SpringBatchConfiguration.java similarity index 100% rename from ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/SpringBatchConfiguration.java rename to ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/SpringBatchConfiguration.java diff --git a/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginatorTest.java b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginatorTest.java similarity index 88% rename from ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginatorTest.java rename to ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginatorTest.java index e07e51f0a7..2f09d4ae5f 100644 --- a/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginatorTest.java +++ b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/batch/PaginatorTest.java @@ -3,23 +3,28 @@ import be.vlaanderen.informatievlaanderen.ldes.server.pagination.entities.Page; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories.PageMemberRepository; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories.PageRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.PageNumber; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.PartialUrl; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.NumericPageNumber; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.*; import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.junit.jupiter.MockitoSettings; +import org.mockito.quality.Strictness; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.core.scope.context.StepContext; import org.springframework.batch.item.ExecutionContext; +import org.springframework.jdbc.core.JdbcTemplate; import java.util.List; +import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) +@MockitoSettings(strictness = Strictness.LENIENT) class PaginatorTest { private static final long BUCKET_ID = 1; private static final String VIEW_NAME = "event-stream/paged"; @@ -30,6 +35,8 @@ class PaginatorTest { private PageMemberRepository pageMemberRepository; @Mock private PageRepository pageRepository; + @Mock + private JdbcTemplate jdbcTemplate; @InjectMocks Paginator paginator; @Captor @@ -53,15 +60,15 @@ void when_Paginating_withNoUnexpectedMembers_doNothing() { @Test void when_Paginating_withNumberedOpenPage_expectCorrectPages() { mockBucketId(); - Page numberedPage = new Page(1, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new PageNumber(1)), PAGE_SIZE); + Page numberedPage = new Page(1, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new NumericPageNumber(1)), PAGE_SIZE); when(pageMemberRepository.getUnpaginatedMembersForBucket(BUCKET_ID)).thenReturn(List.of(1L, 2L, 3L, 4L, 5L)); when(pageRepository.getOpenPage(BUCKET_ID)) .thenReturn(numberedPage); when(pageRepository.createNextPage(any())) - .thenReturn(new Page(2, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new PageNumber(2)), PAGE_SIZE)) - .thenReturn(new Page(3, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new PageNumber(3)), PAGE_SIZE)); + .thenReturn(new Page(2, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new NumericPageNumber(2)), PAGE_SIZE)) + .thenReturn(new Page(3, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new NumericPageNumber(3)), PAGE_SIZE)); paginator.execute(null, chunkContext); @@ -88,8 +95,8 @@ void when_Paginating_withUnNumberedOpenPage_expectCorrectPages() { when(pageRepository.createNextPage(any())) .thenReturn(numberedPage) - .thenReturn(new Page(2, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new PageNumber(2)), PAGE_SIZE)) - .thenReturn(new Page(3, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new PageNumber(3)), PAGE_SIZE)); + .thenReturn(new Page(2, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new NumericPageNumber(2)), PAGE_SIZE)) + .thenReturn(new Page(3, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new NumericPageNumber(3)), PAGE_SIZE)); paginator.execute(null, chunkContext); @@ -107,14 +114,14 @@ void when_Paginating_withUnNumberedOpenPage_expectCorrectPages() { @Test void when_Paginating_withSemiFilledNumberedOpenPage_expectCorrectPages() { mockBucketId(); - Page numberedPage = new Page(1, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new PageNumber(1)), PAGE_SIZE,1); + Page numberedPage = new Page(1, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new NumericPageNumber(1)), PAGE_SIZE,1); when(pageMemberRepository.getUnpaginatedMembersForBucket(BUCKET_ID)).thenReturn(List.of(1L, 2L, 3L, 4L, 5L)); when(pageRepository.getOpenPage(BUCKET_ID)) .thenReturn(numberedPage); when(pageRepository.createNextPage(any())) - .thenReturn(new Page(2, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new PageNumber(2)), PAGE_SIZE)) - .thenReturn(new Page(3, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new PageNumber(3)), PAGE_SIZE)); + .thenReturn(new Page(2, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new NumericPageNumber(2)), PAGE_SIZE)) + .thenReturn(new Page(3, BUCKET_ID, new PartialUrl(VIEW_NAME, "", new NumericPageNumber(3)), PAGE_SIZE)); paginator.execute(null, chunkContext); @@ -138,10 +145,12 @@ private void mockBucketId() { StepContext stepContext = mock(StepContext.class); StepExecution stepExecution = mock(StepExecution.class); ExecutionContext executionContext = mock(ExecutionContext.class); + Map jobParameters = Map.of("viewId", 1); // Set up the mock behavior when(chunkContext.getStepContext()).thenReturn(stepContext); when(stepContext.getStepExecution()).thenReturn(stepExecution); + when(stepContext.getJobParameters()).thenReturn(jobParameters); when(stepExecution.getExecutionContext()).thenReturn(executionContext); when(executionContext.getLong("bucketId")).thenReturn(BUCKET_ID); } diff --git a/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/PageTest.java b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/PageTest.java similarity index 100% rename from ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/PageTest.java rename to ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/entities/PageTest.java diff --git a/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/EventStreamClosedEventHandlerTest.java b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/EventStreamClosedEventHandlerTest.java similarity index 100% rename from ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/EventStreamClosedEventHandlerTest.java rename to ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/EventStreamClosedEventHandlerTest.java diff --git a/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/PageNumberParserTest.java b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/PageNumberParserTest.java new file mode 100644 index 0000000000..79481703ff --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/services/PageNumberParserTest.java @@ -0,0 +1,44 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.pagination.services; + +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.NumericPageNumber; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.PageNumber; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.UuidPageNumber; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +class PageNumberParserTest { + @Test + void test_CreateNumericPageNumber() { + final String pageNumberString = "pageNumber=2"; + + final PageNumber pageNumber = PageNumberParser.parse(pageNumberString); + + assertThat(pageNumber).isEqualTo(new NumericPageNumber(2)); + } + + @Test + void test_UuidNumericPageNumber() { + final String pageNumberString = "pageNumber=26929514-237c-11ed-861d-0242ac120002"; + + final PageNumber pageNumber = PageNumberParser.parse(pageNumberString); + + assertThat(pageNumber).isEqualTo(UuidPageNumber.fromString("26929514-237c-11ed-861d-0242ac120002")); + } + + @ParameterizedTest(name = "{0}") + @CsvSource(textBlock = """ + 2,Invalid page number: 2 - Expected format: pageNumber= + pageNumber=a,Invalid UUID string: a, + pageNumber=26929514-237c-11ed-861d,Invalid UUID string: 26929514-237c-11ed-861d + pageNumber=26929514-237c-11ed-861d-237c-11ed-861d,UUID string too large + """) + void test_InvalidCreation(String pageNumberString, String expectedErrorMessage) { + assertThatThrownBy(() -> PageNumberParser.parse(pageNumberString)) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage(expectedErrorMessage); + } +} \ No newline at end of file diff --git a/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrlTest.java b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrlTest.java similarity index 55% rename from ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrlTest.java rename to ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrlTest.java index fcd4046af0..6f919747f8 100644 --- a/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrlTest.java +++ b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/PartialUrlTest.java @@ -1,5 +1,8 @@ package be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.NumericPageNumber; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.PageNumber; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber.UuidPageNumber; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -36,28 +39,49 @@ void test_CreateChild(PartialUrl partialUrl, PartialUrl expectedChild) { .isEqualTo(expectedChild); } + @ParameterizedTest + @ArgumentsSource(NumberedChildPartialUrlProvider.class) + void test_CreatedNumberedChild(String partialUrl, Class expectedInstanceClass) { + final PartialUrl child = PartialUrl.fromUrl(partialUrl).createChild(); + + assertThat(child) + .extracting("pageNumber") + .isInstanceOf(expectedInstanceClass); + } + static class PartialUrlProvider implements ArgumentsProvider { @Override - public Stream provideArguments(ExtensionContext extensionContext) throws Exception { + public Stream provideArguments(ExtensionContext extensionContext) { return Stream.of( Arguments.of("/event-stream/paged", new PartialUrl("event-stream/paged", "", null)), Arguments.of("/event-stream/by-loc?tile=15/142/123", new PartialUrl("event-stream/by-loc", "tile=15/142/123", null)), Arguments.of("/event-stream/by-time?year=2024&month=06&day=28", new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", null)), - Arguments.of("/event-stream/paged?pageNumber=2", new PartialUrl("event-stream/paged", "", new PageNumber(2))), - Arguments.of("/event-stream/by-time?year=2024&month=06&day=28&pageNumber=2", new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", new PageNumber(2))) + Arguments.of("/event-stream/paged?pageNumber=2", new PartialUrl("event-stream/paged", "", new NumericPageNumber(2))), + Arguments.of("/event-stream/by-time?year=2024&month=06&day=28&pageNumber=2", new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", new NumericPageNumber(2))), + Arguments.of("/event-stream/by-time?year=2024&month=06&day=28&pageNumber=26929514-237c-11ed-861d-0242ac120002", new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", UuidPageNumber.fromString("26929514-237c-11ed-861d-0242ac120002"))) ); } } static class ChildPartialUrlProvider implements ArgumentsProvider { @Override - public Stream provideArguments(ExtensionContext extensionContext) throws Exception { + public Stream provideArguments(ExtensionContext extensionContext) { + return Stream.of( + Arguments.of(new PartialUrl("event-stream/paged", "", null), new PartialUrl("event-stream/paged", "", new NumericPageNumber(1))), + Arguments.of(new PartialUrl("event-stream/by-loc", "tile=15/142/123", null), new PartialUrl("event-stream/by-loc", "tile=15/142/123", new NumericPageNumber(1))), + Arguments.of(new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", null), new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", new NumericPageNumber(1))), + Arguments.of(new PartialUrl("event-stream/paged", "", new NumericPageNumber(2)), new PartialUrl("event-stream/paged", "", new NumericPageNumber(3))), + Arguments.of(new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", new NumericPageNumber(2)), new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", new NumericPageNumber(3))) + ); + } + } + + static class NumberedChildPartialUrlProvider implements ArgumentsProvider { + @Override + public Stream provideArguments(ExtensionContext extensionContext) { return Stream.of( - Arguments.of(new PartialUrl("event-stream/paged", "", null), new PartialUrl("event-stream/paged", "", new PageNumber(1))), - Arguments.of(new PartialUrl("event-stream/by-loc", "tile=15/142/123", null), new PartialUrl("event-stream/by-loc", "tile=15/142/123", new PageNumber(1))), - Arguments.of(new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", null), new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", new PageNumber(1))), - Arguments.of(new PartialUrl("event-stream/paged", "", new PageNumber(2)), new PartialUrl("event-stream/paged", "", new PageNumber(3))), - Arguments.of(new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", new PageNumber(2)), new PartialUrl("event-stream/by-time", "year=2024&month=06&day=28", new PageNumber(3))) + Arguments.of("/event-stream/by-time?year=2024&month=06&day=28&pageNumber=2", NumericPageNumber.class), + Arguments.of("/event-stream/by-time?year=2024&month=06&day=28&pageNumber=26929514-237c-11ed-861d-0242ac120002", UuidPageNumber.class) ); } } diff --git a/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/NumericPageNumberTest.java b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/NumericPageNumberTest.java new file mode 100644 index 0000000000..d0d456fada --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/NumericPageNumberTest.java @@ -0,0 +1,45 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +class NumericPageNumberTest { + private static final int PAGE_NUMBER_VALUE = 3; + private static final NumericPageNumber PAGE_NUMBER = new NumericPageNumber(PAGE_NUMBER_VALUE); + + @Test + void testEquality() { + final NumericPageNumber other = new NumericPageNumber(PAGE_NUMBER_VALUE); + + assertThat(PAGE_NUMBER) + .isEqualTo(other) + .isEqualTo(PAGE_NUMBER) + .hasSameHashCodeAs(other); + assertThat(other) + .isEqualTo(PAGE_NUMBER); + } + + @ParameterizedTest + @MethodSource + void testInequality(Object other) { + assertThat(other).isNotEqualTo(PAGE_NUMBER); + + if(other != null) { + assertThat(other).doesNotHaveSameHashCodeAs(PAGE_NUMBER); + } + } + + static Stream testInequality() { + return Stream.of( + new NumericPageNumber(10), + PAGE_NUMBER_VALUE, + new UuidPageNumber(), + null + ); + } +} \ No newline at end of file diff --git a/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/UuidPageNumberTest.java b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/UuidPageNumberTest.java new file mode 100644 index 0000000000..bf5e8120da --- /dev/null +++ b/ldes-server-fragmentation/ldes-server-pagination/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/valueobjects/pagenumber/UuidPageNumberTest.java @@ -0,0 +1,45 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.pagination.valueobjects.pagenumber; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +class UuidPageNumberTest { + private static final String UUID = "26929514-237c-11ed-861d-0242ac120002"; + private static final UuidPageNumber PAGE_NUMBER = UuidPageNumber.fromString(UUID); + + @Test + void testEquality() { + final UuidPageNumber other = UuidPageNumber.fromString(UUID); + + assertThat(PAGE_NUMBER) + .isEqualTo(other) + .isEqualTo(PAGE_NUMBER) + .hasSameHashCodeAs(other); + assertThat(other) + .isEqualTo(PAGE_NUMBER); + } + + @ParameterizedTest + @MethodSource + void testInequality(Object other) { + assertThat(other).isNotEqualTo(PAGE_NUMBER); + + if(other != null) { + assertThat(other).doesNotHaveSameHashCodeAs(PAGE_NUMBER); + } + } + + static Stream testInequality() { + return Stream.of( + UuidPageNumber.fromString("fe15639d-526a-42e2-8d70-cbc239d7156c"), + UUID, + new NumericPageNumber(1), + null + ); + } +} \ No newline at end of file diff --git a/ldes-fragmentisers/pom.xml b/ldes-server-fragmentation/pom.xml similarity index 66% rename from ldes-fragmentisers/pom.xml rename to ldes-server-fragmentation/pom.xml index bc86763910..ad6635d5f2 100644 --- a/ldes-fragmentisers/pom.xml +++ b/ldes-server-fragmentation/pom.xml @@ -5,29 +5,20 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT - ldes-fragmentisers + ldes-server-fragmentation pom - ldes-fragmentisers-common - ldes-fragmentisers-geospatial - ldes-fragmentisers-timebased-hierarchical - ldes-fragmentisers-reference + ldes-server-fragmentation-common + ldes-server-pagination + ldes-server-fragmentation-geospatial + ldes-server-fragmentation-timebased-hierarchical + ldes-server-fragmentation-reference - - - - ${project.groupId} - ldes-fragmentisers-geospatial - ${project.version} - - - - diff --git a/ldes-server-infra-postgres/pom.xml b/ldes-server-infra-postgres/pom.xml index 0c6cc71c68..e69126616a 100644 --- a/ldes-server-infra-postgres/pom.xml +++ b/ldes-server-infra-postgres/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT pom @@ -14,15 +14,16 @@ postgres-admin-repository postgres-fragmentation-repository postgres-ingest-repository - postgres-retention-repository + postgres-maintenance-repository postgres-pagination-repository + postgres-fetch-repository ldes-server-infra-postgres - 42.6.0 + 42.7.4 3.7.4 @@ -61,7 +62,7 @@ io.zonky.test embedded-database-spring-test - 2.5.0 + 2.5.1 test diff --git a/ldes-server-infra-postgres/postgres-admin-repository/pom.xml b/ldes-server-infra-postgres/postgres-admin-repository/pom.xml index 78c5a3747f..b626ed90ae 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/pom.xml +++ b/ldes-server-infra-postgres/postgres-admin-repository/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server-infra-postgres - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT postgres-admin-repository @@ -14,7 +14,7 @@ be.vlaanderen.informatievlaanderen.vsds - ldes-server-admin + ldes-server-admin-common ${project.version} diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/ModelConverter.java b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/ModelConverter.java index 6906309ebf..58219e9056 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/ModelConverter.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/ModelConverter.java @@ -15,6 +15,6 @@ public String convertToDatabaseColumn(Model attribute) { @Override public Model convertToEntityAttribute(String dbData) { - return RDFParser.fromString(dbData).lang(PostgresAdminConstants.SERIALISATION_LANG).toModel(); + return RDFParser.create().fromString(dbData).lang(PostgresAdminConstants.SERIALISATION_LANG).toModel(); } } diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/ModelListConverter.java b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/ModelListConverter.java index f422049706..beca513ca3 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/ModelListConverter.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/ModelListConverter.java @@ -1,6 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres; import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.riot.RDFParser; @@ -8,6 +9,7 @@ import java.util.List; +@Converter public class ModelListConverter implements AttributeConverter, String> { @Override public String convertToDatabaseColumn(List attribute) { @@ -18,7 +20,7 @@ public String convertToDatabaseColumn(List attribute) { @Override public List convertToEntityAttribute(String dbData) { - return RDFParser.fromString(dbData) + return RDFParser.create().fromString(dbData) .lang(PostgresAdminConstants.SERIALISATION_LANG) .toModel() .listSubjects() diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatserver/DcatCatalogPostgresRepository.java b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatserver/DcatCatalogPostgresRepository.java index 1c9b932c65..97c7876b5c 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatserver/DcatCatalogPostgresRepository.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatserver/DcatCatalogPostgresRepository.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.dcatserver; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.entities.DcatServer; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repositories.DcatServerRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repository.DcatServerRepository; import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.dcatserver.repository.DcatCatalogEntityRepository; import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.dcatserver.service.DcatCatalogEntityConverter; import org.springframework.stereotype.Component; diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/entity/EventStreamEntity.java b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/entity/EventStreamEntity.java index b6977073c9..a6c8cb6da5 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/entity/EventStreamEntity.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/entity/EventStreamEntity.java @@ -27,8 +27,8 @@ public class EventStreamEntity { @Column(name = "version_of_path", nullable = false) private String versionOfPath; - @Column(name = "create_versions", nullable = false) - private Boolean versionCreationEnabled; + @Column(name = "version_delimiter") + private String versionDelimiter; @Column(name = "is_closed", nullable = false) private Boolean closed; @@ -51,11 +51,11 @@ public class EventStreamEntity { public EventStreamEntity() { } - public EventStreamEntity(String name, String timestampPath, String versionOfPath, Boolean versionCreationEnabled, Boolean closed, String skolemizationDomain) { + public EventStreamEntity(String name, String timestampPath, String versionOfPath, String versionDelimiter, Boolean closed, String skolemizationDomain) { this.name = name; this.timestampPath = timestampPath; this.versionOfPath = versionOfPath; - this.versionCreationEnabled = versionCreationEnabled; + this.versionDelimiter = versionDelimiter; this.closed = closed; this.skolemizationDomain = skolemizationDomain; } @@ -76,8 +76,8 @@ public String getVersionOfPath() { return versionOfPath; } - public boolean isVersionCreationEnabled() { - return versionCreationEnabled; + public String getVersionDelimiter() { + return versionDelimiter; } public boolean isClosed() { diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/mapper/EventStreamMapper.java b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/mapper/EventStreamMapper.java index d37d36e8e7..8bdd2ef5b3 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/mapper/EventStreamMapper.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/mapper/EventStreamMapper.java @@ -9,6 +9,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.view.mapper.ViewSpecificationMapper; import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.VersionCreationProperties; import java.util.List; @@ -21,7 +22,7 @@ public static EventStreamTO fromEntity(EventStreamEntity entity) { .withCollection(entity.getName()) .withTimestampPath(entity.getTimestampPath()) .withVersionOfPath(entity.getVersionOfPath()) - .withVersionCreationEnabled(entity.isVersionCreationEnabled()) + .withVersionDelimiter(entity.getVersionDelimiter()) .withClosed(entity.isClosed()) .withSkolemizationDomain(entity.getSkolemizationDomain()) .withViews(entity.getViews().stream().map(ViewSpecificationMapper::fromEntity).toList()) @@ -36,7 +37,7 @@ public static EventStream fromPropertiesProjection(EventStreamProperties project projection.getName(), projection.getTimestampPath(), projection.getVersionOfPath(), - projection.isVersionCreationEnabled(), + VersionCreationProperties.ofNullableDelimiter(projection.getVersionDelimiter()), projection.isClosed(), projection.getSkolemizationDomain() ); @@ -46,7 +47,7 @@ public static EventStreamEntity toEntity(EventStreamTO eventStream) { final EventStreamEntity entity = new EventStreamEntity(eventStream.getCollection(), eventStream.getTimestampPath(), eventStream.getVersionOfPath(), - eventStream.isVersionCreationEnabled(), + eventStream.getVersionDelimiter(), eventStream.isClosed(), eventStream.getSkolemizationDomain()); final List views = eventStream.getViews().stream() diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/projection/EventStreamProperties.java b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/projection/EventStreamProperties.java index 2bdf214639..63d6c01a7f 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/projection/EventStreamProperties.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/projection/EventStreamProperties.java @@ -4,7 +4,7 @@ public interface EventStreamProperties { String getName(); String getTimestampPath(); String getVersionOfPath(); - boolean isVersionCreationEnabled(); + String getVersionDelimiter(); boolean isClosed(); String getSkolemizationDomain(); } diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/view/entity/ViewEntity.java b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/view/entity/ViewEntity.java index cb8e3dcab5..e6d3e73905 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/view/entity/ViewEntity.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/view/entity/ViewEntity.java @@ -83,4 +83,5 @@ public void setEventStream(EventStreamEntity eventStream) { public String getName() { return name; } + } diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatdataset/DcatDatasetPostgresRepositoryTest.java b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatdataset/DcatDatasetPostgresRepositoryTest.java index 10a8a955b7..5f4b51667b 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatdataset/DcatDatasetPostgresRepositoryTest.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatdataset/DcatDatasetPostgresRepositoryTest.java @@ -146,7 +146,7 @@ private Model readDcatDatasetModel() { } private DcatDatasetEntity initializeEntity(Model dcatModel) { - final EventStreamEntity eventStreamEntity = new EventStreamEntity(DATASET_COLLECTION_NAME, "", "", false, false, null); + final EventStreamEntity eventStreamEntity = new EventStreamEntity(DATASET_COLLECTION_NAME, "", "", null, false, null); final DcatDatasetEntity datasetEntity = new DcatDatasetEntity(eventStreamEntity); datasetEntity.setModel(dcatModel); return datasetEntity; diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatserver/DcatServerPostgresRepositoryTest.java b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatserver/DcatServerPostgresRepositoryTest.java index 5ef8353618..b30181ee22 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatserver/DcatServerPostgresRepositoryTest.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/dcatserver/DcatServerPostgresRepositoryTest.java @@ -1,7 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.dcatserver; import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.entities.DcatServer; -import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repositories.DcatServerRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.dcat.dcatserver.repository.DcatServerRepository; import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.dcatserver.entity.DcatCatalogEntity; import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.dcatserver.repository.DcatCatalogEntityRepository; import org.apache.jena.rdf.model.ModelFactory; diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventsource/EventSourcePostgresRepositoryTest.java b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventsource/EventSourcePostgresRepositoryTest.java index 0c3e954d00..b24e5428b8 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventsource/EventSourcePostgresRepositoryTest.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventsource/EventSourcePostgresRepositoryTest.java @@ -22,7 +22,7 @@ class EventSourcePostgresRepositoryTest { private static final String COLLECTION_NAME = "testCollection"; private static final EventSource EVENT_SOURCE = new EventSource(COLLECTION_NAME, List.of()); private static final EventSourceEntity EVENT_SOURCE_ENTITY = new EventSourceEntity( - new EventStreamEntity(COLLECTION_NAME, "", "", false, false, null) + new EventStreamEntity(COLLECTION_NAME, "", "", null, false, null) ); @Mock diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/EventStreamPostgresRepositoryTest.java b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/EventStreamPostgresRepositoryTest.java index 1e2c56f894..a5d40906f8 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/EventStreamPostgresRepositoryTest.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/EventStreamPostgresRepositoryTest.java @@ -8,6 +8,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.view.entity.ViewEntity; import be.vlaanderen.informatievlaanderen.ldes.server.admin.spi.EventStreamTO; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.VersionCreationProperties; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification; import org.apache.jena.rdf.model.ModelFactory; @@ -33,10 +34,10 @@ class EventStreamPostgresRepositoryTest { private static final String TIMESTAMP_PATH = "timestampPath"; private static final String VERSION_OF_PATH = "versionOfPath"; private static final String SKOLEMIZATION_DOMAIN = "http://example.org"; - private static final EventStream EVENT_STREAM = new EventStream(COLLECTION_NAME, TIMESTAMP_PATH, VERSION_OF_PATH, false, SKOLEMIZATION_DOMAIN); + private static final EventStream EVENT_STREAM = new EventStream(COLLECTION_NAME, TIMESTAMP_PATH, VERSION_OF_PATH, VersionCreationProperties.disabled(), SKOLEMIZATION_DOMAIN); private static final EventStreamTO EVENT_STREAM_TO = new EventStreamTO.Builder().withEventStream(EVENT_STREAM).withShacl(ModelFactory.createDefaultModel()).build(); private static final EventStreamEntity EVENT_STREAM_ENTITY = createEventStreamEntity(COLLECTION_NAME); - private static final EventStreamProperties EVENT_STREAM_PROPERTIES = new EventStreamPropertiesTestImpl(COLLECTION_NAME, TIMESTAMP_PATH, VERSION_OF_PATH, false, false, SKOLEMIZATION_DOMAIN); + private static final EventStreamProperties EVENT_STREAM_PROPERTIES = new EventStreamPropertiesTestImpl(COLLECTION_NAME, TIMESTAMP_PATH, VERSION_OF_PATH, null, false, SKOLEMIZATION_DOMAIN); private EventStreamPostgresRepository repository; @Mock @@ -54,7 +55,7 @@ void when_dbHasEntities_then_returnAllProjections() { OTHER_COLLECTION_NAME, "created", "version", - false, + null, false, null ); @@ -64,7 +65,7 @@ void when_dbHasEntities_then_returnAllProjections() { )); final List expectedEventStreams = List.of( EVENT_STREAM, - new EventStream(OTHER_COLLECTION_NAME, "created", "version", false, null)); + new EventStream(OTHER_COLLECTION_NAME, "created", "version", VersionCreationProperties.disabled(), null)); final List eventStreams = repository.retrieveAllEventStreams(); @@ -111,11 +112,11 @@ void when_dbHasEntitiesInTwoDataModels_then_returnAllOnce() { final String otherVersionOfPath = "other-versionOf-path"; List expectedEventStreams = List.of( EVENT_STREAM, - new EventStream(OTHER_COLLECTION_NAME, otherTimestampPath, otherVersionOfPath, false, false, SKOLEMIZATION_DOMAIN) + new EventStream(OTHER_COLLECTION_NAME, otherTimestampPath, otherVersionOfPath, VersionCreationProperties.disabled(), false, SKOLEMIZATION_DOMAIN) ); when(eventStreamEntityRepository.findAllPropertiesBy()).thenReturn(List.of( EVENT_STREAM_PROPERTIES, - new EventStreamPropertiesTestImpl(OTHER_COLLECTION_NAME, otherTimestampPath, otherVersionOfPath, false, false, SKOLEMIZATION_DOMAIN) + new EventStreamPropertiesTestImpl(OTHER_COLLECTION_NAME, otherTimestampPath, otherVersionOfPath, null, false, SKOLEMIZATION_DOMAIN) )); List eventStreams = repository.retrieveAllEventStreams(); @@ -199,7 +200,7 @@ private static EventStreamEntity createEventStreamEntity(String collection) { collection, TIMESTAMP_PATH, VERSION_OF_PATH, - false, + null, false, SKOLEMIZATION_DOMAIN ); diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/EventStreamPropertiesTestImpl.java b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/EventStreamPropertiesTestImpl.java index 8945cb1358..bc70113b07 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/EventStreamPropertiesTestImpl.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/eventstream/EventStreamPropertiesTestImpl.java @@ -6,15 +6,15 @@ public class EventStreamPropertiesTestImpl implements EventStreamProperties { private final String name; private final String timestampPath; private final String versionOfPath; - private final boolean versionCreationEnabled; + private final String versionDelimiter; private final boolean closed; private final String skolemizationDomain; - public EventStreamPropertiesTestImpl(String name, String timestampPath, String versionOfPath, boolean versionCreationEnabled, boolean closed, String skolemizationDomain) { + public EventStreamPropertiesTestImpl(String name, String timestampPath, String versionOfPath, String versionDelimiter, boolean closed, String skolemizationDomain) { this.name = name; this.timestampPath = timestampPath; this.versionOfPath = versionOfPath; - this.versionCreationEnabled = versionCreationEnabled; + this.versionDelimiter = versionDelimiter; this.closed = closed; this.skolemizationDomain = skolemizationDomain; } @@ -35,8 +35,8 @@ public String getVersionOfPath() { } @Override - public boolean isVersionCreationEnabled() { - return versionCreationEnabled; + public String getVersionDelimiter() { + return versionDelimiter; } @Override diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/shaclshape/ShaclShapePostgresRepositoryTest.java b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/shaclshape/ShaclShapePostgresRepositoryTest.java index 2d275e8c1d..2a4f87d0e0 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/shaclshape/ShaclShapePostgresRepositoryTest.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/shaclshape/ShaclShapePostgresRepositoryTest.java @@ -107,7 +107,7 @@ void when_ShaclDeleted_then_ReturnEmptyWithRetrieval() { } private ShaclShapeEntity initShaclShapeEntity(Model model) { - final EventStreamEntity eventStreamEntity = new EventStreamEntity(COLLECTION, "", "", false, false, null); + final EventStreamEntity eventStreamEntity = new EventStreamEntity(COLLECTION, "", "", null, false, null); final ShaclShapeEntity shaclShapeEntity = new ShaclShapeEntity(eventStreamEntity); shaclShapeEntity.setModel(model); return shaclShapeEntity; diff --git a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/view/ViewPostgresRepositoryTest.java b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/view/ViewPostgresRepositoryTest.java index 515bfd467c..741d4f3341 100644 --- a/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/view/ViewPostgresRepositoryTest.java +++ b/ldes-server-infra-postgres/postgres-admin-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/admin/postgres/view/ViewPostgresRepositoryTest.java @@ -38,13 +38,13 @@ void test_retrievingAllViews_AND_retrievingAllViewsOfCollection() { when(viewEntityRepository.findAll()) .thenReturn(List.of( new ViewEntity(VIEW_NAME, List.of(), List.of(), 100) {{ - setEventStream(new EventStreamEntity(COLLECTION_NAME, null, null, false, false, null)); + setEventStream(new EventStreamEntity(COLLECTION_NAME, null, null, null, false, null)); }}, new ViewEntity("view2", List.of(), List.of(), 100) {{ - setEventStream(new EventStreamEntity(COLLECTION_NAME, null, null, false, false, null)); + setEventStream(new EventStreamEntity(COLLECTION_NAME, null, null, null, false, null)); }}, new ViewEntity("view1", List.of(), List.of(), 100) {{ - setEventStream(new EventStreamEntity("collection2", null, null, false, false, null)); + setEventStream(new EventStreamEntity("collection2", null, null, null, false, null)); }})); final List expectedViews = List.of( new ViewSpecification(new ViewName(COLLECTION_NAME, VIEW_NAME), List.of(), List.of(), 100), @@ -61,10 +61,10 @@ void test_RetrieveViewsOfCollection() { when(viewEntityRepository.findAllByCollectionName(COLLECTION_NAME)) .thenReturn(List.of( new ViewEntity(VIEW_NAME, List.of(), List.of(), 100) {{ - setEventStream(new EventStreamEntity(COLLECTION_NAME, null, null, false, false, null)); + setEventStream(new EventStreamEntity(COLLECTION_NAME, null, null, null, false, null)); }}, new ViewEntity("view2", List.of(), List.of(), 100) {{ - setEventStream(new EventStreamEntity(COLLECTION_NAME, null, null, false, false, null)); + setEventStream(new EventStreamEntity(COLLECTION_NAME, null, null, null, false, null)); }})); final List expectedViews = List.of( new ViewSpecification(new ViewName(COLLECTION_NAME, VIEW_NAME), List.of(), List.of(), 100), @@ -111,7 +111,7 @@ void test_deletingOfView() { @Test void test_getViewByViewName() { ViewEntity viewEntity = new ViewEntity(VIEW_NAME, List.of(), List.of(), 100); - viewEntity.setEventStream(new EventStreamEntity(COLLECTION_NAME, null, null, false, false, null)); + viewEntity.setEventStream(new EventStreamEntity(COLLECTION_NAME, null, null, null, false, null)); ViewSpecification expectedViewSpecification = new ViewSpecification(new ViewName(COLLECTION_NAME, VIEW_NAME), List.of(), List.of(), 100); diff --git a/ldes-server-infra-postgres/postgres-retention-repository/pom.xml b/ldes-server-infra-postgres/postgres-fetch-repository/pom.xml similarity index 74% rename from ldes-server-infra-postgres/postgres-retention-repository/pom.xml rename to ldes-server-infra-postgres/postgres-fetch-repository/pom.xml index 44d4b4765d..7dc8d274fb 100644 --- a/ldes-server-infra-postgres/postgres-retention-repository/pom.xml +++ b/ldes-server-infra-postgres/postgres-fetch-repository/pom.xml @@ -6,21 +6,21 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server-infra-postgres - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT - postgres-retention-repository + postgres-fetch-repository be.vlaanderen.informatievlaanderen.vsds - ldes-server-retention + ldes-server-fetch-common ${project.version} be.vlaanderen.informatievlaanderen.vsds - postgres-ingest-repository - ${project.version} + postgres-admin-repository + 3.5.0-SNAPSHOT compile diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/TreeMemberPostgresRepository.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/TreeMemberPostgresRepository.java new file mode 100644 index 0000000000..e58fc7ba5d --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/TreeMemberPostgresRepository.java @@ -0,0 +1,30 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres; + +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.mapper.MemberRowMapper; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.repository.TreeMemberRepository; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Component; + +import java.util.stream.Stream; + +@Component +public class TreeMemberPostgresRepository implements TreeMemberRepository { + + private final JdbcTemplate jdbcTemplate; + + public TreeMemberPostgresRepository(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + + @Override + public Stream findAllByTreeNodeUrl(String url) { + String sql = """ + SELECT m.subject, m.member_model + FROM members m + JOIN page_members USING (member_id) + JOIN pages p USING (page_id) + WHERE p.partial_url = ?"""; + return jdbcTemplate.query(sql, new MemberRowMapper(), url).stream(); + } +} diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/TreeNodePostgresRepository.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/TreeNodePostgresRepository.java similarity index 65% rename from ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/TreeNodePostgresRepository.java rename to ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/TreeNodePostgresRepository.java index e3fb6d592c..2da99fac23 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/TreeNodePostgresRepository.java +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/TreeNodePostgresRepository.java @@ -1,19 +1,17 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres; +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamCreatedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamDeletedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.mapper.TreeNodeMapper; +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.repository.FetchPageEntityRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.repository.FetchPageMemberEntityRepository; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.repository.TreeNodeRepository; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.services.versioncreation.VersionObjectCreator; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.services.versioncreation.VersionObjectCreatorFactory; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.mapper.TreeNodeMapper; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.projection.TreeRelationProjection; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.repository.PageEntityRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.repository.PageMemberEntityRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.repository.PageRelationEntityRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Repository; @@ -24,14 +22,12 @@ @Repository public class TreeNodePostgresRepository implements TreeNodeRepository { - private final PageEntityRepository pageEntityRepository; - private final PageRelationEntityRepository pageRelationEntityRepository; - private final PageMemberEntityRepository pageMemberEntityRepository; + private final FetchPageEntityRepository pageEntityRepository; + private final FetchPageMemberEntityRepository pageMemberEntityRepository; private final Map versionObjectCreatorMap = new HashMap<>(); - public TreeNodePostgresRepository(PageEntityRepository pageEntityRepository, PageRelationEntityRepository pageRelationEntityRepository, PageMemberEntityRepository pageMemberEntityRepository) { + public TreeNodePostgresRepository(FetchPageEntityRepository pageEntityRepository, FetchPageMemberEntityRepository pageMemberEntityRepository) { this.pageEntityRepository = pageEntityRepository; - this.pageRelationEntityRepository = pageRelationEntityRepository; this.pageMemberEntityRepository = pageMemberEntityRepository; } @@ -40,9 +36,7 @@ public Optional findByFragmentIdentifier(LdesFragmentIdentifier fragme return pageEntityRepository .findTreeNodeByPartialUrl(fragmentIdentifier.asDecodedFragmentId()) .map(page -> { - final List relations = pageRelationEntityRepository.findDistinctByFromPageId(page.getId()); - - var versionObjectCreator = versionObjectCreatorMap.get(page.getCollectionName()); + var versionObjectCreator = versionObjectCreatorMap.get(page.getBucket().getView().getEventStream().getName()); final List members = pageMemberEntityRepository.findAllMembersByPageId(page.getId()) .stream() @@ -51,7 +45,7 @@ public Optional findByFragmentIdentifier(LdesFragmentIdentifier fragme treeMemberProjection.getModel(), treeMemberProjection.getVersionOf(), treeMemberProjection.getTimestamp()))) .toList(); - return TreeNodeMapper.fromProjection(page, relations, members); + return TreeNodeMapper.fromPageEntity(page, members); }); } @@ -59,10 +53,7 @@ public Optional findByFragmentIdentifier(LdesFragmentIdentifier fragme public Optional findTreeNodeWithoutMembers(LdesFragmentIdentifier fragmentIdentifier) { return pageEntityRepository .findTreeNodeByPartialUrl(fragmentIdentifier.asDecodedFragmentId()) - .map(page -> { - final List relations = pageRelationEntityRepository.findDistinctByFromPageId(page.getId()); - return TreeNodeMapper.fromProjection(page, relations, List.of()); - }); + .map(page -> TreeNodeMapper.fromPageEntity(page, List.of())); } @EventListener diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchBucketEntity.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchBucketEntity.java new file mode 100644 index 0000000000..9c0bd25be2 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchBucketEntity.java @@ -0,0 +1,46 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity; + +import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.view.entity.ViewEntity; +import jakarta.persistence.*; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +@Entity +@Table(name = "buckets", indexes = @Index(unique = true, columnList = "view_id,bucket")) +public class FetchBucketEntity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "bucket_id", nullable = false, unique = true, columnDefinition = "BIGINT") + private Long bucketId; + + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinColumn(name = "view_id", nullable = false, columnDefinition = "INT") + private ViewEntity view; + + @Column(name = "bucket", columnDefinition = "VARCHAR(255)") + private String bucketDescriptor; + + public FetchBucketEntity() {} + + public FetchBucketEntity(Long bucketId) { + this.bucketId = bucketId; + } + + public FetchBucketEntity(ViewEntity view, String bucketDescriptor) { + this.view = view; + this.bucketDescriptor = bucketDescriptor; + } + + public Long getBucketId() { + return bucketId; + } + + public ViewEntity getView() { + return view; + } + + public String getBucketDescriptor() { + return bucketDescriptor; + } +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchMemberEntity.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchMemberEntity.java new file mode 100644 index 0000000000..6e13c718e3 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchMemberEntity.java @@ -0,0 +1,90 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity; + +import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.eventstream.entity.EventStreamEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.mapper.FetchMemberModelConverter; +import jakarta.persistence.*; +import org.apache.jena.rdf.model.Model; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "members", indexes = { + @Index(columnList = "member_id, timestamp"), + @Index(columnList = "subject, collection_id", unique = true) +}) +public class FetchMemberEntity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "member_id", columnDefinition = "BIGINT", nullable = false) + private long id; + @Column(name = "subject", nullable = false) + private String subject; + @ManyToOne(fetch = FetchType.EAGER) + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinColumn(name = "collection_id", nullable = false) + private EventStreamEntity collection; + @Column(name = "version_of", nullable = false) + private String versionOf; + @Column(name = "timestamp", nullable = false) + private LocalDateTime timestamp; + @Column(name = "transaction_id", nullable = false) + private String transactionId; + @Column(name = "is_in_event_source", nullable = false) + private boolean isInEventSource; + @Convert(converter = FetchMemberModelConverter.class) + @Column(name = "member_model", nullable = false, columnDefinition = "bytea") + private Model model; + + @SuppressWarnings("java:S107") + public FetchMemberEntity(String subject, EventStreamEntity collection, String versionOf, LocalDateTime timestamp, String transactionId, boolean isInEventSource, Model model) { + this.subject = subject; + this.collection = collection; + this.versionOf = versionOf; + this.timestamp = timestamp; + this.transactionId = transactionId; + this.isInEventSource = isInEventSource; + this.model = model; + } + + public FetchMemberEntity(long id) { + this.id = id; + } + + protected FetchMemberEntity() { + } + + public long getId() { + return id; + } + + + public String getSubject() { + return subject; + } + + public EventStreamEntity getCollection() { + return collection; + } + + public String getVersionOf() { + return versionOf; + } + + public LocalDateTime getTimestamp() { + return timestamp; + } + + public String getTransactionId() { + return transactionId; + } + + public boolean isInEventSource() { + return isInEventSource; + } + + public Model getModel() { + return model; + } +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchPageEntity.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchPageEntity.java new file mode 100644 index 0000000000..43c5566cd9 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchPageEntity.java @@ -0,0 +1,73 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity; + +import jakarta.persistence.*; + +import java.time.LocalDateTime; +import java.util.List; + +@Entity +@Table(name = "pages") +public class FetchPageEntity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "page_id", unique = true, nullable = false, columnDefinition = "BIGINT") + private Long id; + + @ManyToOne + @JoinColumn(name = "bucket_id", columnDefinition = "BIGINT") + private FetchBucketEntity bucket; + + @Column(name = "immutable", nullable = false, columnDefinition = "BOOLEAN") + private boolean immutable; + + @Column(name = "expiration", columnDefinition = "TIMESTAMP") + private LocalDateTime expiration; + + @Column(name = "next_update_ts", columnDefinition = "TIMESTAMP") + private LocalDateTime nextUpdateTs; + + @Column(name = "partial_url", nullable = false, unique = true) + private String partialUrl; + + @OneToMany(mappedBy = "fromPage") + private List relations; + + public FetchPageEntity() { + } + + public Long getId() { + return id; + } + + public FetchBucketEntity getBucket() { + return bucket; + } + + public boolean isImmutable() { + return immutable; + } + + public LocalDateTime getExpiration() { + return expiration; + } + + public LocalDateTime getNextUpdateTs() { + return nextUpdateTs; + } + + public String getPartialUrl() { + return partialUrl; + } + + public List getRelations() { + return relations; + } + + public boolean isView() { + return bucket.getView().getComposedViewName().equals("/%s".formatted(partialUrl)); + } + + public void setId(Long id) { + this.id = id; + } +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchPageMemberEntity.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchPageMemberEntity.java new file mode 100644 index 0000000000..29491bc161 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchPageMemberEntity.java @@ -0,0 +1,37 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity; + +import jakarta.persistence.*; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +@Entity +@Table(name = "page_members") +public class FetchPageMemberEntity { + @EmbeddedId + private PageMemberId pageMemberId; + + @MapsId("memberId") + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinColumn(name = "member_id", nullable = false, columnDefinition = "BIGINT") + private FetchMemberEntity member; + + @Column(name = "page_id", columnDefinition = "BIGINT") + private Long pageId; + + public void setPageId(Long pageId) { + this.pageId = pageId; + } + + public void setMember(Long memberId) { + this.member = new FetchMemberEntity(memberId); + } + + public FetchMemberEntity getMember() { + return member; + } + + public Long getPageId() { + return pageId; + } +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchPageRelationEntity.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchPageRelationEntity.java new file mode 100644 index 0000000000..5310747dcc --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/FetchPageRelationEntity.java @@ -0,0 +1,63 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity; + +import jakarta.persistence.*; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +@Entity +@Table(name = "page_relations") +public class FetchPageRelationEntity { + @EmbeddedId + private RelationId relationId; + + @ManyToOne + @MapsId("fromPageId") + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinColumn(name = "from_page_id", nullable = false, columnDefinition = "BIGINT") + private FetchPageEntity fromPage; + + @ManyToOne + @MapsId("toPageId") + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinColumn(name = "to_page_id", nullable = false, columnDefinition = "BIGINT") + private FetchPageEntity toPage; + + @Column(name = "relation_type", nullable = false, columnDefinition = "VARCHAR(255)") + private String treeRelationType; + + @Column(name = "value", columnDefinition = "VARCHAR(255)") + private String treeValue; + + @Column(name = "value_type", columnDefinition = "VARCHAR(255)") + private String treeValueType; + + @Column(name = "path", columnDefinition = "VARCHAR(255)") + private String treePath; + + protected FetchPageRelationEntity() { + } + + public RelationId getRelationId() { + return relationId; + } + + public FetchPageEntity getToPage() { + return toPage; + } + + public String getTreeRelationType() { + return treeRelationType; + } + + public String getTreeValue() { + return treeValue; + } + + public String getTreeValueType() { + return treeValueType; + } + + public String getTreePath() { + return treePath; + } +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/PageMemberId.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/PageMemberId.java new file mode 100644 index 0000000000..0a1f6605dd --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/PageMemberId.java @@ -0,0 +1,38 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; + +import java.io.Serializable; + +@Embeddable +public class PageMemberId implements Serializable { + @Column(name = "member_id", nullable = false, columnDefinition = "BIGINT") + private Long memberId; + + @Column(name = "bucket_id", nullable = false, columnDefinition = "BIGINT") + private Long bucketId; + + public PageMemberId() { + } + + public PageMemberId(Long memberId, Long bucketId) { + this.memberId = memberId; + this.bucketId = bucketId; + } + + @Override + public final boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof PageMemberId that)) return false; + + return memberId.equals(that.memberId) && bucketId.equals(that.bucketId); + } + + @Override + public int hashCode() { + int result = memberId.hashCode(); + result = 31 * result + bucketId.hashCode(); + return result; + } +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/RelationId.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/RelationId.java new file mode 100644 index 0000000000..d21e24d2aa --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/entity/RelationId.java @@ -0,0 +1,46 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; + +import java.io.Serializable; + +@Embeddable +public class RelationId implements Serializable { + @Column(name = "from_page_id", nullable = false, columnDefinition = "BIGINT") + private Long fromPageId; + + @Column(name = "to_page_id", nullable = false, columnDefinition = "BIGINT") + private Long toPageId; + + public RelationId() { + } + + public RelationId(Long fromPageId, Long toPageId) { + this.fromPageId = fromPageId; + this.toPageId = toPageId; + } + + public Long getFromPageId() { + return fromPageId; + } + + public Long getToPageId() { + return toPageId; + } + + @Override + public final boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof RelationId that)) return false; + + return fromPageId.equals(that.fromPageId) && toPageId.equals(that.toPageId); + } + + @Override + public int hashCode() { + int result = fromPageId.hashCode(); + result = 31 * result + toPageId.hashCode(); + return result; + } +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/FetchMemberModelConverter.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/FetchMemberModelConverter.java new file mode 100644 index 0000000000..a18a9b66bf --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/FetchMemberModelConverter.java @@ -0,0 +1,29 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.mapper; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.riot.RDFParser; +import org.apache.jena.riot.RDFWriter; +import org.springframework.stereotype.Component; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.ServerConstants.SERIALISATION_LANG; + +@Converter +@Component +public class FetchMemberModelConverter implements AttributeConverter { + @Override + public byte[] convertToDatabaseColumn(Model attribute) { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + RDFWriter.source(attribute).lang(SERIALISATION_LANG).output(stream); + return stream.toByteArray(); + } + + @Override + public Model convertToEntityAttribute(byte[] dbData) { + return RDFParser.source(new ByteArrayInputStream(dbData)).lang(SERIALISATION_LANG).toModel(); + } +} diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/MemberRowMapper.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/MemberRowMapper.java similarity index 75% rename from ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/MemberRowMapper.java rename to ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/MemberRowMapper.java index 0ad5da2ad8..3ce036913f 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/MemberRowMapper.java +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/MemberRowMapper.java @@ -1,7 +1,6 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.mapper; +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.mapper; import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.PostgresIngestMemberConstants; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.RDFParser; import org.springframework.jdbc.core.RowMapper; @@ -10,6 +9,8 @@ import java.sql.ResultSet; import java.sql.SQLException; +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.ServerConstants.SERIALISATION_LANG; + public class MemberRowMapper implements RowMapper { static final String SUBJECT_KEY = "subject"; @@ -19,7 +20,7 @@ public class MemberRowMapper implements RowMapper { public Member mapRow(ResultSet rs, int rowNum) throws SQLException { final Model model = RDFParser .source(new ByteArrayInputStream(rs.getBytes(MEMBER_MODEL_KEY))) - .lang(PostgresIngestMemberConstants.SERIALISATION_LANG) + .lang(SERIALISATION_LANG) .toModel(); return new Member(rs.getString(SUBJECT_KEY), model); } diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/TreeNodeMapper.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/TreeNodeMapper.java new file mode 100644 index 0000000000..6fbd29baa0 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/TreeNodeMapper.java @@ -0,0 +1,24 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.mapper; + +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity.FetchPageEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; + +import java.util.List; + +public class TreeNodeMapper { + private TreeNodeMapper() { + } + + public static TreeNode fromPageEntity(FetchPageEntity page, List members) { + return new TreeNode( + page.getPartialUrl(), + page.isImmutable(), + page.isView(), + page.getRelations().stream().map(TreeRelationMapper::fromRelation).toList(), + members, + page.getBucket().getView().getEventStream().getName(), + page.getNextUpdateTs() + ); + } +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/TreeRelationMapper.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/TreeRelationMapper.java new file mode 100644 index 0000000000..a5d3552a27 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/mapper/TreeRelationMapper.java @@ -0,0 +1,19 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.mapper; + +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity.FetchPageRelationEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; +import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.TreeRelation; + +public class TreeRelationMapper { + private TreeRelationMapper() {} + + public static TreeRelation fromRelation(FetchPageRelationEntity pageRelation) { + return new TreeRelation( + pageRelation.getTreePath(), + LdesFragmentIdentifier.fromFragmentId(pageRelation.getToPage().getPartialUrl()), + pageRelation.getTreeValue(), + pageRelation.getTreeValueType(), + pageRelation.getTreeRelationType() + ); + } +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/projection/TreeMemberProjection.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/projection/TreeMemberProjection.java new file mode 100644 index 0000000000..da3be6ce7e --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/projection/TreeMemberProjection.java @@ -0,0 +1,8 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.projection; + +import org.apache.jena.rdf.model.Model; + +import java.time.LocalDateTime; + +public record TreeMemberProjection (String subject, Model model, String versionOf, LocalDateTime timestamp) { +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/repository/FetchPageEntityRepository.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/repository/FetchPageEntityRepository.java new file mode 100644 index 0000000000..b4a47647c5 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/repository/FetchPageEntityRepository.java @@ -0,0 +1,13 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.repository; + + +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity.FetchPageEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Optional; + +public interface FetchPageEntityRepository extends JpaRepository { + @Transactional(readOnly = true) + Optional findTreeNodeByPartialUrl(String partialUrl); +} \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/repository/FetchPageMemberEntityRepository.java b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/repository/FetchPageMemberEntityRepository.java new file mode 100644 index 0000000000..92e22c8373 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fetch/postgres/repository/FetchPageMemberEntityRepository.java @@ -0,0 +1,16 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.repository; + +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity.FetchMemberEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity.FetchPageMemberEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.fetch.postgres.entity.PageMemberId; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface FetchPageMemberEntityRepository extends JpaRepository { + @Query("SELECT member from FetchPageMemberEntity WHERE pageId = :pageId") + List findAllMembersByPageId(Long pageId); +} diff --git a/ldes-server-infra-postgres/postgres-fetch-repository/src/test/resources/members/member.ttl b/ldes-server-infra-postgres/postgres-fetch-repository/src/test/resources/members/member.ttl new file mode 100644 index 0000000000..0751418e2c --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fetch-repository/src/test/resources/members/member.ttl @@ -0,0 +1,9 @@ +@prefix dc: . +@prefix prov: . +@prefix xsd: . +@prefix rdf: . + + + dc:isVersionOf ; + rdf:type ; + dc:created "2023-04-06T09:58:15.867Z"^^xsd:dateTime . \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/pom.xml b/ldes-server-infra-postgres/postgres-fragmentation-repository/pom.xml index ef0e47911f..e63b14d8ae 100644 --- a/ldes-server-infra-postgres/postgres-fragmentation-repository/pom.xml +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server-infra-postgres - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT postgres-fragmentation-repository @@ -14,7 +14,7 @@ be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-common + ldes-server-fragmentation-common ${project.version} @@ -34,11 +34,12 @@ ${project.version} compile + be.vlaanderen.informatievlaanderen.vsds postgres-ingest-repository ${project.version} - compile + test diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/BucketPostgresRepository.java b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/BucketPostgresRepository.java index 5bf5169fd9..b9edd5f64b 100644 --- a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/BucketPostgresRepository.java +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/BucketPostgresRepository.java @@ -32,7 +32,7 @@ public BucketPostgresRepository(ViewEntityRepository viewEntityRepository, Bucke @Override @Transactional public Bucket insertBucket(Bucket bucket) { - final String sql = """ + String sql = """ INSERT INTO pages (bucket_id, expiration, partial_url) VALUES (:bucketId, NULL, :partialUrl) ON CONFLICT DO NOTHING diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/BucketisationItemWriter.java b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/BucketisationItemWriter.java index 0fac843a46..77dd50bce4 100644 --- a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/BucketisationItemWriter.java +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/BucketisationItemWriter.java @@ -4,45 +4,76 @@ import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.BucketisedMember; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.postgres.batch.chunk.ChunkCollector; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.valueobjects.BucketRelation; +import org.springframework.batch.core.configuration.annotation.StepScope; import org.springframework.batch.item.Chunk; import org.springframework.batch.item.ItemWriter; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Component; +import java.util.Comparator; import java.util.Optional; @Component +@StepScope public class BucketisationItemWriter implements ItemWriter { private final ItemWriter bucketItemWriter; private final ItemWriter pageItemWriter; private final ItemWriter bucketisedMemberItemWriter; private final ItemWriter bucketRelationWriter; + private final JdbcTemplate jdbcTemplate; + private final long viewId; public BucketisationItemWriter(ItemWriter bucketItemWriter, ItemWriter pageItemWriter, ItemWriter bucketisedMemberItemWriter, - ItemWriter bucketRelationWriter) { + ItemWriter bucketRelationWriter, + JdbcTemplate jdbcTemplate, + @Value("#{jobParameters['viewId']}") long viewId) { this.bucketItemWriter = bucketItemWriter; this.pageItemWriter = pageItemWriter; this.bucketisedMemberItemWriter = bucketisedMemberItemWriter; this.bucketRelationWriter = bucketRelationWriter; + this.jdbcTemplate = jdbcTemplate; + this.viewId = viewId; } @Override public void write(Chunk rootBucketChunk) throws Exception { - for(var rootbucket : rootBucketChunk) { + for (var rootbucket : rootBucketChunk) { final Chunk flatBucketChunk = new Chunk<>(rootbucket.getBucketTree()); bucketItemWriter.write(flatBucketChunk); pageItemWriter.write(flatBucketChunk); bucketRelationWriter.write(extractAllBucketRelations(rootbucket)); - bucketisedMemberItemWriter.write(extractAllMembers(flatBucketChunk)); + var members = extractAllMembers(flatBucketChunk); + bucketisedMemberItemWriter.write(members); + + var uniqueMemberCount = members.getItems().stream() + .map(BucketisedMember::memberId) + .distinct() + .count(); + updateViewStats(members.getItems().getLast().memberId(), uniqueMemberCount); } } + private void updateViewStats(long lastMemberId, long uniqueMemberCount) { + String sql = """ + update view_stats vs set + bucketized_count = vs.bucketized_count + ?, + bucketized_last_id = ? + where view_id = ?; + """; + + jdbcTemplate.update(sql, uniqueMemberCount, lastMemberId, viewId); + } + + private static Chunk extractAllMembers(Chunk flatBucketChunk) { return flatBucketChunk.getItems().stream() .map(Bucket::getMember) .filter(Optional::isPresent) .map(Optional::get) + .sorted(Comparator.comparing(BucketisedMember::memberId)) .collect(new ChunkCollector<>()); } diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/batch/MemberItemReader.java b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/MemberItemReader.java similarity index 73% rename from ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/batch/MemberItemReader.java rename to ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/MemberItemReader.java index 990e560eb3..2b0afd2e51 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/batch/MemberItemReader.java +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/MemberItemReader.java @@ -1,7 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.batch; +package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.postgres.batch; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.FragmentationMember; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.mapper.FragmentationMemberRowMapper; +import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.postgres.mapper.FragmentationMemberRowMapper; import org.springframework.batch.core.configuration.annotation.StepScope; import org.springframework.batch.item.database.JdbcPagingItemReader; import org.springframework.batch.item.database.Order; @@ -41,20 +41,20 @@ private PostgresPagingQueryProvider memberQuery() { sortKeys.put("member_id", Order.ASCENDING); PostgresPagingQueryProvider queryProvider = new PostgresPagingQueryProvider(); queryProvider.setSelectClause(""" - m.member_id, m.subject, m.version_of, m.timestamp, - c.name, c.version_of_path, c.timestamp_path, c.create_versions, - m.member_model - """); + member_id, subject, version_of, timestamp, + name, version_of_path, timestamp_path, version_delimiter IS NOT NULL as create_versions, + member_model + """); queryProvider.setFromClause(""" - collections c - join members m on m.collection_id = c.collection_id - """); + collections c + join processable_members m on m.collection_id = c.collection_id + """); queryProvider.setWhereClause(""" - c.collection_id = :collectionId and - m.member_id > ( - COALESCE((SELECT max(pm.member_id) FROM page_members pm WHERE pm.view_id = :viewId), (0)::bigint) - ) - """); + m.member_id > ( + select vs.bucketized_last_id from view_stats vs where vs.view_id = :viewId + ) + AND c.collection_id = :collectionId + """); queryProvider.setSortKeys(sortKeys); return queryProvider; } diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/PageRelationItemWriterConfig.java b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/PageRelationItemWriterConfig.java index c1ddd8288e..a53e27487e 100644 --- a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/PageRelationItemWriterConfig.java +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/PageRelationItemWriterConfig.java @@ -15,11 +15,12 @@ public class PageRelationItemWriterConfig { @Bean public ItemWriter bucketRelationItemWriter(DataSource dataSource) { - final String sql = """ + String sql = """ INSERT INTO page_relations (from_page_id, to_page_id, relation_type, value, value_type, path) SELECT (SELECT page_id FROM pages WHERE partial_url = :fromPartialUrl), (SELECT page_id FROM pages WHERE partial_url = :toPartialUrl), :treeRelationType, :treeValue, :treeValueType, :treePath + on conflict do nothing """; return new JdbcBatchItemWriterBuilder() .dataSource(dataSource) @@ -32,6 +33,7 @@ INSERT INTO page_relations (from_page_id, to_page_id, relation_type, value, valu "treeValueType", item.relation().treeValueType(), "treePath", item.relation().treePath() ))) + .assertUpdates(false) .build(); } } diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/FragmentationMemberRowMapper.java b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/mapper/FragmentationMemberRowMapper.java similarity index 87% rename from ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/FragmentationMemberRowMapper.java rename to ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/mapper/FragmentationMemberRowMapper.java index 37bd4c4874..c984858193 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/FragmentationMemberRowMapper.java +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/mapper/FragmentationMemberRowMapper.java @@ -1,8 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.mapper; +package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.postgres.mapper; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.FragmentationMember; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.valueobjects.EventStreamProperties; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.PostgresIngestMemberConstants; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.RDFParser; import org.springframework.jdbc.core.RowMapper; @@ -12,6 +11,8 @@ import java.sql.SQLException; import java.time.LocalDateTime; +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.ServerConstants.SERIALISATION_LANG; + public class FragmentationMemberRowMapper implements RowMapper { static final String MEMBER_ID_COLUMN_KEY = "member_id"; @@ -46,6 +47,6 @@ private static EventStreamProperties mapEventStreamProperties(ResultSet rs) thro } private static Model mapMemberModel(ResultSet rs) throws SQLException { - return RDFParser.source(new ByteArrayInputStream(rs.getBytes(MEMBER_MODEL_COLUMN_KEY))).lang(PostgresIngestMemberConstants.SERIALISATION_LANG).toModel(); + return RDFParser.source(new ByteArrayInputStream(rs.getBytes(MEMBER_MODEL_COLUMN_KEY))).lang(SERIALISATION_LANG).toModel(); } } diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/PostgresBucketisationIntegrationTest.java b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/PostgresBucketisationIntegrationTest.java index aed04baff8..ef86a18550 100644 --- a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/PostgresBucketisationIntegrationTest.java +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/PostgresBucketisationIntegrationTest.java @@ -1,9 +1,8 @@ package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.postgres; import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.FragmentationMetricsRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.MemberMetricsRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.ServerMetrics; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.FragmentationService; +import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.metrics.FragmentationMetricsService; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.postgres.batch.delegates.BucketisedMemberItemWriterConfig; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.repository.MemberEntityRepository; import io.cucumber.spring.CucumberContextConfiguration; @@ -55,8 +54,8 @@ public ObservationRegistry observationRegistry() { } @Bean - ServerMetrics serverMetrics() { - return new ServerMetrics(mock(FragmentationMetricsRepository.class), mock(MemberMetricsRepository.class)); + FragmentationMetricsService serverMetrics() { + return new FragmentationMetricsService(mock(FragmentationMetricsRepository.class)); } } } diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/BucketisationItemWriterTest.java b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/BucketisationItemWriterTest.java index 65d8aca472..b4f467c738 100644 --- a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/BucketisationItemWriterTest.java +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/BucketisationItemWriterTest.java @@ -16,6 +16,7 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.batch.item.Chunk; import org.springframework.batch.item.ItemWriter; +import org.springframework.jdbc.core.JdbcTemplate; import java.util.ArrayList; import java.util.List; @@ -44,10 +45,12 @@ class BucketisationItemWriterTest { @Mock private ItemWriter bucketRelationItemWriter; private BucketisationItemWriter bucketisationItemWriter; + @Mock + private JdbcTemplate jdbcTemplate; @BeforeEach void setUp() { - bucketisationItemWriter = new BucketisationItemWriter(bucketItemWriter, pageItemWriter, bucketMemberItemWriter, bucketRelationItemWriter); + bucketisationItemWriter = new BucketisationItemWriter(bucketItemWriter, pageItemWriter, bucketMemberItemWriter, bucketRelationItemWriter, jdbcTemplate, 1); } @Test diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/batch/MemberItemReaderTest.java b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/MemberItemReaderTest.java similarity index 92% rename from ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/batch/MemberItemReaderTest.java rename to ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/MemberItemReaderTest.java index 56d01bb8b5..8d8b01b936 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/batch/MemberItemReaderTest.java +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/MemberItemReaderTest.java @@ -1,10 +1,11 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.batch; +package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.postgres.batch; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.FragmentationMember; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.valueobjects.EventStreamProperties; import io.zonky.test.db.AutoConfigureEmbeddedDatabase; import org.apache.jena.rdf.model.ModelFactory; +import org.assertj.core.api.Assertions; import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -119,7 +120,7 @@ void given_MembersPresentInDb_test_ReadNewMembers() throws Exception { } while (member != null); - assertThat(readMembers) + Assertions.assertThat(readMembers) .hasSize(count) .doesNotHaveDuplicates() .first() @@ -137,6 +138,8 @@ private void setupStepScope(long collectionId, String collectionName, long viewI .addLong("viewId", viewId) .addString("collectionName", collectionName) .addString("viewName", viewName) + .addLong("collectionId", 1L) + .addLong("viewId", 1L) .toJobParameters(); setupStepScope(jobParameters); } @@ -153,16 +156,16 @@ private void insertMembers(int count) { .mapToObj(this::mapToInsertAgs) .toList(); - jdbcTemplate.batchUpdate("INSERT INTO members VALUES (?, ?, ?, 1, true, '', ?, ?, 'http://test-data/mobility-hindrance/1')", batchArgs); + jdbcTemplate.batchUpdate("INSERT INTO members (member_id, subject, timestamp, collection_id, member_model, transaction_id, version_of) " + + "VALUES (?, ?, ?, 1, '', ?, 'http://test-data/mobility-hindrance/1')", batchArgs); } private Object[] mapToInsertAgs(int i) { final LocalDateTime timestamp = START_TIME.plusHours(i); final String subject = SUBJECT_TEMPLATE + (i + 1); - final String oldId = COLLECTION_NAME + "/" + subject; return new Object[]{ - i + 1, subject, oldId, timestamp, UUID.randomUUID() + i + 1, subject, timestamp, UUID.randomUUID() }; } diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/application-postgres-test.yml b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/application-postgres-test.yml index c4eaae39d4..17571bdd71 100644 --- a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/application-postgres-test.yml +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/application-postgres-test.yml @@ -6,3 +6,10 @@ spring: ldes-server: compaction-duration: "PT1M" + +zonky: + test: + database: + postgres: + docker: + image: postgres:14-alpine diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/allocations.sql b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/allocations.sql deleted file mode 100644 index 960afe6bc0..0000000000 --- a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/allocations.sql +++ /dev/null @@ -1,3 +0,0 @@ -insert into fetch_allocation (id, collection_name, fragment_id, member_id, view_name) -values ('1', 'es', 'v1/x', 1, 'es/v1'), - ('2', 'es', 'v1/x', 2, 'es/v1'); \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/init-collection-and-view.sql b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/init-collection-and-view.sql index d23e72763f..f752236131 100644 --- a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/init-collection-and-view.sql +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/init-collection-and-view.sql @@ -1,6 +1,6 @@ -INSERT INTO collections (collection_id, name, timestamp_path, version_of_path, create_versions, is_closed) +INSERT INTO collections (collection_id, name, timestamp_path, version_of_path, version_delimiter, is_closed) VALUES (1, 'mobility-hindrances', 'http://www.w3.org/ns/prov#generatedAtTime', 'http://purl.org/dc/terms/isVersionOf', - false, false); + NULL, false); INSERT INTO views (view_id, collection_id, name, fragmentations, retention_policies, page_size) VALUES (1, 1, 'by-hour', '[ diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/init-writer-test.sql b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/init-writer-test.sql index 56591c9cbe..e341af42df 100644 --- a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/init-writer-test.sql +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/fragmentation/postgres/batch/delegates/init-writer-test.sql @@ -1,25 +1,22 @@ -INSERT INTO members (member_id, subject, old_id, collection_id, is_in_event_source, member_model, timestamp, +INSERT INTO members (member_id, subject, collection_id, is_in_event_source, member_model, timestamp, transaction_id, version_of) VALUES (1, 'https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810400/600000', - 'mobility-hindrances/https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810400/600000', 1, true, E'\\x7212700A2412220A20383962633766336534653666643530393261313039333638386438313639376512310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A151A130A0A48696E6465725A6F6E6512056E6C2D6265B70112B4010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303030122F0A2D0A2B687474703A2F2F7075726C2E6F72672F64632F656C656D656E74732F312E312F636F6E7472696275746F721A2412220A206464353034373238373065356361626163393133343534376263316239313031B60112B3010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303030122A0A280A26687474703A2F2F7777772E77332E6F72672F6E732F61646D732376657273696F6E4E6F7465731A281A260A1D4D6F62696C69747948696E6472616E63655A6F6E65576173416464656412056E6C2D6265D40112D1010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012250A230A21687474703A2F2F7075726C2E6F72672F64632F7465726D732F6D6F6469666965641A4B1A490A1C323032322D30352D32305430393A35383A31352E383634363433335A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D65DA0112D7010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303030122D0A2B0A29687474703A2F2F7777772E77332E6F72672F6E732F70726F762367656E657261746564417454696D651A491A470A1A323032342D30362D32365431323A34373A30322E3637313338301A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D65C20112BF010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303030123A0A380A3668747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C697465697423496E6E616D652E7374617475731A2412220A206532656662383639303231313564646462386230666262313632376435623932D50112D2010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A3E0A3C0A3A68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974234D6F62696C69746569747368696E646572B90112B6010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012310A2F0A2D68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974237A6F6E651A2412220A203630363733626261353364353661333739376137613730383633393961343832D30112D0010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012240A220A20687474703A2F2F7075726C2E6F72672F64632F7465726D732F637265617465641A4B1A490A1C323032322D30352D32335430393A35383A31352E383631303839365A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D65E00112DD010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012280A260A24687474703A2F2F7075726C2E6F72672F64632F7465726D732F697356657273696F6E4F661A540A520A5068747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F3130383130343030BE0112BB010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012360A340A3268747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974236265686565726465721A2412220A206464353034373238373065356361626163393133343534376263316239313031B00112AD010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012280A260A24687474703A2F2F7777772E77332E6F72672F6E732F61646D73236964656E7469666965721A2412220A203533653066323335336238623533376162393162303364623032393934393239CA0112C7010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012300A2E0A2C68747470733A2F2F6769706F642E766C61616E646572656E2E62652F6E732F6769706F64236769706F6449641A361A340A0831303831303430301A28687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D6123696E7465676572BC0112B9010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012340A320A3068747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C697465697423706572696F64651A2412220A2034326535316265343464656561363762303066643533383136333935386565629101128E010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012260A240A22687474703A2F2F7075726C2E6F72672F64632F7465726D732F737562737472696E671A071A050A012648019E01129B010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303012280A260A24687474703A2F2F7075726C2E6F72672F64632F7465726D732F6465736372697074696F6E1A121A100A0C6F6D73636872696A76696E674801B30112B0010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303030122B0A290A27687474703A2F2F7075726C2E6F72672F64632F656C656D656E74732F312E312F63726561746F721A2412220A20646435303437323837306535636162616339313334353437626331623931303187011284010A2412220A20363036373362626135336435366133373937613761373038363339396134383212360A340A3268747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974235A6F6E652E747970651A2412220A2038396263376633653465366664353039326131303933363838643831363937659101128E010A2412220A20363036373362626135336435366133373937613761373038363339396134383212330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A310A2F0A2D68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974235A6F6E657612740A2412220A20363036373362626135336435366133373937613761373038363339396134383212260A240A22687474703A2F2F7777772E77332E6F72672F6E732F6C6F636E2367656F6D657472791A2412220A20373630343563303738343364616636646461623338626130663632666561363184011281010A2412220A20363036373362626135336435366133373937613761373038363339396134383212330A310A2F68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974236765766F6C671A2412220A2036313063336161323561343134326534383339643036393337303133343137378B011288010A2412220A20363130633361613235613431343265343833396430363933373031333431373712310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A2D1A2B0A2242657065726B746520646F6F7267616E6720766F6F7220766F657467616E6765727312056E6C2D626571126F0A2412220A20653265666238363930323131356464646238623066626231363237643562393212310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A141A120A09496E206F706D61616B12056E6C2D626580960112FC95010A2412220A203736303435633037383433646166366464616233386261306636326665613631122E0A2C0A2A687474703A2F2F7777772E6F70656E6769732E6E65742F6F6E742F67656F73706172716C236173574B541AA295011A9E95010AE994013C687474703A2F2F7777772E6F70656E6769732E6E65742F6465662F6372732F455053472F392E392E312F33313337303E20504F4C59474F4E2028283132313337352E38333834393431373631203135373732352E30323930363930313833382C203133313337352E33323039313439333632203136373732342E32343835373332383630382C203132313336392E3935323931343933353438203135373731372E363031353733323836322C203132313336392E3531353937363937333239203135373731372E31323637393334323037362C203132313336332E3034363937363936393035203135373731302E39343937393334313936382C203132313336322E38303132303432303131203135373731302E37333031333734393031342C203132313335352E38333932303432303336203135373730342E39303931333734393135342C203132313335352E3831353036393533353838203135373730342E383839303836353738312C203132313335352E3636373837333938333538203135373730342E373637353736313533322C203132313334362E35303336373730343931203135373639372E313838303637343330332C203132313334352E37343035373034373534203135373639362E36363736333637343632382C203132313333342E3738333537303437333134203135373639302E35393536333637343536352C203132313333342E3234343534383433323137203135373639302E33333737343939333131382C203132313332332E3337373534383433333438203135373638352E39313537343939323930362C203132313332332E3132373937333232303437203135373638352E38323138363930343033342C203132313236332E3230353937333232323038203135373636352E30383738363930343239372C203132313236332E31393133363632313639203135373636352E30383238343030333231382C203132313236312E3435373336363231323037203135373636342E34383838343030333136372C203132313236312E3434373933313236373834203135373636342E34383536313834393836342C203132313232312E363835323134333534203135373635302E393533303038383733372C203132313231392E3739333233333631353134203135373635302E323731313532333233312C203132313231392E3639363936343433363436203135373635302E323337353632363433332C203132313230352E3531393635363237303137203135373634352E34353234383337333134372C203132313138362E3039353334333437363533203135373633382E38343434313834393433382C203132313136312E3232323730393539333933203135373633302E333930343238303535312C203132313134322E3833313030323232303739203135373632322E3933303031313039312C203132313132372E3034303939303235393337203135373631342E35393537363337343833372C203132313131392E34363930323831303638203135373631302E353835373432363038392C203132313039352E3835353130383739313139203135373539362E37323035343333353332342C203132313037382E3335323535353639343132203135373538352E35343534323635393835382C203132313036322E38343332323738343937203135373537332E38383836373831333639352C203132313034392E3039313536343136303637203135373536312E37323730373531353738332C203132313032352E3336393033373434383237203135373533382E39383635343833393835332C203132313032342E32343138323730353833203135373533372E393036333436363935312C203132313032322E38333834323735303239203135373533362E35363039323233333730382C203132313031352E3730343033373836373431203135373532392E373139353037363334372C203132303938382E3630323431373431333039203135373530332E37313938373137343537362C203132303935352E3739363337393738313233203135373437322E323635383736353839382C203132303935352E3737303232303035323538203135373437322E32343039373536393438352C203132303931352E3431313637393232323933203135373433342E31303134303936323332382C203132303835342E3439383539333438303237203135373337362E35303832373430343735322C203132303834312E3931333034383636343333203135373336342E36303237303436343230322C203132303834312E38383639393733353037203135373336342E353738323336363638392C203132303833372E3134383136313533353832203135373336302E31353931383733323836322C203132303831302E3236393636323232343639203135373333352E30303733393838383839332C203132303830352E34333530303239333033203135373333302E34373636353533303935332C203132303735342E3132303239363032363936203135373238322E34353931323034353034352C203132303733362E3031373036373835323732203135373236352E35323334353637393831372C203132303733322E3633303839323933313135203135373236322E313035393031313539372C203132303732332E3536333835343038313434203135373235322E393533383939343330392C203132303732322E3034323333303639393931203135373235312E34313133343533383237342C203132303731302E3732303035323035383538203135373233372E39353836383830343931342C203132303730312E36353938373539303734203135373232352E313237333330333331312C203132303639342E35323531373534373331203135373231322E383132323830363638322C203132303639342E31353030353031353738203135373231322E303839393436333338322C203132303636362E3938373738333437333634203135373135392E35393332393633333532352C203132303632382E3830303239373638393537203135373038352E38323633353737303031332C203132303631342E3730363533303136303639203135373035382E363038383036353730342C203132303630382E3634353031383839353834203135373034362E38393037353133383630332C203132303630382E3633353532383136313835203135373034362E38373234393631323836342C203132303539372E3231333634383831373735203135373032352E30313237323730353737372C203132303538332E3135383937323836333934203135363939382E31303733343733383734342C203132303537372E3038393137363230313233203135363938362E34383237333638313037352C203132303534362E3136363735313434383937203135363932372E323934393233353130382C203132303532392E3839323836333630333737203135363839362E313338313338323239362C203132303532362E3437383130383232353532203135363838392E363035363932363138322C203132303532362E3436363638363234333235203135363838392E35383339373233303435362C203132303531352E3334393638363234343536203135363836382E353638393732333037372C203132303530392E3535323431353732333034203135363835372E36313534363039353531362C203132303438372E3634363634383236303237203135363831362E32303839303035303435342C203132303438332E3530323730313031303935203135363830382E33373534353138393039382C203132303437392E3532343432393832353036203135363830302E3737363339343734312C203132303436382E3639313137373038363232203135363738302E30353038323433353530372C203132303436372E38343435333831353436203135363737382E343332363032333335322C203132303436372E3036383739323836373639203135363737362E39343930383934343130372C203132303434352E3634393539303634313631203135363733362E30313137303236323331362C203132303433342E35363631363337303435203135363731342E383132363234303637342C203132303433332E3631343432353638343333203135363731322E39383337333836303933332C203132303433302E3739343234303839333939203135363730362E383832383134363633392C203132303432382E35393537313533393733203135363730302E34393331313730343138362C203132303432362E3939303037353734383533203135363639332E3737363136303030352C203132303432362E3031373933343736323631203135363638362E37383737383536313336352C203132303432352E3732343336393430323135203135363637392E35373731343530383838372C203132303432352E39383436393835333539203135363637342E3634353139353338322C203132303432362E3132303535393934393738203135363637322E31393531333038393030332C203132303432372E3234393735363234393036203135363636342E35393938353033353338372C203132303432382E3330353136323637373136203135363635392E323134313434363131312C203132303433302E3035353238373033373636203135363635302E33333334313239363933342C203132303433312E3538373535343435333336203135363634342E38373936363136353433332C203132303433342E3737343438363238363535203135363633332E35343039303432303934382C203132303433342E3832313536313831313036203135363633332E333630353737383931352C203132303433382E3336383536313830393435203135363631382E36353735373738383938382C203132303433382E3434363534343839313335203135363631382E323636353230353438372C203132303433382E3439333534343838393734203135363631372E393639353230353530332C203132303433382E3439373636373631313732203135363631372E39343330303738363635362C203132303433382E3538323034373330343535203135363631372E333930363135323434312C203132303433392E3430303338313438323136203135363631322E31383332313535363630342C203132303434302E3139373930323931313233203135363630372E30383538393031383736382C203132303434302E3230303038333231333332203135363630372E30373138323337373837342C203132303434302E3335363038333230393039203135363630362E303535383233373736312C203132303434302E34303334373632323138203135363630352E363231323332393433382C203132303434312E3036373437363232363334203135363539352E34303332333239343533332C203132303434312E3037353036393031373734203135363539342E39303738323339323637372C203132303434302E3737393036393031333932203135363538362E32363638323339323738372C203132303434302E3733323339333930373635203135363538352E373335343333313830352C203132303433392E3639323339333930383534203135363537382E343037343333313738392C203132303433392E3537373434333336303631203135363537372E38333738303231303036362C203132303433372E3934353434333336313333203135363537312E36333438303231303237382C203132303433372E3835373533303938343933203135363537312E333338323538363133382C203132303433312E303231353330393832203135363535302E363530323538363132382C203132303433302E3937313537323632343731203135363535302E353036343534373031312C203132303432322E3634333631313130373636203135363532372E36363235363032343436372C203132303431382E3331333634393434393138203135363531352E37383336363534343633362C203132303431382E33303439343131313138203135363531352E37353939363130353432352C203132303431342E36393735363337343835203135363530362E30313636343237343635322C203132303431322E33393531383531383033203135363439392E37383433323439313337352C203132303431302E3930313136353632373233203135363439352E37343239313231333637322C203132303430362E3130353331313430333835203135363438322E33373436313832353030362C203132303339372E3930383838353934343832203135363435392E35343534333237353032352C203132303339372E38383839333430343737203135363435392E34393038363036333639362C203132303338352E3332363933343034383732203135363432352E37343038363036333639362C203132303338332E3933353435303831373336203135363432322E30303535363239303734332C203132303338332E3837363534353738313832203135363432312E383534393331393237362C203132303337362E32373535343537373833203135363430332E33303739333139323932322C203132303337362E3138333634343733333734203135363430332E30393735383139323438372C203132303337302E3635323634343733373937203135363339312E31393035383139323333352C203132303337302E3236333938353438393239203135363339302E353032323138333733392C203132303336342E3333333938353438393539203135363338312E37303532313833373535312C203132303336342E30343432323635363538203135363338312E33313733303938333538342C203132303335372E3134353232363536313837203135363337322E39353833303938333437342C203132303335362E3833333138333733393338203135363337322E363134313337313433352C203132303335322E3535373138333733383834203135363336382E33313731333731343531322C203132303335302E3330313334373231373336203135363336362E303531323936373039332C203132303334392E3834393835303336383733203135363336352E363439353634373539392C203132303334322E30303538353033363435203135363335392E343737353634373631352C203132303334312E3437313135353237313635203135363335392E31313033373834333331362C203132303333332E31383235303031323831203135363335342E313737333434393133322C203132303333322E3732323832353632323834203135363335332E39303133343337363937342C203132303333322E3530333137383530383132203135363335332E373736383935343330312C203132303332332E3830373137383531333235203135363334392E313335383935343237352C203132303332332E3433343937383936343631203135363334382E393536363031333839332C203132303331392E3439393937383936323232203135363334372E32353736303133393230382C203132303331332E3337323037343837363832203135363334342E36313332313131343134362C203132303331322E3834363433353237383734203135363334342E343230353137313531392C203132303330342E3136363433353237393034203135363334312E37373935313731353330322C203132303330332E3731323636353135353835203135363334312E36363433363037303831382C203132303330312E3334353636353134393731203135363334312E31383033363037303730382C203132303330312E3332373730303038323339203135363334312E313736373231353335362C203132303239332E3737323730303038323639203135363333392E363630373231353336372C203132303239332E3337383237393735353938203135363333392E35393738343634393232322C203132303238342E363931323739373537203135363333382E35363638343634393237332C203132303238342E3533323439343231313938203135363333382E353530353637303031372C203132303238312E3435343439343231303337203135363333382E32383435363639393930362C203132303238312E3434323332343230323034203135363333382E32383335333032343339332C203132303236382E3739333332343230353536203135363333372E32323135333032343439352C203132303236382E3338393533383431383632203135363333372E323034303231313336352C203132303235322E3232353533383432313534203135363333372E31353730323131333831322C203132303235322E3039383732323639363932203135363333372E31353832363037373938332C203132303233312E323632373232363934203135363333372E363236323630373738332C203132303233312E3139303738313732363638203135363333372E36323833393437383936372C203132303231332E3337303738313732363338203135363333382E323835333934373931322C203132303231332E3230323238343134383331203135363333382E323934343536333634382C203132303139382E3339373238343134383631203135363333392E33343134353633363331382C203132303139382E3230313830333130333833203135363333392E333539313432383432372C203132303138382E3134373830333130363136203135363334302E343638313432383433382C203132303138382E3131373538303430353531203135363334302E343731353639363135392C203132303138362E33373435383034303438203135363334302E363734353639363133382C203132303138362E3231333434353636393734203135363334302E36393539393635323136322C203132303137312E3639303434353636373833203135363334322E38363739393635323337342C203132303137312E3532393339313734303237203135363334322E38393437373832393336322C203132303136362E3036383339313733373335203135363334332E38393437373832393336322C203132303134312E3433313437333338343935203135363334382E34323634393734323332342C203132303134312E3336343630363237373737203135363334382E34333932363831383030322C203132303131302E3034343630363237373437203135363335342E363432323638313737392C203132303130332E3633393034333239393036203135363335352E39313335373739373235362C203132303039392E3634353434393636303132203135363335362E37303534393733393130392C203132303039392E3432353333313533363538203135363335362E37353433323838383837382C203132303038312E3438373333313533353537203135363336312E31363033323838383832382C203132303038312E3334333436323035393837203135363336312E3139373934333731372C203132303036382E3738303436323035383836203135363336342E363832393433373136342C203132303036382E3639363838353337303938203135363336342E37303639313235353138362C203132303035342E3732303838353337343932203135363336382E38343639313235353234362C203132303035342E3135323738383635363838203135363336392E30353332393733343435372C203132303034382E3233383738383635323335203135363337312E36313632393733343535382C203132303034382E3233333233373037303234203135363337312E36313837303732373334322C203132303033382E3130303233373036383932203135363337362E303234373037323732392C203132303033372E39393838393834373832203135363337362E30373031313536383037352C203132303032322E3836303330373731373338203135363338332E303536333931363030312C203132303030332E3834373533343237303535203135363339312E313834353036373231322C203132303030332E3733333439333934313032203135363339312E32333439353130303833342C203131393939392E33323734393339333738203135363339332E32343939353130303532312C203131393939392E33313532383334303236203135363339332E32353535353531303837372C203131393939362E35373534323130343839203135363339342E35313734393137313535322C203131393939352E3735373031353330353533203135363339342E38393433373630313036332C203131393939342E32383130313431383535203135363339352E35373035383232363530362C203131393939332E3639383235353934313532203135363339352E37383032353538343635362C203131393939332E3537363436393234323736203135363339352E38323538373135323730382C203131393939312E3136343538383135383038203135363339362E37363531393537383938332C203131393938382E3733303333323537303134203135363339372E35353938363132323831362C203131393938382E3539373133373931333034203135363339372E36303534323734303430382C203131393938352E34373336373837333237203135363339382E37323333323739343336352C203131393937392E313336353232393139203135363430302E373937323730393730332C203131393937342E3038383633323838373432203135363430322E31333334343835333230382C203131393937322E3739343635393438343835203135363430322E34373539323333383935372C203131393937302E3034303436393739313232203135363430322E383430313538323437362C203131393937302E3033323934323731373638203135363430322E38343131353935303038322C203131393936362E3533333333323631373838203135363430332E33303933383331393939362C203131393936302E35313530343736313534203135363430332E383036343832393230352C203131393935352E3638323236323638343034203135363430342E30323931323634313635342C203131393934392E3932373739313837363434203135363430332E38383534393438323232332C203131393933362E3334333130323734313234203135363430312E38303430373838323334322C203131393933332E3136373530343937343534203135363430312E30373933333736383533342C203131393933332E3136313636393935323032203135363430312E30373830303936373832382C203131393932352E3339383931353130343236203135363339392E333136313530363536372C203131393931312E3432333939343233373738203135363339362E30333431393933363834342C203131393839372E3039383236363230343231203135363339322E333833373038303234342C203131393838372E3536303836303530343637203135363338392E35333937303138343934362C203131393838322E3834383433363831383431203135363338382E303032363738323934372C203131393837392E3438393430333536383132203135363338362E38383230303532373731382C203131393837392E3436333636313533363331203135363338362E38373334393434363434342C203131393837352E3931393631313339393936203135363338352E373132343132363737352C203131393837302E3037393131393930323437203135363338332E34343431353630393135342C203131393836392E3937383436373038323536203135363338332E343036333036333230352C203131393836302E3138333935313837323734203135363337392E38343238393030383834352C203131393834382E3131363031313238313633203135363337342E39313233373334343336332C203131393832332E3438393836343837343931203135363336342E35373735343437313832322C203131393832332E33383936323335383839203135363336342E353336373436383035382C203131393831372E31373039353132393431203135363336322E30383338373630363137382C203131393831362E3032333635373736383337203135363336312E363331313534383338392C203131393739362E3736333033363038313438203135363335342E30323733303431383939382C203131393739322E3932313639323739393935203135363335322E35313130363030333636332C203131393738342E3636373431343032393537203135363334382E353235333137363336332C203131393737392E3232323837353736313638203135363334332E39323636313635313436382C203131393737382E37313931363636323736203135363334332E32383330353633323735382C203131393737382E3034323239323836363738203135363334322E35373431323930343531382C203131393737372E3234303132303139333636203135363334322E303130383735313231372C203131393737362E33343334373536353432203135363334312E36313439343030383935322C203131393737352E3338363831363739353233203135363334312E34303135333935303938382C203131393737342E3430363930373438303138203135363334312E33373838373432343734332C203131393737332E34343134303530373435203135363334312E35343738313533313534352C203131393737322E3532373431333239343137203135363334312E39303138373034303334342C203131393737312E3730303035363333303735203135363334322E34323734333333373239342C203131393737302E3939313132393034383334203135363334332E313034333037313333382C203131393737302E3432373837353132343835203135363334332E393036343739383036392C203131393737302E3033313934303039323637203135363334342E38303331323433343633362C203131393736392E3831383533393531333036203135363334352E37353937383332303533342C203131393736392E3739353837343235303539203135363334362E37333936393235323033382C203131393736392E39363438313533313836203135363334372E37303531393439323630362C203131393737302E33313838373034303636203135363334382E36313931383637303633382C203131393737302E3834343433333337363131203135363334392E34343635343336363938322C203131393737312E3636353633333337343337203135363335302E34393537343336373139332C203131393737322E3337363634393131323331203135363335312E323333373732323338362C203131393737382E3639373634393131343633203135363335362E35373237373232333634322C203131393737392E3734393834383530313531203135363335372E32353535363230373439352C203131393738382E3733393834383439363134203135363336312E35393635363230373638332C203131393738392E3037383234363438363734203135363336312E37343438303733353530382C203131393739332E3039313130353135343038203135363336332E33323837353135363539352C203131393831322E33353139363339323036203135363337302E39333236393538313039322C203131393831332E3530303732303830373437203135363337312E33383539393435343632332C203131393831392E3637303033343938363234203135363337332E38313933393637303538332C203131393834342E32363831333531323634203135363338342E313432343535323834332C203131393834342E3331313932383237323737203135363338342E31363035393032353330342C203131393835362E3439313932383237323437203135363338392E31333638393032353034362C203131393835362E3637333533323932203135363338392E32303639393336373838382C203131393836362E3530393030323939313134203135363339322E3738353331303030372C203131393837322E3432343838303039383139203135363339352E303832383433393037332C203131393837322E3637383333383436303839203135363339352E31373335303535333339352C203131393837362E3333373435353930333531203135363339362E33373232383530323530352C203131393837392E3639393539363432373437203135363339372E34393339393437323131322C203131393837392E3733313536353432393338203135363339372E35303435343130363235322C203131393838342E3532303536353433333931203135363339392E30363635343130363532332C203131393838342E3634323139373334323031203135363339392E31303435303532393234362C203131393839342E33333731393733343233203135363430312E39393535303532393133362C203131393839342E3533313335313430343334203135363430322E30343931363639353636352C203131393930392E3030303335313430313132203135363430352E37333631363639353536342C203131393930392E3039313837313233353735203135363430352E37353835373139343238362C203131393932332E3133303837313233323833203135363430392E30353535373139343439382C203131393932332E3136373333303034343136203135363430392E30363339393033323236342C203131393933302E3934353431323132353531203135363431302E383239333238303630392C203131393933342E3239343439353032323936203135363431312E35393336363233313530382C203131393933342E36343937343830303936203135363431312E36363133323432393434332C203131393934382E3732373734383031313231203135363431332E38313833323432393232322C203131393934392E3336303233383835333937203135363431332E383734343433323231362C203131393935352E3631303233383835333937203135363431342E30333034343332323438322C203131393935352E39363531303239333835203135363431342E30323637303234353838352C203131393936312E3036363130323934323032203135363431332E37393137303234353537322C203131393936312E3234373538393533373537203135363431332E37383030333036303738362C203131393936372E3438323538393533363937203135363431332E3236353033303631312C203131393936372E3733343035373238363937203135363431332E323337383430343939312C203131393937312E33353532393431323632203135363431322E37353333343339383039332C203131393937342E3432313533303231333733203135363431322E333437383431373439372C203131393937352E30343532393639343031203135363431322E32323435373030343033362C203131393937362E3634373239363933383139203135363431312E38303035373030343136342C203131393938312E3833343433373138383337203135363431302E34323735333239313936322C203131393938322E3131303137313433333335203135363431302E33343539393334353731362C203131393938382E3634393137313433303433203135363430382E32303539393334353635362C203131393938382E3737383836323038313534203135363430382E31363135373235393638342C203131393939312E3930303538353531303634203135363430372E303434323933323930372C203131393939342E3430303636373432373132203135363430362E32323831333837373433342C203131393939342E3636333533303735393332203135363430362E31333431323834373338322C203131393939372E3134343933343035323337203135363430352E31363737323832393139372C203131393939372E38363437343430353935203135363430342E39303837343431353237352C203131393939382E3235343532343631313432203135363430342E37343936363733303336342C203131393939392E3932363532343630393831203135363430332E39383336363733303437342C203131393939392E3933353434303736303431203135363430332E39373935373139323430352C203132303030302E3735383434303736363739203135363430332E363030353731393233342C203132303030332E3439323631353039363331203135363430322E333431323535313339342C203132303030372E3833353830303433373334203135363430302E33353439383232323932342C203132303032362E3835363436353733333039203135363339322E323233343933323738362C203132303032362E3938363130313532313231203135363339322E31363538383433313639362C203132303034322E3133383638343335383137203135363338352E31373331353132323432372C203132303035322E3231373938373838313834203135363338302E37393034393933363235372C203132303035372E3835313431313631313437203135363337382E33343930393530363533382C203132303037312E3439353433303438353139203135363337342E33303734333532303833382C203132303038332E3934343838323930393638203135363337302E383533393333353231382C203132303130312E37303131363030343335203135363336362E343932353638393836332C203132303130352E3538343535303334343035203135363336352E373232353032363038332C203132303131312E3938383337383434303032203135363336342E34353135333637393432382C203132303134332E3237343030333634343632203135363335382E32353533343438303539322C203132303136372E38373135363735383139203135363335332E37333038363239323332362C203132303137332E3235303239393935313534203135363335322E373435393237343936332C203132303138372E3631323136313133393439203135363335302E353938303236373530382C203132303138392E3235393331333436303737203135363335302E34303631383937333535342C203132303139392E32303036323939383137203135363334392E33303936313932313238342C203132303231332E3832333534333532353936203135363334382E32373534393632353034382C203132303233312E3532333235353437303931203135363334372E36323239333131313136332C203132303235322E3235393837373330373131203135363334372E31353731363332353835352C203132303236382E3135383231343536393932203135363334372E32303333393037393034372C203132303238302E3539393539303135363032203135363334382E323437393538383038382C203132303238332E3539313938333036393936203135363334382E35303635363036363739372C203132303239322E3030313235333435363238203135363334392E35303435393838353839342C203132303239392E33353133313430343833203135363335302E39373934373533343436382C203132303330312E3437393735313238303935203135363335312E34313436393434343931372C203132303330392E3636373334323530323931203135363335332E393035383732383337332C203132303331352E3533363437333035343332203135363335362E34333835393337373633372C203132303331392E32383132313434383536203135363335382E303535343436353533342C203132303332372E3638333432363536323336203135363336322E353339363533383038382C203132303332382E3034333137343337323333203135363336322E37353536353632333137382C203132303332382E3035393834343732343132203135363336322E37363536323135363838362C203132303333362E3037373536333538393132203135363336372E353337343036303431372C203132303334332E34323832333936363037203135363337332E33323132333733333636342C203132303334352E3436393233343530323734203135363337352E33373132383331353834392C203132303334392E3538303739313538313637203135363337392E35303330333236333434372C203132303335362E3137373439323030393334203135363338372E34393537353839343939382C203132303336312E3735303339313638363531203135363339352E37363330303939353339352C203132303336372E3036353938393831343734203135363430372E323036323938313432322C203132303337342E3539323738333339363032203135363432352E353732323239303033332C203132303337352E3935353330373438383638203135363432392E32323937383832383030332C203132303338382E3530363933313435383637203135363436322E393531393131323731372C203132303339362E3639323930313233303731203135363438352E37353139373434383337352C203132303430312E3439363638383539343234203135363439392E31343233383137353038362C203132303430312E3531333139383836393734203135363439392E31383737313433313939372C203132303430332E3031353030363739353432203135363530332E32353031393437353736322C203132303430352E3331373831343831393232203135363530392E34383336373530383534372C203132303430382E3932323637343738323038203135363531392E32323031393737343435352C203132303431332E3234383335303534393831203135363533312E30383733333435353239382C203132303432312E3535303335333436353436203135363535332E38363030323336353737362C203132303432382E3331333932343538323135203135363537342E33323838323938363135372C203132303432392E3833323530323332333239203135363538302E31303037323739373939372C203132303433302E3739343037353136303635203135363538362E38373631313831333335342C203132303433312E3037323433393334333134203135363539352E30303232383332333334352C203132303433302E3433383731313734323139203135363630342E37353434333437313135362C203132303433302E3331363939363932383837203135363630352E35343731343134363739382C203132303432392E3532313335373234393832203135363631302E36333234343730333039322C203132303432382E3730313631383532333338203135363631352E38343837383434333534382C203132303432382E36393833333233393036203135363631352E38363939393231333434352C203132303432382E3631343335383138303031203135363631362E343139373330323632392C203132303432382E3630303634333630313937203135363631362E35303633393437323636332C203132303432352E3132323239353239363538203135363633302E393234383230323032352C203132303432312E3936303531333731323835203135363634322E31373430393537393033372C203132303432302E3337343337373337383538203135363634372E38313935383039363234342C203132303432302E3238323335313830383837203135363634382E32303532343436393538362C203132303431382E3439333335313830343334203135363635372E32383332343436393734362C203132303431382E3439323332353630323038203135363635372E32383834363636343738352C203132303431372E3431343332353630373933203135363636322E37383934363636343631352C203132303431372E3337353335383034303932203135363636332E30313537323735333838322C203132303431362E3139353335383034313232203135363637302E39353237323735343135332C203132303431362E3134383636393637393536203135363637312E34313131363434303831342C203132303431352E3939393636393637353633203135363637342E30393831363434303731332C203132303431352E3939383935303931323733203135363637342E3131313434353738332C203132303431352E3732353935303931303833203135363637392E323833343435373831342C203132303431352E3732333133383638323536203135363637392E37353033393534393733372C203132303431362E3033363133383638333537203135363638372E34333833393534393833382C203132303431362E30373936383638313633203135363638372E39323339303739343132372C203132303431372E3131383638363832303833203135363639352E33393239303739343137372C203132303431372E3230383030393037303433203135363639352E38363634363235353638352C203132303431382E3932363030393036353138203135363730332E30353334363235353538342C203132303431392E3036313033373337323336203135363730332E35313737363635353232382C203132303432312E3432313033373337313737203135363731302E33373637363635353333382C203132303432312E3631303434313835323734203135363731302E38343739373238323533342C203132303432342E3538363434313835363236203135363731372E32383539373238323633362C203132303432342E3638393632383532393833203135363731372E34393631333334323930332C203132303432352E3639373632383533313134203135363731392E3433333133333432382C203132303432352E3730323035323137353838203135363731392E343431363134323033362C203132303433362E3738383035323137313335203135363734302E363435363134323033352C203132303435382E3230373438363835393839203135363738312E353833343435353132392C203132303435382E3938333230373132353933203135363738332E30363639313035353738332C203132303435392E3832393236393632353238203135363738342E363834303330323733362C203132303437302E3636323832323930383437203135363830352E34313031373536343431322C203132303437342E3634383331383335343034203135363831332E30323330333433383937342C203132303437342E36353833323034353036203135363831332E30343230343033343733382C203132303437382E3830373332303434373039203135363832302E38383530343033343538362C203132303530302E3731333338323937353738203135363836322E32393231353835333736362C203132303530362E3531303534393633383833203135363837332E323435343733353938322C203132303531372E3632313537363131313439203135363839342E323439313831353531342C203132303532312E3032393531333937313233203135363930302E37363835383436333936382C203132303533372E3330333133363339383535203135363933312E393234383631373731342C203132303536382E3232353039323232383233203135363939312E313131373737323738392C203132303537342E3239343832333739343635203135373030322E37333632363331383630332C203132303538382E3335303233303533333935203135373032392E36343330343139393234342C203132303539392E3736373730373639383839203135373035312E34393433383630303933322C203132303630352E3832343938313131303432203135373036332E323034323438363136352C203132303631392E3931393833303633353139203135373039302E343233383930313837372C203132303635382E3130363435393337303438203135373136342E31383931373330313438332C203132303638352E3237303231363532373637203135373231362E36383837303336363235342C203132303638352E3237333638383232313332203135373231362E36393534303130333838332C203132303638352E3730333638383232313032203135373231372E35323334303130343034342C203132303638352E38313436323034393831203135373231372E37323534373936373938322C203132303639332E31313936323034393738203135373233302E33333434373936383039332C203132303639332E3336313537323731373937203135373233302E37313139393936313330342C203132303730322E3637333537323731363936203135373234332E38393939393936313033322C203132303730322E3933323536343939323732203135373234342E32333536333436303437332C203132303731342E3531383536343938383139203135373235382E30303136333436303733352C203132303731342E3738343238333337323439203135373235382E32393331383436333834362C203132303731362E3434383238333337373032203135373235392E39383031383436333734352C203132303731362E3435363031373036393732203135373235392E39383830303739393333352C203132303732352E3532373031373037323035203135373236392E31343430303739393238342C203132303732382E3938303139363939343935203135373237322E36323931383935393737332C203132303732392E3131363137323837353037203135373237322E37363133313832363337372C203132303734372E3238373933383438313935203135373238392E37363130393839383233332C203132303739382E3539383335303034383333203135373333372E37373436313236313334332C203132303830332E3433323939373037303431203135373334322E3330353334343639322C203132303833302E3331383637393338353337203135373336372E34363338353635333931372C203132303833302E33323530303236343638203135373336372E34363937363333333135322C203132303833352E3035333933333236353237203135373337312E38373935373538393835382C203132303834372E3632363935313333343738203135373338332E37373332393533353632382C203132303930382E3534313836313737373732203135373434312E33363831353633393636372C203132303934382E3838383635353132303632203135373437392E34393636323130393630342C203132303938312E3638303130313333383938203135373531302E393336363235393131342C203132313030382E3738313538323539303235203135373533362E39333631323832353734352C203132313031352E39313733343138333239203135373534332E37373838353634373731382C203132313031372E3332313830333232363832203135373534352E31323532393838363531372C203132313031382E3434393235323539303137203135373534362E32303537323936333138322C203132313034322E3234333936323535373232203135373536392E303135343531363031382C203132313034322E33393136333934373038203135373536392E313531343332393131382C203132313035362E3336373633393436363837203135373538312E353131343332393131322C203132313035362E3637353931383938323933203135373538312E37363239333539383039352C203132313037322E3439363931383938353236203135373539332E36353339333539383335372C203132313037322E3831303236323539313435203135373539332E38373132353334353730342C203132313039302E3535323236323539303134203135373630352E31393932353334353439322C203132313039302E3731313333373831353332203135373630352E32393636393138343538372C203132313131342E35303033333738313234203135373631392E32363436393138343830382C203132313131342E3639313935323739313234203135373631392E33373136313733323733332C203132313132322E3336333935323739373038203135373632332E34333436313733323436322C203132313132322E3337303036383933353735203135373632332E34333738353039343238342C203132313133382E33383530363839323839203135373633312E38393038353039343434342C203132313133382E38333935333939333236203135373633322E31303233313733373232322C203132313135372E3539373533393933333931203135373633392E37313133313733373333322C203132313135372E383637393437383832203135373633392E38313230323036323736342C203132313138322E3837353330323139363538203135373634382E33313138303131363433382C203132313230322E3330343635363532313938203135373635342E39323135383135303832342C203132313230322E3331363033353536303038203135373635342E393235343337333539322C203132313231362E3435303732393731383436203135373635392E363936313333333239382C203132313231382E3333363736363338303039203135373636302E33373538343736373637372C203132313231382E3432313036383732373435203135373636302E34303533383135303032362C203132313235382E3232313334393634333331203135373637332E393530373735343337312C203132313235392E3934333332363430333636203135373637342E35343036353637343833322C203132313331392E3733313938373036393239203135373639352E32323835313931333830342C203132313333302E3139383232313930393531203135373639392E343837343339373638352C203132313334302E3438373733373534373131203135373730352E31383935343234333735382C203132313334392E3239363332323935353337203135373731322E343734393332353732322C203132313334392E3433363833313637323632203135373731322E35393039323538333139362C203132313335362E3236303238373233303136203135373731382E323936303837333935352C203132313336322E3337363230343738373136203135373732342E313335393432353039332C203132313336372E3234353538363738343433203135373733302E31363535323138393238362C203132313337312E3131363530353832323131203135373733372E333931393330393831372C203132313337312E3636313738393337323337203135373733382E32303634323538313236382C203132313337322E3335353439353531303937203135373733382E38393838393038313034342C203132313337332E3137303936353530303033203135373733392E34343237313439333334352C203132313337342E3037363836313238353138203135373733392E38313639393933323536372C203132313337352E3033383336393739393435203135373734302E30303733363034343738342C203132313337362E3031383534303830393836203135373734302E30303634383238323837332C203132313337362E3937393730363839343134203135373733392E38313434303031393437372C203132313337372E3838343933303937383732203135373733392E34333834393431373338372C203132313337382E3639393432353830393637203135373733382E38393332313036323336322C203132313337392E3339313839303830373431203135373733382E3139393530343438352C203132313337392E3933353731343933303434203135373733372E33383430333434393539352C203132313338302E3330393939393332323636203135373733362E34373831333837313037382C203132313338302E3530303336303434343831203135373733352E353136363330313936352C203132313338302E34393934383238323537203135373733342E353336343539313836312C203132313338302E3330373430303139313736203135373733332E35373532393331303138342C203132313337392E3933313439343137303836203135373733322E36373030363930313732372C203132313337352E38333834393431373631203135373732352E303239303639303138333829291A2F687474703A2F2F7777772E6F70656E6769732E6E65742F6F6E742F67656F73706172716C23776B744C69746572616C86011283010A2412220A20373630343563303738343364616636646461623338626130663632666561363112330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A260A240A22687474703A2F2F7777772E77332E6F72672F6E732F6C6F636E2347656F6D6574727997011294010A2412220A20353365306632333533623862353337616239316230336462303239393439323912300A2E0A2C687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F7265236E6F746174696F6E1A3A1A380A0831303831303430301A2C68747470733A2F2F6769706F642E766C61616E646572656E2E62652F6E732F6769706F64236769706F6449647C127A0A2412220A203533653066323335336238623533376162393162303364623032393934393239122A0A280A26687474703A2F2F7777772E77332E6F72672F6E732F61646D7323736368656D614167656E63791A261A240A1B68747470733A2F2F6769706F642E766C61616E646572656E2E626512056E6C2D626588011285010A2412220A20353365306632333533623862353337616239316230336462303239393439323912330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A280A260A24687474703A2F2F7777772E77332E6F72672F6E732F61646D73234964656E74696669657289011286010A2412220A20646435303437323837306535636162616339313334353437626331623931303112330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A290A270A25687474703A2F2F7777772E77332E6F72672F6E732F6F7267234F7267616E697A6174696F6E7312710A2412220A20646435303437323837306535636162616339313334353437626331623931303112310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A161A140A1047656D65656E7465204265726C616172480197011294010A2412220A20343265353162653434646565613637623030666435333831363339353865656212270A250A23687474703A2F2F646174612E6575726F70612E65752F6D38672F737461727454696D651A431A410A14323032322D30352D32375430373A30303A30305A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D658A011287010A2412220A20343265353162653434646565613637623030666435333831363339353865656212330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A2A0A280A26687474703A2F2F646174612E6575726F70612E65752F6D38672F506572696F644F6654696D6595011292010A2412220A20343265353162653434646565613637623030666435333831363339353865656212250A230A21687474703A2F2F646174612E6575726F70612E65752F6D38672F656E6454696D651A431A410A14323032322D30352D32375431373A30303A30305A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D65', '2024-06-26 12:47:02.671000', '2bc590c1-416e-4e20-8aaa-329ab2dfeb30', 'https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810400'); -INSERT INTO members (member_id, subject, old_id, collection_id, is_in_event_source, member_model, timestamp, +INSERT INTO members (member_id, subject, collection_id, is_in_event_source, member_model, timestamp, transaction_id, version_of) VALUES (2, 'https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810400/600001', - 'mobility-hindrances/https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810400/600001', 1, true, E'\\xB70112B4010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303031122F0A2D0A2B687474703A2F2F7075726C2E6F72672F64632F656C656D656E74732F312E312F636F6E7472696275746F721A2412220A203965653530313363633463633531636464383332633633323033323030646565B60112B3010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303031122A0A280A26687474703A2F2F7777772E77332E6F72672F6E732F61646D732376657273696F6E4E6F7465731A281A260A1D4D6F62696C69747948696E6472616E63655A6F6E65576173416464656412056E6C2D6265D40112D1010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112250A230A21687474703A2F2F7075726C2E6F72672F64632F7465726D732F6D6F6469666965641A4B1A490A1C323032322D30352D32305430393A35383A31352E383634363433335A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D65DD0112DA010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303031122D0A2B0A29687474703A2F2F7777772E77332E6F72672F6E732F70726F762367656E657261746564417454696D651A4C1A4A0A1D323032342D30362D32365431303A34373A30332E3937353239303630301A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D65C20112BF010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303031123A0A380A3668747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C697465697423496E6E616D652E7374617475731A2412220A203566343765663465373861313939366538303666313837303636343666393237D50112D2010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A3E0A3C0A3A68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974234D6F62696C69746569747368696E646572B90112B6010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112310A2F0A2D68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974237A6F6E651A2412220A206436323839343335373765666238326136336438386563326561343462353936D30112D0010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112240A220A20687474703A2F2F7075726C2E6F72672F64632F7465726D732F637265617465641A4B1A490A1C323032322D30352D32335430393A35383A31352E383631303839365A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D65E00112DD010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112280A260A24687474703A2F2F7075726C2E6F72672F64632F7465726D732F697356657273696F6E4F661A540A520A5068747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F3130383130343030BE0112BB010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112360A340A3268747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974236265686565726465721A2412220A203965653530313363633463633531636464383332633633323033323030646565B00112AD010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112280A260A24687474703A2F2F7777772E77332E6F72672F6E732F61646D73236964656E7469666965721A2412220A203132323534363263343762333635326565323536333839356465376636363761CA0112C7010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112300A2E0A2C68747470733A2F2F6769706F642E766C61616E646572656E2E62652F6E732F6769706F64236769706F6449641A361A340A0831303831303430301A28687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D6123696E7465676572BC0112B9010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112340A320A3068747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C697465697423706572696F64651A2412220A2063303433633862353431363336346430313631386534313534303830363336329101128E010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112260A240A22687474703A2F2F7075726C2E6F72672F64632F7465726D732F737562737472696E671A071A050A012648019E01129B010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303112280A260A24687474703A2F2F7075726C2E6F72672F64632F7465726D732F6465736372697074696F6E1A121A100A0C6F6D73636872696A76696E674801B30112B0010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303031122B0A290A27687474703A2F2F7075726C2E6F72672F64632F656C656D656E74732F312E312F63726561746F721A2412220A20396565353031336363346363353163646438333263363332303332303064656597011294010A2412220A20633034336338623534313633363464303136313865343135343038303633363212270A250A23687474703A2F2F646174612E6575726F70612E65752F6D38672F737461727454696D651A431A410A14323032322D30352D32375430373A30303A30305A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D658A011287010A2412220A20633034336338623534313633363464303136313865343135343038303633363212330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A2A0A280A26687474703A2F2F646174612E6575726F70612E65752F6D38672F506572696F644F6654696D6595011292010A2412220A20633034336338623534313633363464303136313865343135343038303633363212250A230A21687474703A2F2F646174612E6575726F70612E65752F6D38672F656E6454696D651A431A410A14323032322D30352D32375431373A30303A30305A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D657212700A2412220A20316566303034366266643230303138333737333561363465336566306139353412310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A151A130A0A48696E6465725A6F6E6512056E6C2D626589011286010A2412220A20396565353031336363346363353163646438333263363332303332303064656512330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A290A270A25687474703A2F2F7777772E77332E6F72672F6E732F6F7267234F7267616E697A6174696F6E7312710A2412220A20396565353031336363346363353163646438333263363332303332303064656512310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A161A140A1047656D65656E7465204265726C61617248018B011288010A2412220A20653835363738313339646638613339366239303166333136666461333139626412310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A2D1A2B0A2242657065726B746520646F6F7267616E6720766F6F7220766F657467616E6765727312056E6C2D626587011284010A2412220A20643632383934333537376566623832613633643838656332656134346235393612360A340A3268747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974235A6F6E652E747970651A2412220A2031656630303436626664323030313833373733356136346533656630613935349101128E010A2412220A20643632383934333537376566623832613633643838656332656134346235393612330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A310A2F0A2D68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974235A6F6E657612740A2412220A20643632383934333537376566623832613633643838656332656134346235393612260A240A22687474703A2F2F7777772E77332E6F72672F6E732F6C6F636E2367656F6D657472791A2412220A20356631343838313838663461623638316436646363613165316636616633623284011281010A2412220A20643632383934333537376566623832613633643838656332656134346235393612330A310A2F68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974236765766F6C671A2412220A20653835363738313339646638613339366239303166333136666461333139626480960112FC95010A2412220A203566313438383138386634616236383164366463636131653166366166336232122E0A2C0A2A687474703A2F2F7777772E6F70656E6769732E6E65742F6F6E742F67656F73706172716C236173574B541AA295011A9E95010AE994013C687474703A2F2F7777772E6F70656E6769732E6E65742F6465662F6372732F455053472F392E392E312F33313337303E20504F4C59474F4E2028283132313337352E38333834393431373631203135373732352E30323930363930313833382C203133313337352E33323039313439333632203136373732342E32343835373332383630382C203132313336392E3935323931343933353438203135373731372E363031353733323836322C203132313336392E3531353937363937333239203135373731372E31323637393334323037362C203132313336332E3034363937363936393035203135373731302E39343937393334313936382C203132313336322E38303132303432303131203135373731302E37333031333734393031342C203132313335352E38333932303432303336203135373730342E39303931333734393135342C203132313335352E3831353036393533353838203135373730342E383839303836353738312C203132313335352E3636373837333938333538203135373730342E373637353736313533322C203132313334362E35303336373730343931203135373639372E313838303637343330332C203132313334352E37343035373034373534203135373639362E36363736333637343632382C203132313333342E3738333537303437333134203135373639302E35393536333637343536352C203132313333342E3234343534383433323137203135373639302E33333737343939333131382C203132313332332E3337373534383433333438203135373638352E39313537343939323930362C203132313332332E3132373937333232303437203135373638352E38323138363930343033342C203132313236332E3230353937333232323038203135373636352E30383738363930343239372C203132313236332E31393133363632313639203135373636352E30383238343030333231382C203132313236312E3435373336363231323037203135373636342E34383838343030333136372C203132313236312E3434373933313236373834203135373636342E34383536313834393836342C203132313232312E363835323134333534203135373635302E393533303038383733372C203132313231392E3739333233333631353134203135373635302E323731313532333233312C203132313231392E3639363936343433363436203135373635302E323337353632363433332C203132313230352E3531393635363237303137203135373634352E34353234383337333134372C203132313138362E3039353334333437363533203135373633382E38343434313834393433382C203132313136312E3232323730393539333933203135373633302E333930343238303535312C203132313134322E3833313030323232303739203135373632322E3933303031313039312C203132313132372E3034303939303235393337203135373631342E35393537363337343833372C203132313131392E34363930323831303638203135373631302E353835373432363038392C203132313039352E3835353130383739313139203135373539362E37323035343333353332342C203132313037382E3335323535353639343132203135373538352E35343534323635393835382C203132313036322E38343332323738343937203135373537332E38383836373831333639352C203132313034392E3039313536343136303637203135373536312E37323730373531353738332C203132313032352E3336393033373434383237203135373533382E39383635343833393835332C203132313032342E32343138323730353833203135373533372E393036333436363935312C203132313032322E38333834323735303239203135373533362E35363039323233333730382C203132313031352E3730343033373836373431203135373532392E373139353037363334372C203132303938382E3630323431373431333039203135373530332E37313938373137343537362C203132303935352E3739363337393738313233203135373437322E323635383736353839382C203132303935352E3737303232303035323538203135373437322E32343039373536393438352C203132303931352E3431313637393232323933203135373433342E31303134303936323332382C203132303835342E3439383539333438303237203135373337362E35303832373430343735322C203132303834312E3931333034383636343333203135373336342E36303237303436343230322C203132303834312E38383639393733353037203135373336342E353738323336363638392C203132303833372E3134383136313533353832203135373336302E31353931383733323836322C203132303831302E3236393636323232343639203135373333352E30303733393838383839332C203132303830352E34333530303239333033203135373333302E34373636353533303935332C203132303735342E3132303239363032363936203135373238322E34353931323034353034352C203132303733362E3031373036373835323732203135373236352E35323334353637393831372C203132303733322E3633303839323933313135203135373236322E313035393031313539372C203132303732332E3536333835343038313434203135373235322E393533383939343330392C203132303732322E3034323333303639393931203135373235312E34313133343533383237342C203132303731302E3732303035323035383538203135373233372E39353836383830343931342C203132303730312E36353938373539303734203135373232352E313237333330333331312C203132303639342E35323531373534373331203135373231322E383132323830363638322C203132303639342E31353030353031353738203135373231322E303839393436333338322C203132303636362E3938373738333437333634203135373135392E35393332393633333532352C203132303632382E3830303239373638393537203135373038352E38323633353737303031332C203132303631342E3730363533303136303639203135373035382E363038383036353730342C203132303630382E3634353031383839353834203135373034362E38393037353133383630332C203132303630382E3633353532383136313835203135373034362E38373234393631323836342C203132303539372E3231333634383831373735203135373032352E30313237323730353737372C203132303538332E3135383937323836333934203135363939382E31303733343733383734342C203132303537372E3038393137363230313233203135363938362E34383237333638313037352C203132303534362E3136363735313434383937203135363932372E323934393233353130382C203132303532392E3839323836333630333737203135363839362E313338313338323239362C203132303532362E3437383130383232353532203135363838392E363035363932363138322C203132303532362E3436363638363234333235203135363838392E35383339373233303435362C203132303531352E3334393638363234343536203135363836382E353638393732333037372C203132303530392E3535323431353732333034203135363835372E36313534363039353531362C203132303438372E3634363634383236303237203135363831362E32303839303035303435342C203132303438332E3530323730313031303935203135363830382E33373534353138393039382C203132303437392E3532343432393832353036203135363830302E3737363339343734312C203132303436382E3639313137373038363232203135363738302E30353038323433353530372C203132303436372E38343435333831353436203135363737382E343332363032333335322C203132303436372E3036383739323836373639203135363737362E39343930383934343130372C203132303434352E3634393539303634313631203135363733362E30313137303236323331362C203132303433342E35363631363337303435203135363731342E383132363234303637342C203132303433332E3631343432353638343333203135363731322E39383337333836303933332C203132303433302E3739343234303839333939203135363730362E383832383134363633392C203132303432382E35393537313533393733203135363730302E34393331313730343138362C203132303432362E3939303037353734383533203135363639332E3737363136303030352C203132303432362E3031373933343736323631203135363638362E37383737383536313336352C203132303432352E3732343336393430323135203135363637392E35373731343530383838372C203132303432352E39383436393835333539203135363637342E3634353139353338322C203132303432362E3132303535393934393738203135363637322E31393531333038393030332C203132303432372E3234393735363234393036203135363636342E35393938353033353338372C203132303432382E3330353136323637373136203135363635392E323134313434363131312C203132303433302E3035353238373033373636203135363635302E33333334313239363933342C203132303433312E3538373535343435333336203135363634342E38373936363136353433332C203132303433342E3737343438363238363535203135363633332E35343039303432303934382C203132303433342E3832313536313831313036203135363633332E333630353737383931352C203132303433382E3336383536313830393435203135363631382E36353735373738383938382C203132303433382E3434363534343839313335203135363631382E323636353230353438372C203132303433382E3439333534343838393734203135363631372E393639353230353530332C203132303433382E3439373636373631313732203135363631372E39343330303738363635362C203132303433382E3538323034373330343535203135363631372E333930363135323434312C203132303433392E3430303338313438323136203135363631322E31383332313535363630342C203132303434302E3139373930323931313233203135363630372E30383538393031383736382C203132303434302E3230303038333231333332203135363630372E30373138323337373837342C203132303434302E3335363038333230393039203135363630362E303535383233373736312C203132303434302E34303334373632323138203135363630352E363231323332393433382C203132303434312E3036373437363232363334203135363539352E34303332333239343533332C203132303434312E3037353036393031373734203135363539342E39303738323339323637372C203132303434302E3737393036393031333932203135363538362E32363638323339323738372C203132303434302E3733323339333930373635203135363538352E373335343333313830352C203132303433392E3639323339333930383534203135363537382E343037343333313738392C203132303433392E3537373434333336303631203135363537372E38333738303231303036362C203132303433372E3934353434333336313333203135363537312E36333438303231303237382C203132303433372E3835373533303938343933203135363537312E333338323538363133382C203132303433312E303231353330393832203135363535302E363530323538363132382C203132303433302E3937313537323632343731203135363535302E353036343534373031312C203132303432322E3634333631313130373636203135363532372E36363235363032343436372C203132303431382E3331333634393434393138203135363531352E37383336363534343633362C203132303431382E33303439343131313138203135363531352E37353939363130353432352C203132303431342E36393735363337343835203135363530362E30313636343237343635322C203132303431322E33393531383531383033203135363439392E37383433323439313337352C203132303431302E3930313136353632373233203135363439352E37343239313231333637322C203132303430362E3130353331313430333835203135363438322E33373436313832353030362C203132303339372E3930383838353934343832203135363435392E35343534333237353032352C203132303339372E38383839333430343737203135363435392E34393038363036333639362C203132303338352E3332363933343034383732203135363432352E37343038363036333639362C203132303338332E3933353435303831373336203135363432322E30303535363239303734332C203132303338332E3837363534353738313832203135363432312E383534393331393237362C203132303337362E32373535343537373833203135363430332E33303739333139323932322C203132303337362E3138333634343733333734203135363430332E30393735383139323438372C203132303337302E3635323634343733373937203135363339312E31393035383139323333352C203132303337302E3236333938353438393239203135363339302E353032323138333733392C203132303336342E3333333938353438393539203135363338312E37303532313833373535312C203132303336342E30343432323635363538203135363338312E33313733303938333538342C203132303335372E3134353232363536313837203135363337322E39353833303938333437342C203132303335362E3833333138333733393338203135363337322E363134313337313433352C203132303335322E3535373138333733383834203135363336382E33313731333731343531322C203132303335302E3330313334373231373336203135363336362E303531323936373039332C203132303334392E3834393835303336383733203135363336352E363439353634373539392C203132303334322E30303538353033363435203135363335392E343737353634373631352C203132303334312E3437313135353237313635203135363335392E31313033373834333331362C203132303333332E31383235303031323831203135363335342E313737333434393133322C203132303333322E3732323832353632323834203135363335332E39303133343337363937342C203132303333322E3530333137383530383132203135363335332E373736383935343330312C203132303332332E3830373137383531333235203135363334392E313335383935343237352C203132303332332E3433343937383936343631203135363334382E393536363031333839332C203132303331392E3439393937383936323232203135363334372E32353736303133393230382C203132303331332E3337323037343837363832203135363334342E36313332313131343134362C203132303331322E3834363433353237383734203135363334342E343230353137313531392C203132303330342E3136363433353237393034203135363334312E37373935313731353330322C203132303330332E3731323636353135353835203135363334312E36363433363037303831382C203132303330312E3334353636353134393731203135363334312E31383033363037303730382C203132303330312E3332373730303038323339203135363334312E313736373231353335362C203132303239332E3737323730303038323639203135363333392E363630373231353336372C203132303239332E3337383237393735353938203135363333392E35393738343634393232322C203132303238342E363931323739373537203135363333382E35363638343634393237332C203132303238342E3533323439343231313938203135363333382E353530353637303031372C203132303238312E3435343439343231303337203135363333382E32383435363639393930362C203132303238312E3434323332343230323034203135363333382E32383335333032343339332C203132303236382E3739333332343230353536203135363333372E32323135333032343439352C203132303236382E3338393533383431383632203135363333372E323034303231313336352C203132303235322E3232353533383432313534203135363333372E31353730323131333831322C203132303235322E3039383732323639363932203135363333372E31353832363037373938332C203132303233312E323632373232363934203135363333372E363236323630373738332C203132303233312E3139303738313732363638203135363333372E36323833393437383936372C203132303231332E3337303738313732363338203135363333382E323835333934373931322C203132303231332E3230323238343134383331203135363333382E323934343536333634382C203132303139382E3339373238343134383631203135363333392E33343134353633363331382C203132303139382E3230313830333130333833203135363333392E333539313432383432372C203132303138382E3134373830333130363136203135363334302E343638313432383433382C203132303138382E3131373538303430353531203135363334302E343731353639363135392C203132303138362E33373435383034303438203135363334302E363734353639363133382C203132303138362E3231333434353636393734203135363334302E36393539393635323136322C203132303137312E3639303434353636373833203135363334322E38363739393635323337342C203132303137312E3532393339313734303237203135363334322E38393437373832393336322C203132303136362E3036383339313733373335203135363334332E38393437373832393336322C203132303134312E3433313437333338343935203135363334382E34323634393734323332342C203132303134312E3336343630363237373737203135363334382E34333932363831383030322C203132303131302E3034343630363237373437203135363335342E363432323638313737392C203132303130332E3633393034333239393036203135363335352E39313335373739373235362C203132303039392E3634353434393636303132203135363335362E37303534393733393130392C203132303039392E3432353333313533363538203135363335362E37353433323838383837382C203132303038312E3438373333313533353537203135363336312E31363033323838383832382C203132303038312E3334333436323035393837203135363336312E3139373934333731372C203132303036382E3738303436323035383836203135363336342E363832393433373136342C203132303036382E3639363838353337303938203135363336342E37303639313235353138362C203132303035342E3732303838353337343932203135363336382E38343639313235353234362C203132303035342E3135323738383635363838203135363336392E30353332393733343435372C203132303034382E3233383738383635323335203135363337312E36313632393733343535382C203132303034382E3233333233373037303234203135363337312E36313837303732373334322C203132303033382E3130303233373036383932203135363337362E303234373037323732392C203132303033372E39393838393834373832203135363337362E30373031313536383037352C203132303032322E3836303330373731373338203135363338332E303536333931363030312C203132303030332E3834373533343237303535203135363339312E313834353036373231322C203132303030332E3733333439333934313032203135363339312E32333439353130303833342C203131393939392E33323734393339333738203135363339332E32343939353130303532312C203131393939392E33313532383334303236203135363339332E32353535353531303837372C203131393939362E35373534323130343839203135363339342E35313734393137313535322C203131393939352E3735373031353330353533203135363339342E38393433373630313036332C203131393939342E32383130313431383535203135363339352E35373035383232363530362C203131393939332E3639383235353934313532203135363339352E37383032353538343635362C203131393939332E3537363436393234323736203135363339352E38323538373135323730382C203131393939312E3136343538383135383038203135363339362E37363531393537383938332C203131393938382E3733303333323537303134203135363339372E35353938363132323831362C203131393938382E3539373133373931333034203135363339372E36303534323734303430382C203131393938352E34373336373837333237203135363339382E37323333323739343336352C203131393937392E313336353232393139203135363430302E373937323730393730332C203131393937342E3038383633323838373432203135363430322E31333334343835333230382C203131393937322E3739343635393438343835203135363430322E34373539323333383935372C203131393937302E3034303436393739313232203135363430322E383430313538323437362C203131393937302E3033323934323731373638203135363430322E38343131353935303038322C203131393936362E3533333333323631373838203135363430332E33303933383331393939362C203131393936302E35313530343736313534203135363430332E383036343832393230352C203131393935352E3638323236323638343034203135363430342E30323931323634313635342C203131393934392E3932373739313837363434203135363430332E38383534393438323232332C203131393933362E3334333130323734313234203135363430312E38303430373838323334322C203131393933332E3136373530343937343534203135363430312E30373933333736383533342C203131393933332E3136313636393935323032203135363430312E30373830303936373832382C203131393932352E3339383931353130343236203135363339392E333136313530363536372C203131393931312E3432333939343233373738203135363339362E30333431393933363834342C203131393839372E3039383236363230343231203135363339322E333833373038303234342C203131393838372E3536303836303530343637203135363338392E35333937303138343934362C203131393838322E3834383433363831383431203135363338382E303032363738323934372C203131393837392E3438393430333536383132203135363338362E38383230303532373731382C203131393837392E3436333636313533363331203135363338362E38373334393434363434342C203131393837352E3931393631313339393936203135363338352E373132343132363737352C203131393837302E3037393131393930323437203135363338332E34343431353630393135342C203131393836392E3937383436373038323536203135363338332E343036333036333230352C203131393836302E3138333935313837323734203135363337392E38343238393030383834352C203131393834382E3131363031313238313633203135363337342E39313233373334343336332C203131393832332E3438393836343837343931203135363336342E35373735343437313832322C203131393832332E33383936323335383839203135363336342E353336373436383035382C203131393831372E31373039353132393431203135363336322E30383338373630363137382C203131393831362E3032333635373736383337203135363336312E363331313534383338392C203131393739362E3736333033363038313438203135363335342E30323733303431383939382C203131393739322E3932313639323739393935203135363335322E35313130363030333636332C203131393738342E3636373431343032393537203135363334382E353235333137363336332C203131393737392E3232323837353736313638203135363334332E39323636313635313436382C203131393737382E37313931363636323736203135363334332E32383330353633323735382C203131393737382E3034323239323836363738203135363334322E35373431323930343531382C203131393737372E3234303132303139333636203135363334322E303130383735313231372C203131393737362E33343334373536353432203135363334312E36313439343030383935322C203131393737352E3338363831363739353233203135363334312E34303135333935303938382C203131393737342E3430363930373438303138203135363334312E33373838373432343734332C203131393737332E34343134303530373435203135363334312E35343738313533313534352C203131393737322E3532373431333239343137203135363334312E39303138373034303334342C203131393737312E3730303035363333303735203135363334322E34323734333333373239342C203131393737302E3939313132393034383334203135363334332E313034333037313333382C203131393737302E3432373837353132343835203135363334332E393036343739383036392C203131393737302E3033313934303039323637203135363334342E38303331323433343633362C203131393736392E3831383533393531333036203135363334352E37353937383332303533342C203131393736392E3739353837343235303539203135363334362E37333936393235323033382C203131393736392E39363438313533313836203135363334372E37303531393439323630362C203131393737302E33313838373034303636203135363334382E36313931383637303633382C203131393737302E3834343433333337363131203135363334392E34343635343336363938322C203131393737312E3636353633333337343337203135363335302E34393537343336373139332C203131393737322E3337363634393131323331203135363335312E323333373732323338362C203131393737382E3639373634393131343633203135363335362E35373237373232333634322C203131393737392E3734393834383530313531203135363335372E32353535363230373439352C203131393738382E3733393834383439363134203135363336312E35393635363230373638332C203131393738392E3037383234363438363734203135363336312E37343438303733353530382C203131393739332E3039313130353135343038203135363336332E33323837353135363539352C203131393831322E33353139363339323036203135363337302E39333236393538313039322C203131393831332E3530303732303830373437203135363337312E33383539393435343632332C203131393831392E3637303033343938363234203135363337332E38313933393637303538332C203131393834342E32363831333531323634203135363338342E313432343535323834332C203131393834342E3331313932383237323737203135363338342E31363035393032353330342C203131393835362E3439313932383237323437203135363338392E31333638393032353034362C203131393835362E3637333533323932203135363338392E32303639393336373838382C203131393836362E3530393030323939313134203135363339322E3738353331303030372C203131393837322E3432343838303039383139203135363339352E303832383433393037332C203131393837322E3637383333383436303839203135363339352E31373335303535333339352C203131393837362E3333373435353930333531203135363339362E33373232383530323530352C203131393837392E3639393539363432373437203135363339372E34393339393437323131322C203131393837392E3733313536353432393338203135363339372E35303435343130363235322C203131393838342E3532303536353433333931203135363339392E30363635343130363532332C203131393838342E3634323139373334323031203135363339392E31303435303532393234362C203131393839342E33333731393733343233203135363430312E39393535303532393133362C203131393839342E3533313335313430343334203135363430322E30343931363639353636352C203131393930392E3030303335313430313132203135363430352E37333631363639353536342C203131393930392E3039313837313233353735203135363430352E37353835373139343238362C203131393932332E3133303837313233323833203135363430392E30353535373139343439382C203131393932332E3136373333303034343136203135363430392E30363339393033323236342C203131393933302E3934353431323132353531203135363431302E383239333238303630392C203131393933342E3239343439353032323936203135363431312E35393336363233313530382C203131393933342E36343937343830303936203135363431312E36363133323432393434332C203131393934382E3732373734383031313231203135363431332E38313833323432393232322C203131393934392E3336303233383835333937203135363431332E383734343433323231362C203131393935352E3631303233383835333937203135363431342E30333034343332323438322C203131393935352E39363531303239333835203135363431342E30323637303234353838352C203131393936312E3036363130323934323032203135363431332E37393137303234353537322C203131393936312E3234373538393533373537203135363431332E37383030333036303738362C203131393936372E3438323538393533363937203135363431332E3236353033303631312C203131393936372E3733343035373238363937203135363431332E323337383430343939312C203131393937312E33353532393431323632203135363431322E37353333343339383039332C203131393937342E3432313533303231333733203135363431322E333437383431373439372C203131393937352E30343532393639343031203135363431322E32323435373030343033362C203131393937362E3634373239363933383139203135363431312E38303035373030343136342C203131393938312E3833343433373138383337203135363431302E34323735333239313936322C203131393938322E3131303137313433333335203135363431302E33343539393334353731362C203131393938382E3634393137313433303433203135363430382E32303539393334353635362C203131393938382E3737383836323038313534203135363430382E31363135373235393638342C203131393939312E3930303538353531303634203135363430372E303434323933323930372C203131393939342E3430303636373432373132203135363430362E32323831333837373433342C203131393939342E3636333533303735393332203135363430362E31333431323834373338322C203131393939372E3134343933343035323337203135363430352E31363737323832393139372C203131393939372E38363437343430353935203135363430342E39303837343431353237352C203131393939382E3235343532343631313432203135363430342E37343936363733303336342C203131393939392E3932363532343630393831203135363430332E39383336363733303437342C203131393939392E3933353434303736303431203135363430332E39373935373139323430352C203132303030302E3735383434303736363739203135363430332E363030353731393233342C203132303030332E3439323631353039363331203135363430322E333431323535313339342C203132303030372E3833353830303433373334203135363430302E33353439383232323932342C203132303032362E3835363436353733333039203135363339322E323233343933323738362C203132303032362E3938363130313532313231203135363339322E31363538383433313639362C203132303034322E3133383638343335383137203135363338352E31373331353132323432372C203132303035322E3231373938373838313834203135363338302E37393034393933363235372C203132303035372E3835313431313631313437203135363337382E33343930393530363533382C203132303037312E3439353433303438353139203135363337342E33303734333532303833382C203132303038332E3934343838323930393638203135363337302E383533393333353231382C203132303130312E37303131363030343335203135363336362E343932353638393836332C203132303130352E3538343535303334343035203135363336352E373232353032363038332C203132303131312E3938383337383434303032203135363336342E34353135333637393432382C203132303134332E3237343030333634343632203135363335382E32353533343438303539322C203132303136372E38373135363735383139203135363335332E37333038363239323332362C203132303137332E3235303239393935313534203135363335322E373435393237343936332C203132303138372E3631323136313133393439203135363335302E353938303236373530382C203132303138392E3235393331333436303737203135363335302E34303631383937333535342C203132303139392E32303036323939383137203135363334392E33303936313932313238342C203132303231332E3832333534333532353936203135363334382E32373534393632353034382C203132303233312E3532333235353437303931203135363334372E36323239333131313136332C203132303235322E3235393837373330373131203135363334372E31353731363332353835352C203132303236382E3135383231343536393932203135363334372E32303333393037393034372C203132303238302E3539393539303135363032203135363334382E323437393538383038382C203132303238332E3539313938333036393936203135363334382E35303635363036363739372C203132303239322E3030313235333435363238203135363334392E35303435393838353839342C203132303239392E33353133313430343833203135363335302E39373934373533343436382C203132303330312E3437393735313238303935203135363335312E34313436393434343931372C203132303330392E3636373334323530323931203135363335332E393035383732383337332C203132303331352E3533363437333035343332203135363335362E34333835393337373633372C203132303331392E32383132313434383536203135363335382E303535343436353533342C203132303332372E3638333432363536323336203135363336322E353339363533383038382C203132303332382E3034333137343337323333203135363336322E37353536353632333137382C203132303332382E3035393834343732343132203135363336322E37363536323135363838362C203132303333362E3037373536333538393132203135363336372E353337343036303431372C203132303334332E34323832333936363037203135363337332E33323132333733333636342C203132303334352E3436393233343530323734203135363337352E33373132383331353834392C203132303334392E3538303739313538313637203135363337392E35303330333236333434372C203132303335362E3137373439323030393334203135363338372E34393537353839343939382C203132303336312E3735303339313638363531203135363339352E37363330303939353339352C203132303336372E3036353938393831343734203135363430372E323036323938313432322C203132303337342E3539323738333339363032203135363432352E353732323239303033332C203132303337352E3935353330373438383638203135363432392E32323937383832383030332C203132303338382E3530363933313435383637203135363436322E393531393131323731372C203132303339362E3639323930313233303731203135363438352E37353139373434383337352C203132303430312E3439363638383539343234203135363439392E31343233383137353038362C203132303430312E3531333139383836393734203135363439392E31383737313433313939372C203132303430332E3031353030363739353432203135363530332E32353031393437353736322C203132303430352E3331373831343831393232203135363530392E34383336373530383534372C203132303430382E3932323637343738323038203135363531392E32323031393737343435352C203132303431332E3234383335303534393831203135363533312E30383733333435353239382C203132303432312E3535303335333436353436203135363535332E38363030323336353737362C203132303432382E3331333932343538323135203135363537342E33323838323938363135372C203132303432392E3833323530323332333239203135363538302E31303037323739373939372C203132303433302E3739343037353136303635203135363538362E38373631313831333335342C203132303433312E3037323433393334333134203135363539352E30303232383332333334352C203132303433302E3433383731313734323139203135363630342E37353434333437313135362C203132303433302E3331363939363932383837203135363630352E35343731343134363739382C203132303432392E3532313335373234393832203135363631302E36333234343730333039322C203132303432382E3730313631383532333338203135363631352E38343837383434333534382C203132303432382E36393833333233393036203135363631352E38363939393231333434352C203132303432382E3631343335383138303031203135363631362E343139373330323632392C203132303432382E3630303634333630313937203135363631362E35303633393437323636332C203132303432352E3132323239353239363538203135363633302E393234383230323032352C203132303432312E3936303531333731323835203135363634322E31373430393537393033372C203132303432302E3337343337373337383538203135363634372E38313935383039363234342C203132303432302E3238323335313830383837203135363634382E32303532343436393538362C203132303431382E3439333335313830343334203135363635372E32383332343436393734362C203132303431382E3439323332353630323038203135363635372E32383834363636343738352C203132303431372E3431343332353630373933203135363636322E37383934363636343631352C203132303431372E3337353335383034303932203135363636332E30313537323735333838322C203132303431362E3139353335383034313232203135363637302E39353237323735343135332C203132303431362E3134383636393637393536203135363637312E34313131363434303831342C203132303431352E3939393636393637353633203135363637342E30393831363434303731332C203132303431352E3939383935303931323733203135363637342E3131313434353738332C203132303431352E3732353935303931303833203135363637392E323833343435373831342C203132303431352E3732333133383638323536203135363637392E37353033393534393733372C203132303431362E3033363133383638333537203135363638372E34333833393534393833382C203132303431362E30373936383638313633203135363638372E39323339303739343132372C203132303431372E3131383638363832303833203135363639352E33393239303739343137372C203132303431372E3230383030393037303433203135363639352E38363634363235353638352C203132303431382E3932363030393036353138203135363730332E30353334363235353538342C203132303431392E3036313033373337323336203135363730332E35313737363635353232382C203132303432312E3432313033373337313737203135363731302E33373637363635353333382C203132303432312E3631303434313835323734203135363731302E38343739373238323533342C203132303432342E3538363434313835363236203135363731372E32383539373238323633362C203132303432342E3638393632383532393833203135363731372E34393631333334323930332C203132303432352E3639373632383533313134203135363731392E3433333133333432382C203132303432352E3730323035323137353838203135363731392E343431363134323033362C203132303433362E3738383035323137313335203135363734302E363435363134323033352C203132303435382E3230373438363835393839203135363738312E353833343435353132392C203132303435382E3938333230373132353933203135363738332E30363639313035353738332C203132303435392E3832393236393632353238203135363738342E363834303330323733362C203132303437302E3636323832323930383437203135363830352E34313031373536343431322C203132303437342E3634383331383335343034203135363831332E30323330333433383937342C203132303437342E36353833323034353036203135363831332E30343230343033343733382C203132303437382E3830373332303434373039203135363832302E38383530343033343538362C203132303530302E3731333338323937353738203135363836322E32393231353835333736362C203132303530362E3531303534393633383833203135363837332E323435343733353938322C203132303531372E3632313537363131313439203135363839342E323439313831353531342C203132303532312E3032393531333937313233203135363930302E37363835383436333936382C203132303533372E3330333133363339383535203135363933312E393234383631373731342C203132303536382E3232353039323232383233203135363939312E313131373737323738392C203132303537342E3239343832333739343635203135373030322E37333632363331383630332C203132303538382E3335303233303533333935203135373032392E36343330343139393234342C203132303539392E3736373730373639383839203135373035312E34393433383630303933322C203132303630352E3832343938313131303432203135373036332E323034323438363136352C203132303631392E3931393833303633353139203135373039302E343233383930313837372C203132303635382E3130363435393337303438203135373136342E31383931373330313438332C203132303638352E3237303231363532373637203135373231362E36383837303336363235342C203132303638352E3237333638383232313332203135373231362E36393534303130333838332C203132303638352E3730333638383232313032203135373231372E35323334303130343034342C203132303638352E38313436323034393831203135373231372E37323534373936373938322C203132303639332E31313936323034393738203135373233302E33333434373936383039332C203132303639332E3336313537323731373937203135373233302E37313139393936313330342C203132303730322E3637333537323731363936203135373234332E38393939393936313033322C203132303730322E3933323536343939323732203135373234342E32333536333436303437332C203132303731342E3531383536343938383139203135373235382E30303136333436303733352C203132303731342E3738343238333337323439203135373235382E32393331383436333834362C203132303731362E3434383238333337373032203135373235392E39383031383436333734352C203132303731362E3435363031373036393732203135373235392E39383830303739393333352C203132303732352E3532373031373037323035203135373236392E31343430303739393238342C203132303732382E3938303139363939343935203135373237322E36323931383935393737332C203132303732392E3131363137323837353037203135373237322E37363133313832363337372C203132303734372E3238373933383438313935203135373238392E37363130393839383233332C203132303739382E3539383335303034383333203135373333372E37373436313236313334332C203132303830332E3433323939373037303431203135373334322E3330353334343639322C203132303833302E3331383637393338353337203135373336372E34363338353635333931372C203132303833302E33323530303236343638203135373336372E34363937363333333135322C203132303833352E3035333933333236353237203135373337312E38373935373538393835382C203132303834372E3632363935313333343738203135373338332E37373332393533353632382C203132303930382E3534313836313737373732203135373434312E33363831353633393636372C203132303934382E3838383635353132303632203135373437392E34393636323130393630342C203132303938312E3638303130313333383938203135373531302E393336363235393131342C203132313030382E3738313538323539303235203135373533362E39333631323832353734352C203132313031352E39313733343138333239203135373534332E37373838353634373731382C203132313031372E3332313830333232363832203135373534352E31323532393838363531372C203132313031382E3434393235323539303137203135373534362E32303537323936333138322C203132313034322E3234333936323535373232203135373536392E303135343531363031382C203132313034322E33393136333934373038203135373536392E313531343332393131382C203132313035362E3336373633393436363837203135373538312E353131343332393131322C203132313035362E3637353931383938323933203135373538312E37363239333539383039352C203132313037322E3439363931383938353236203135373539332E36353339333539383335372C203132313037322E3831303236323539313435203135373539332E38373132353334353730342C203132313039302E3535323236323539303134203135373630352E31393932353334353439322C203132313039302E3731313333373831353332203135373630352E32393636393138343538372C203132313131342E35303033333738313234203135373631392E32363436393138343830382C203132313131342E3639313935323739313234203135373631392E33373136313733323733332C203132313132322E3336333935323739373038203135373632332E34333436313733323436322C203132313132322E3337303036383933353735203135373632332E34333738353039343238342C203132313133382E33383530363839323839203135373633312E38393038353039343434342C203132313133382E38333935333939333236203135373633322E31303233313733373232322C203132313135372E3539373533393933333931203135373633392E37313133313733373333322C203132313135372E383637393437383832203135373633392E38313230323036323736342C203132313138322E3837353330323139363538203135373634382E33313138303131363433382C203132313230322E3330343635363532313938203135373635342E39323135383135303832342C203132313230322E3331363033353536303038203135373635342E393235343337333539322C203132313231362E3435303732393731383436203135373635392E363936313333333239382C203132313231382E3333363736363338303039203135373636302E33373538343736373637372C203132313231382E3432313036383732373435203135373636302E34303533383135303032362C203132313235382E3232313334393634333331203135373637332E393530373735343337312C203132313235392E3934333332363430333636203135373637342E35343036353637343833322C203132313331392E3733313938373036393239203135373639352E32323835313931333830342C203132313333302E3139383232313930393531203135373639392E343837343339373638352C203132313334302E3438373733373534373131203135373730352E31383935343234333735382C203132313334392E3239363332323935353337203135373731322E343734393332353732322C203132313334392E3433363833313637323632203135373731322E35393039323538333139362C203132313335362E3236303238373233303136203135373731382E323936303837333935352C203132313336322E3337363230343738373136203135373732342E313335393432353039332C203132313336372E3234353538363738343433203135373733302E31363535323138393238362C203132313337312E3131363530353832323131203135373733372E333931393330393831372C203132313337312E3636313738393337323337203135373733382E32303634323538313236382C203132313337322E3335353439353531303937203135373733382E38393838393038313034342C203132313337332E3137303936353530303033203135373733392E34343237313439333334352C203132313337342E3037363836313238353138203135373733392E38313639393933323536372C203132313337352E3033383336393739393435203135373734302E30303733363034343738342C203132313337362E3031383534303830393836203135373734302E30303634383238323837332C203132313337362E3937393730363839343134203135373733392E38313434303031393437372C203132313337372E3838343933303937383732203135373733392E34333834393431373338372C203132313337382E3639393432353830393637203135373733382E38393332313036323336322C203132313337392E3339313839303830373431203135373733382E3139393530343438352C203132313337392E3933353731343933303434203135373733372E33383430333434393539352C203132313338302E3330393939393332323636203135373733362E34373831333837313037382C203132313338302E3530303336303434343831203135373733352E353136363330313936352C203132313338302E34393934383238323537203135373733342E353336343539313836312C203132313338302E3330373430303139313736203135373733332E35373532393331303138342C203132313337392E3933313439343137303836203135373733322E36373030363930313732372C203132313337352E38333834393431373631203135373732352E303239303639303138333829291A2F687474703A2F2F7777772E6F70656E6769732E6E65742F6F6E742F67656F73706172716C23776B744C69746572616C86011283010A2412220A20356631343838313838663461623638316436646363613165316636616633623212330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A260A240A22687474703A2F2F7777772E77332E6F72672F6E732F6C6F636E2347656F6D6574727997011294010A2412220A20313232353436326334376233363532656532353633383935646537663636376112300A2E0A2C687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F7265236E6F746174696F6E1A3A1A380A0831303831303430301A2C68747470733A2F2F6769706F642E766C61616E646572656E2E62652F6E732F6769706F64236769706F6449647C127A0A2412220A203132323534363263343762333635326565323536333839356465376636363761122A0A280A26687474703A2F2F7777772E77332E6F72672F6E732F61646D7323736368656D614167656E63791A261A240A1B68747470733A2F2F6769706F642E766C61616E646572656E2E626512056E6C2D626588011285010A2412220A20313232353436326334376233363532656532353633383935646537663636376112330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A280A260A24687474703A2F2F7777772E77332E6F72672F6E732F61646D73234964656E74696669657271126F0A2412220A20356634376566346537386131393936653830366631383730363634366639323712310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A141A120A09496E206F706D61616B12056E6C2D6265', '2024-06-26 10:47:03.975000', 'c1fce741-2243-4c62-8707-b734a626cc5a', 'https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810400'); -INSERT INTO members (member_id, subject, old_id, collection_id, is_in_event_source, member_model, timestamp, +INSERT INTO members (member_id, subject, collection_id, is_in_event_source, member_model, timestamp, transaction_id, version_of) VALUES (3, 'https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810400/600002', - 'mobility-hindrances/https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/10810400/600002', 1, true, E'\\xB70112B4010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303032122F0A2D0A2B687474703A2F2F7075726C2E6F72672F64632F656C656D656E74732F312E312F636F6E7472696275746F721A2412220A206531316539313463633762633834663537613961353834383935313366306563B60112B3010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303032122A0A280A26687474703A2F2F7777772E77332E6F72672F6E732F61646D732376657273696F6E4E6F7465731A281A260A1D4D6F62696C69747948696E6472616E63655A6F6E65576173416464656412056E6C2D6265D40112D1010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212250A230A21687474703A2F2F7075726C2E6F72672F64632F7465726D732F6D6F6469666965641A4B1A490A1C323032322D30352D32305430393A35383A31352E383634363433335A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D65DD0112DA010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303032122D0A2B0A29687474703A2F2F7777772E77332E6F72672F6E732F70726F762367656E657261746564417454696D651A4C1A4A0A1D323032342D30362D32375430383A34373A30342E3030333638323230301A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D65C20112BF010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303032123A0A380A3668747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C697465697423496E6E616D652E7374617475731A2412220A206466623239613537393532633132633138393233326630643337396334656161D50112D2010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A3E0A3C0A3A68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974234D6F62696C69746569747368696E646572B90112B6010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212310A2F0A2D68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974237A6F6E651A2412220A203531653366663663353738313564653963656537303336623434623636353038D30112D0010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212240A220A20687474703A2F2F7075726C2E6F72672F64632F7465726D732F637265617465641A4B1A490A1C323032322D30352D32335430393A35383A31352E383631303839365A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D65E00112DD010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212280A260A24687474703A2F2F7075726C2E6F72672F64632F7465726D732F697356657273696F6E4F661A540A520A5068747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F3130383130343030BE0112BB010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212360A340A3268747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974236265686565726465721A2412220A206531316539313463633762633834663537613961353834383935313366306563B00112AD010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212280A260A24687474703A2F2F7777772E77332E6F72672F6E732F61646D73236964656E7469666965721A2412220A203138343037343364343337613931613464353361393561313238303762323337CA0112C7010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212300A2E0A2C68747470733A2F2F6769706F642E766C61616E646572656E2E62652F6E732F6769706F64236769706F6449641A361A340A0831303831303430301A28687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D6123696E7465676572BC0112B9010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212340A320A3068747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C697465697423706572696F64651A2412220A2039633839366666363061663930613636323065396434323161393763333166339101128E010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212260A240A22687474703A2F2F7075726C2E6F72672F64632F7465726D732F737562737472696E671A071A050A012648019E01129B010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F36303030303212280A260A24687474703A2F2F7075726C2E6F72672F64632F7465726D732F6465736372697074696F6E1A121A100A0C6F6D73636872696A76696E674801B30112B0010A5B0A590A5768747470733A2F2F707269766174652D6170692E6769706F642E626574612D766C61616E646572656E2E62652F6170692F76312F6D6F62696C6974792D68696E6472616E6365732F31303831303430302F363030303032122B0A290A27687474703A2F2F7075726C2E6F72672F64632F656C656D656E74732F312E312F63726561746F721A2412220A20653131653931346363376263383466353761396135383438393531336630656397011294010A2412220A20396338393666663630616639306136363230653964343231613937633331663312270A250A23687474703A2F2F646174612E6575726F70612E65752F6D38672F737461727454696D651A431A410A14323032322D30352D32375430373A30303A30305A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D658A011287010A2412220A20396338393666663630616639306136363230653964343231613937633331663312330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A2A0A280A26687474703A2F2F646174612E6575726F70612E65752F6D38672F506572696F644F6654696D6595011292010A2412220A20396338393666663630616639306136363230653964343231613937633331663312250A230A21687474703A2F2F646174612E6575726F70612E65752F6D38672F656E6454696D651A431A410A14323032322D30352D32375431373A30303A30305A1A29687474703A2F2F7777772E77332E6F72672F323030312F584D4C536368656D61236461746554696D6597011294010A2412220A20313834303734336434333761393161346435336139356131323830376232333712300A2E0A2C687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F7265236E6F746174696F6E1A3A1A380A0831303831303430301A2C68747470733A2F2F6769706F642E766C61616E646572656E2E62652F6E732F6769706F64236769706F6449647C127A0A2412220A203138343037343364343337613931613464353361393561313238303762323337122A0A280A26687474703A2F2F7777772E77332E6F72672F6E732F61646D7323736368656D614167656E63791A261A240A1B68747470733A2F2F6769706F642E766C61616E646572656E2E626512056E6C2D626588011285010A2412220A20313834303734336434333761393161346435336139356131323830376232333712330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A280A260A24687474703A2F2F7777772E77332E6F72672F6E732F61646D73234964656E74696669657289011286010A2412220A20653131653931346363376263383466353761396135383438393531336630656312330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A290A270A25687474703A2F2F7777772E77332E6F72672F6E732F6F7267234F7267616E697A6174696F6E7312710A2412220A20653131653931346363376263383466353761396135383438393531336630656312310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A161A140A1047656D65656E7465204265726C61617248017212700A2412220A20646536663564366634613435376562396133666662383136363661643339356312310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A151A130A0A48696E6465725A6F6E6512056E6C2D626571126F0A2412220A20646662323961353739353263313263313839323332663064333739633465616112310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A141A120A09496E206F706D61616B12056E6C2D626587011284010A2412220A20353165336666366335373831356465396365653730333662343462363635303812360A340A3268747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974235A6F6E652E747970651A2412220A2064653666356436663461343537656239613366666238313636366164333935639101128E010A2412220A20353165336666366335373831356465396365653730333662343462363635303812330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A310A2F0A2D68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974235A6F6E657612740A2412220A20353165336666366335373831356465396365653730333662343462363635303812260A240A22687474703A2F2F7777772E77332E6F72672F6E732F6C6F636E2367656F6D657472791A2412220A20396366333433396266356631316239656532623630633534626237343564396284011281010A2412220A20353165336666366335373831356465396365653730333662343462363635303812330A310A2F68747470733A2F2F646174612E766C61616E646572656E2E62652F6E732F6D6F62696C6974656974236765766F6C671A2412220A20363963333161383563356231343566333834303731613233393066373637333480960112FC95010A2412220A203963663334333962663566313162396565326236306335346262373435643962122E0A2C0A2A687474703A2F2F7777772E6F70656E6769732E6E65742F6F6E742F67656F73706172716C236173574B541AA295011A9E95010AE994013C687474703A2F2F7777772E6F70656E6769732E6E65742F6465662F6372732F455053472F392E392E312F33313337303E20504F4C59474F4E2028283132313337352E38333834393431373631203135373732352E30323930363930313833382C203133313337352E33323039313439333632203136373732342E32343835373332383630382C203132313336392E3935323931343933353438203135373731372E363031353733323836322C203132313336392E3531353937363937333239203135373731372E31323637393334323037362C203132313336332E3034363937363936393035203135373731302E39343937393334313936382C203132313336322E38303132303432303131203135373731302E37333031333734393031342C203132313335352E38333932303432303336203135373730342E39303931333734393135342C203132313335352E3831353036393533353838203135373730342E383839303836353738312C203132313335352E3636373837333938333538203135373730342E373637353736313533322C203132313334362E35303336373730343931203135373639372E313838303637343330332C203132313334352E37343035373034373534203135373639362E36363736333637343632382C203132313333342E3738333537303437333134203135373639302E35393536333637343536352C203132313333342E3234343534383433323137203135373639302E33333737343939333131382C203132313332332E3337373534383433333438203135373638352E39313537343939323930362C203132313332332E3132373937333232303437203135373638352E38323138363930343033342C203132313236332E3230353937333232323038203135373636352E30383738363930343239372C203132313236332E31393133363632313639203135373636352E30383238343030333231382C203132313236312E3435373336363231323037203135373636342E34383838343030333136372C203132313236312E3434373933313236373834203135373636342E34383536313834393836342C203132313232312E363835323134333534203135373635302E393533303038383733372C203132313231392E3739333233333631353134203135373635302E323731313532333233312C203132313231392E3639363936343433363436203135373635302E323337353632363433332C203132313230352E3531393635363237303137203135373634352E34353234383337333134372C203132313138362E3039353334333437363533203135373633382E38343434313834393433382C203132313136312E3232323730393539333933203135373633302E333930343238303535312C203132313134322E3833313030323232303739203135373632322E3933303031313039312C203132313132372E3034303939303235393337203135373631342E35393537363337343833372C203132313131392E34363930323831303638203135373631302E353835373432363038392C203132313039352E3835353130383739313139203135373539362E37323035343333353332342C203132313037382E3335323535353639343132203135373538352E35343534323635393835382C203132313036322E38343332323738343937203135373537332E38383836373831333639352C203132313034392E3039313536343136303637203135373536312E37323730373531353738332C203132313032352E3336393033373434383237203135373533382E39383635343833393835332C203132313032342E32343138323730353833203135373533372E393036333436363935312C203132313032322E38333834323735303239203135373533362E35363039323233333730382C203132313031352E3730343033373836373431203135373532392E373139353037363334372C203132303938382E3630323431373431333039203135373530332E37313938373137343537362C203132303935352E3739363337393738313233203135373437322E323635383736353839382C203132303935352E3737303232303035323538203135373437322E32343039373536393438352C203132303931352E3431313637393232323933203135373433342E31303134303936323332382C203132303835342E3439383539333438303237203135373337362E35303832373430343735322C203132303834312E3931333034383636343333203135373336342E36303237303436343230322C203132303834312E38383639393733353037203135373336342E353738323336363638392C203132303833372E3134383136313533353832203135373336302E31353931383733323836322C203132303831302E3236393636323232343639203135373333352E30303733393838383839332C203132303830352E34333530303239333033203135373333302E34373636353533303935332C203132303735342E3132303239363032363936203135373238322E34353931323034353034352C203132303733362E3031373036373835323732203135373236352E35323334353637393831372C203132303733322E3633303839323933313135203135373236322E313035393031313539372C203132303732332E3536333835343038313434203135373235322E393533383939343330392C203132303732322E3034323333303639393931203135373235312E34313133343533383237342C203132303731302E3732303035323035383538203135373233372E39353836383830343931342C203132303730312E36353938373539303734203135373232352E313237333330333331312C203132303639342E35323531373534373331203135373231322E383132323830363638322C203132303639342E31353030353031353738203135373231322E303839393436333338322C203132303636362E3938373738333437333634203135373135392E35393332393633333532352C203132303632382E3830303239373638393537203135373038352E38323633353737303031332C203132303631342E3730363533303136303639203135373035382E363038383036353730342C203132303630382E3634353031383839353834203135373034362E38393037353133383630332C203132303630382E3633353532383136313835203135373034362E38373234393631323836342C203132303539372E3231333634383831373735203135373032352E30313237323730353737372C203132303538332E3135383937323836333934203135363939382E31303733343733383734342C203132303537372E3038393137363230313233203135363938362E34383237333638313037352C203132303534362E3136363735313434383937203135363932372E323934393233353130382C203132303532392E3839323836333630333737203135363839362E313338313338323239362C203132303532362E3437383130383232353532203135363838392E363035363932363138322C203132303532362E3436363638363234333235203135363838392E35383339373233303435362C203132303531352E3334393638363234343536203135363836382E353638393732333037372C203132303530392E3535323431353732333034203135363835372E36313534363039353531362C203132303438372E3634363634383236303237203135363831362E32303839303035303435342C203132303438332E3530323730313031303935203135363830382E33373534353138393039382C203132303437392E3532343432393832353036203135363830302E3737363339343734312C203132303436382E3639313137373038363232203135363738302E30353038323433353530372C203132303436372E38343435333831353436203135363737382E343332363032333335322C203132303436372E3036383739323836373639203135363737362E39343930383934343130372C203132303434352E3634393539303634313631203135363733362E30313137303236323331362C203132303433342E35363631363337303435203135363731342E383132363234303637342C203132303433332E3631343432353638343333203135363731322E39383337333836303933332C203132303433302E3739343234303839333939203135363730362E383832383134363633392C203132303432382E35393537313533393733203135363730302E34393331313730343138362C203132303432362E3939303037353734383533203135363639332E3737363136303030352C203132303432362E3031373933343736323631203135363638362E37383737383536313336352C203132303432352E3732343336393430323135203135363637392E35373731343530383838372C203132303432352E39383436393835333539203135363637342E3634353139353338322C203132303432362E3132303535393934393738203135363637322E31393531333038393030332C203132303432372E3234393735363234393036203135363636342E35393938353033353338372C203132303432382E3330353136323637373136203135363635392E323134313434363131312C203132303433302E3035353238373033373636203135363635302E33333334313239363933342C203132303433312E3538373535343435333336203135363634342E38373936363136353433332C203132303433342E3737343438363238363535203135363633332E35343039303432303934382C203132303433342E3832313536313831313036203135363633332E333630353737383931352C203132303433382E3336383536313830393435203135363631382E36353735373738383938382C203132303433382E3434363534343839313335203135363631382E323636353230353438372C203132303433382E3439333534343838393734203135363631372E393639353230353530332C203132303433382E3439373636373631313732203135363631372E39343330303738363635362C203132303433382E3538323034373330343535203135363631372E333930363135323434312C203132303433392E3430303338313438323136203135363631322E31383332313535363630342C203132303434302E3139373930323931313233203135363630372E30383538393031383736382C203132303434302E3230303038333231333332203135363630372E30373138323337373837342C203132303434302E3335363038333230393039203135363630362E303535383233373736312C203132303434302E34303334373632323138203135363630352E363231323332393433382C203132303434312E3036373437363232363334203135363539352E34303332333239343533332C203132303434312E3037353036393031373734203135363539342E39303738323339323637372C203132303434302E3737393036393031333932203135363538362E32363638323339323738372C203132303434302E3733323339333930373635203135363538352E373335343333313830352C203132303433392E3639323339333930383534203135363537382E343037343333313738392C203132303433392E3537373434333336303631203135363537372E38333738303231303036362C203132303433372E3934353434333336313333203135363537312E36333438303231303237382C203132303433372E3835373533303938343933203135363537312E333338323538363133382C203132303433312E303231353330393832203135363535302E363530323538363132382C203132303433302E3937313537323632343731203135363535302E353036343534373031312C203132303432322E3634333631313130373636203135363532372E36363235363032343436372C203132303431382E3331333634393434393138203135363531352E37383336363534343633362C203132303431382E33303439343131313138203135363531352E37353939363130353432352C203132303431342E36393735363337343835203135363530362E30313636343237343635322C203132303431322E33393531383531383033203135363439392E37383433323439313337352C203132303431302E3930313136353632373233203135363439352E37343239313231333637322C203132303430362E3130353331313430333835203135363438322E33373436313832353030362C203132303339372E3930383838353934343832203135363435392E35343534333237353032352C203132303339372E38383839333430343737203135363435392E34393038363036333639362C203132303338352E3332363933343034383732203135363432352E37343038363036333639362C203132303338332E3933353435303831373336203135363432322E30303535363239303734332C203132303338332E3837363534353738313832203135363432312E383534393331393237362C203132303337362E32373535343537373833203135363430332E33303739333139323932322C203132303337362E3138333634343733333734203135363430332E30393735383139323438372C203132303337302E3635323634343733373937203135363339312E31393035383139323333352C203132303337302E3236333938353438393239203135363339302E353032323138333733392C203132303336342E3333333938353438393539203135363338312E37303532313833373535312C203132303336342E30343432323635363538203135363338312E33313733303938333538342C203132303335372E3134353232363536313837203135363337322E39353833303938333437342C203132303335362E3833333138333733393338203135363337322E363134313337313433352C203132303335322E3535373138333733383834203135363336382E33313731333731343531322C203132303335302E3330313334373231373336203135363336362E303531323936373039332C203132303334392E3834393835303336383733203135363336352E363439353634373539392C203132303334322E30303538353033363435203135363335392E343737353634373631352C203132303334312E3437313135353237313635203135363335392E31313033373834333331362C203132303333332E31383235303031323831203135363335342E313737333434393133322C203132303333322E3732323832353632323834203135363335332E39303133343337363937342C203132303333322E3530333137383530383132203135363335332E373736383935343330312C203132303332332E3830373137383531333235203135363334392E313335383935343237352C203132303332332E3433343937383936343631203135363334382E393536363031333839332C203132303331392E3439393937383936323232203135363334372E32353736303133393230382C203132303331332E3337323037343837363832203135363334342E36313332313131343134362C203132303331322E3834363433353237383734203135363334342E343230353137313531392C203132303330342E3136363433353237393034203135363334312E37373935313731353330322C203132303330332E3731323636353135353835203135363334312E36363433363037303831382C203132303330312E3334353636353134393731203135363334312E31383033363037303730382C203132303330312E3332373730303038323339203135363334312E313736373231353335362C203132303239332E3737323730303038323639203135363333392E363630373231353336372C203132303239332E3337383237393735353938203135363333392E35393738343634393232322C203132303238342E363931323739373537203135363333382E35363638343634393237332C203132303238342E3533323439343231313938203135363333382E353530353637303031372C203132303238312E3435343439343231303337203135363333382E32383435363639393930362C203132303238312E3434323332343230323034203135363333382E32383335333032343339332C203132303236382E3739333332343230353536203135363333372E32323135333032343439352C203132303236382E3338393533383431383632203135363333372E323034303231313336352C203132303235322E3232353533383432313534203135363333372E31353730323131333831322C203132303235322E3039383732323639363932203135363333372E31353832363037373938332C203132303233312E323632373232363934203135363333372E363236323630373738332C203132303233312E3139303738313732363638203135363333372E36323833393437383936372C203132303231332E3337303738313732363338203135363333382E323835333934373931322C203132303231332E3230323238343134383331203135363333382E323934343536333634382C203132303139382E3339373238343134383631203135363333392E33343134353633363331382C203132303139382E3230313830333130333833203135363333392E333539313432383432372C203132303138382E3134373830333130363136203135363334302E343638313432383433382C203132303138382E3131373538303430353531203135363334302E343731353639363135392C203132303138362E33373435383034303438203135363334302E363734353639363133382C203132303138362E3231333434353636393734203135363334302E36393539393635323136322C203132303137312E3639303434353636373833203135363334322E38363739393635323337342C203132303137312E3532393339313734303237203135363334322E38393437373832393336322C203132303136362E3036383339313733373335203135363334332E38393437373832393336322C203132303134312E3433313437333338343935203135363334382E34323634393734323332342C203132303134312E3336343630363237373737203135363334382E34333932363831383030322C203132303131302E3034343630363237373437203135363335342E363432323638313737392C203132303130332E3633393034333239393036203135363335352E39313335373739373235362C203132303039392E3634353434393636303132203135363335362E37303534393733393130392C203132303039392E3432353333313533363538203135363335362E37353433323838383837382C203132303038312E3438373333313533353537203135363336312E31363033323838383832382C203132303038312E3334333436323035393837203135363336312E3139373934333731372C203132303036382E3738303436323035383836203135363336342E363832393433373136342C203132303036382E3639363838353337303938203135363336342E37303639313235353138362C203132303035342E3732303838353337343932203135363336382E38343639313235353234362C203132303035342E3135323738383635363838203135363336392E30353332393733343435372C203132303034382E3233383738383635323335203135363337312E36313632393733343535382C203132303034382E3233333233373037303234203135363337312E36313837303732373334322C203132303033382E3130303233373036383932203135363337362E303234373037323732392C203132303033372E39393838393834373832203135363337362E30373031313536383037352C203132303032322E3836303330373731373338203135363338332E303536333931363030312C203132303030332E3834373533343237303535203135363339312E313834353036373231322C203132303030332E3733333439333934313032203135363339312E32333439353130303833342C203131393939392E33323734393339333738203135363339332E32343939353130303532312C203131393939392E33313532383334303236203135363339332E32353535353531303837372C203131393939362E35373534323130343839203135363339342E35313734393137313535322C203131393939352E3735373031353330353533203135363339342E38393433373630313036332C203131393939342E32383130313431383535203135363339352E35373035383232363530362C203131393939332E3639383235353934313532203135363339352E37383032353538343635362C203131393939332E3537363436393234323736203135363339352E38323538373135323730382C203131393939312E3136343538383135383038203135363339362E37363531393537383938332C203131393938382E3733303333323537303134203135363339372E35353938363132323831362C203131393938382E3539373133373931333034203135363339372E36303534323734303430382C203131393938352E34373336373837333237203135363339382E37323333323739343336352C203131393937392E313336353232393139203135363430302E373937323730393730332C203131393937342E3038383633323838373432203135363430322E31333334343835333230382C203131393937322E3739343635393438343835203135363430322E34373539323333383935372C203131393937302E3034303436393739313232203135363430322E383430313538323437362C203131393937302E3033323934323731373638203135363430322E38343131353935303038322C203131393936362E3533333333323631373838203135363430332E33303933383331393939362C203131393936302E35313530343736313534203135363430332E383036343832393230352C203131393935352E3638323236323638343034203135363430342E30323931323634313635342C203131393934392E3932373739313837363434203135363430332E38383534393438323232332C203131393933362E3334333130323734313234203135363430312E38303430373838323334322C203131393933332E3136373530343937343534203135363430312E30373933333736383533342C203131393933332E3136313636393935323032203135363430312E30373830303936373832382C203131393932352E3339383931353130343236203135363339392E333136313530363536372C203131393931312E3432333939343233373738203135363339362E30333431393933363834342C203131393839372E3039383236363230343231203135363339322E333833373038303234342C203131393838372E3536303836303530343637203135363338392E35333937303138343934362C203131393838322E3834383433363831383431203135363338382E303032363738323934372C203131393837392E3438393430333536383132203135363338362E38383230303532373731382C203131393837392E3436333636313533363331203135363338362E38373334393434363434342C203131393837352E3931393631313339393936203135363338352E373132343132363737352C203131393837302E3037393131393930323437203135363338332E34343431353630393135342C203131393836392E3937383436373038323536203135363338332E343036333036333230352C203131393836302E3138333935313837323734203135363337392E38343238393030383834352C203131393834382E3131363031313238313633203135363337342E39313233373334343336332C203131393832332E3438393836343837343931203135363336342E35373735343437313832322C203131393832332E33383936323335383839203135363336342E353336373436383035382C203131393831372E31373039353132393431203135363336322E30383338373630363137382C203131393831362E3032333635373736383337203135363336312E363331313534383338392C203131393739362E3736333033363038313438203135363335342E30323733303431383939382C203131393739322E3932313639323739393935203135363335322E35313130363030333636332C203131393738342E3636373431343032393537203135363334382E353235333137363336332C203131393737392E3232323837353736313638203135363334332E39323636313635313436382C203131393737382E37313931363636323736203135363334332E32383330353633323735382C203131393737382E3034323239323836363738203135363334322E35373431323930343531382C203131393737372E3234303132303139333636203135363334322E303130383735313231372C203131393737362E33343334373536353432203135363334312E36313439343030383935322C203131393737352E3338363831363739353233203135363334312E34303135333935303938382C203131393737342E3430363930373438303138203135363334312E33373838373432343734332C203131393737332E34343134303530373435203135363334312E35343738313533313534352C203131393737322E3532373431333239343137203135363334312E39303138373034303334342C203131393737312E3730303035363333303735203135363334322E34323734333333373239342C203131393737302E3939313132393034383334203135363334332E313034333037313333382C203131393737302E3432373837353132343835203135363334332E393036343739383036392C203131393737302E3033313934303039323637203135363334342E38303331323433343633362C203131393736392E3831383533393531333036203135363334352E37353937383332303533342C203131393736392E3739353837343235303539203135363334362E37333936393235323033382C203131393736392E39363438313533313836203135363334372E37303531393439323630362C203131393737302E33313838373034303636203135363334382E36313931383637303633382C203131393737302E3834343433333337363131203135363334392E34343635343336363938322C203131393737312E3636353633333337343337203135363335302E34393537343336373139332C203131393737322E3337363634393131323331203135363335312E323333373732323338362C203131393737382E3639373634393131343633203135363335362E35373237373232333634322C203131393737392E3734393834383530313531203135363335372E32353535363230373439352C203131393738382E3733393834383439363134203135363336312E35393635363230373638332C203131393738392E3037383234363438363734203135363336312E37343438303733353530382C203131393739332E3039313130353135343038203135363336332E33323837353135363539352C203131393831322E33353139363339323036203135363337302E39333236393538313039322C203131393831332E3530303732303830373437203135363337312E33383539393435343632332C203131393831392E3637303033343938363234203135363337332E38313933393637303538332C203131393834342E32363831333531323634203135363338342E313432343535323834332C203131393834342E3331313932383237323737203135363338342E31363035393032353330342C203131393835362E3439313932383237323437203135363338392E31333638393032353034362C203131393835362E3637333533323932203135363338392E32303639393336373838382C203131393836362E3530393030323939313134203135363339322E3738353331303030372C203131393837322E3432343838303039383139203135363339352E303832383433393037332C203131393837322E3637383333383436303839203135363339352E31373335303535333339352C203131393837362E3333373435353930333531203135363339362E33373232383530323530352C203131393837392E3639393539363432373437203135363339372E34393339393437323131322C203131393837392E3733313536353432393338203135363339372E35303435343130363235322C203131393838342E3532303536353433333931203135363339392E30363635343130363532332C203131393838342E3634323139373334323031203135363339392E31303435303532393234362C203131393839342E33333731393733343233203135363430312E39393535303532393133362C203131393839342E3533313335313430343334203135363430322E30343931363639353636352C203131393930392E3030303335313430313132203135363430352E37333631363639353536342C203131393930392E3039313837313233353735203135363430352E37353835373139343238362C203131393932332E3133303837313233323833203135363430392E30353535373139343439382C203131393932332E3136373333303034343136203135363430392E30363339393033323236342C203131393933302E3934353431323132353531203135363431302E383239333238303630392C203131393933342E3239343439353032323936203135363431312E35393336363233313530382C203131393933342E36343937343830303936203135363431312E36363133323432393434332C203131393934382E3732373734383031313231203135363431332E38313833323432393232322C203131393934392E3336303233383835333937203135363431332E383734343433323231362C203131393935352E3631303233383835333937203135363431342E30333034343332323438322C203131393935352E39363531303239333835203135363431342E30323637303234353838352C203131393936312E3036363130323934323032203135363431332E37393137303234353537322C203131393936312E3234373538393533373537203135363431332E37383030333036303738362C203131393936372E3438323538393533363937203135363431332E3236353033303631312C203131393936372E3733343035373238363937203135363431332E323337383430343939312C203131393937312E33353532393431323632203135363431322E37353333343339383039332C203131393937342E3432313533303231333733203135363431322E333437383431373439372C203131393937352E30343532393639343031203135363431322E32323435373030343033362C203131393937362E3634373239363933383139203135363431312E38303035373030343136342C203131393938312E3833343433373138383337203135363431302E34323735333239313936322C203131393938322E3131303137313433333335203135363431302E33343539393334353731362C203131393938382E3634393137313433303433203135363430382E32303539393334353635362C203131393938382E3737383836323038313534203135363430382E31363135373235393638342C203131393939312E3930303538353531303634203135363430372E303434323933323930372C203131393939342E3430303636373432373132203135363430362E32323831333837373433342C203131393939342E3636333533303735393332203135363430362E31333431323834373338322C203131393939372E3134343933343035323337203135363430352E31363737323832393139372C203131393939372E38363437343430353935203135363430342E39303837343431353237352C203131393939382E3235343532343631313432203135363430342E37343936363733303336342C203131393939392E3932363532343630393831203135363430332E39383336363733303437342C203131393939392E3933353434303736303431203135363430332E39373935373139323430352C203132303030302E3735383434303736363739203135363430332E363030353731393233342C203132303030332E3439323631353039363331203135363430322E333431323535313339342C203132303030372E3833353830303433373334203135363430302E33353439383232323932342C203132303032362E3835363436353733333039203135363339322E323233343933323738362C203132303032362E3938363130313532313231203135363339322E31363538383433313639362C203132303034322E3133383638343335383137203135363338352E31373331353132323432372C203132303035322E3231373938373838313834203135363338302E37393034393933363235372C203132303035372E3835313431313631313437203135363337382E33343930393530363533382C203132303037312E3439353433303438353139203135363337342E33303734333532303833382C203132303038332E3934343838323930393638203135363337302E383533393333353231382C203132303130312E37303131363030343335203135363336362E343932353638393836332C203132303130352E3538343535303334343035203135363336352E373232353032363038332C203132303131312E3938383337383434303032203135363336342E34353135333637393432382C203132303134332E3237343030333634343632203135363335382E32353533343438303539322C203132303136372E38373135363735383139203135363335332E37333038363239323332362C203132303137332E3235303239393935313534203135363335322E373435393237343936332C203132303138372E3631323136313133393439203135363335302E353938303236373530382C203132303138392E3235393331333436303737203135363335302E34303631383937333535342C203132303139392E32303036323939383137203135363334392E33303936313932313238342C203132303231332E3832333534333532353936203135363334382E32373534393632353034382C203132303233312E3532333235353437303931203135363334372E36323239333131313136332C203132303235322E3235393837373330373131203135363334372E31353731363332353835352C203132303236382E3135383231343536393932203135363334372E32303333393037393034372C203132303238302E3539393539303135363032203135363334382E323437393538383038382C203132303238332E3539313938333036393936203135363334382E35303635363036363739372C203132303239322E3030313235333435363238203135363334392E35303435393838353839342C203132303239392E33353133313430343833203135363335302E39373934373533343436382C203132303330312E3437393735313238303935203135363335312E34313436393434343931372C203132303330392E3636373334323530323931203135363335332E393035383732383337332C203132303331352E3533363437333035343332203135363335362E34333835393337373633372C203132303331392E32383132313434383536203135363335382E303535343436353533342C203132303332372E3638333432363536323336203135363336322E353339363533383038382C203132303332382E3034333137343337323333203135363336322E37353536353632333137382C203132303332382E3035393834343732343132203135363336322E37363536323135363838362C203132303333362E3037373536333538393132203135363336372E353337343036303431372C203132303334332E34323832333936363037203135363337332E33323132333733333636342C203132303334352E3436393233343530323734203135363337352E33373132383331353834392C203132303334392E3538303739313538313637203135363337392E35303330333236333434372C203132303335362E3137373439323030393334203135363338372E34393537353839343939382C203132303336312E3735303339313638363531203135363339352E37363330303939353339352C203132303336372E3036353938393831343734203135363430372E323036323938313432322C203132303337342E3539323738333339363032203135363432352E353732323239303033332C203132303337352E3935353330373438383638203135363432392E32323937383832383030332C203132303338382E3530363933313435383637203135363436322E393531393131323731372C203132303339362E3639323930313233303731203135363438352E37353139373434383337352C203132303430312E3439363638383539343234203135363439392E31343233383137353038362C203132303430312E3531333139383836393734203135363439392E31383737313433313939372C203132303430332E3031353030363739353432203135363530332E32353031393437353736322C203132303430352E3331373831343831393232203135363530392E34383336373530383534372C203132303430382E3932323637343738323038203135363531392E32323031393737343435352C203132303431332E3234383335303534393831203135363533312E30383733333435353239382C203132303432312E3535303335333436353436203135363535332E38363030323336353737362C203132303432382E3331333932343538323135203135363537342E33323838323938363135372C203132303432392E3833323530323332333239203135363538302E31303037323739373939372C203132303433302E3739343037353136303635203135363538362E38373631313831333335342C203132303433312E3037323433393334333134203135363539352E30303232383332333334352C203132303433302E3433383731313734323139203135363630342E37353434333437313135362C203132303433302E3331363939363932383837203135363630352E35343731343134363739382C203132303432392E3532313335373234393832203135363631302E36333234343730333039322C203132303432382E3730313631383532333338203135363631352E38343837383434333534382C203132303432382E36393833333233393036203135363631352E38363939393231333434352C203132303432382E3631343335383138303031203135363631362E343139373330323632392C203132303432382E3630303634333630313937203135363631362E35303633393437323636332C203132303432352E3132323239353239363538203135363633302E393234383230323032352C203132303432312E3936303531333731323835203135363634322E31373430393537393033372C203132303432302E3337343337373337383538203135363634372E38313935383039363234342C203132303432302E3238323335313830383837203135363634382E32303532343436393538362C203132303431382E3439333335313830343334203135363635372E32383332343436393734362C203132303431382E3439323332353630323038203135363635372E32383834363636343738352C203132303431372E3431343332353630373933203135363636322E37383934363636343631352C203132303431372E3337353335383034303932203135363636332E30313537323735333838322C203132303431362E3139353335383034313232203135363637302E39353237323735343135332C203132303431362E3134383636393637393536203135363637312E34313131363434303831342C203132303431352E3939393636393637353633203135363637342E30393831363434303731332C203132303431352E3939383935303931323733203135363637342E3131313434353738332C203132303431352E3732353935303931303833203135363637392E323833343435373831342C203132303431352E3732333133383638323536203135363637392E37353033393534393733372C203132303431362E3033363133383638333537203135363638372E34333833393534393833382C203132303431362E30373936383638313633203135363638372E39323339303739343132372C203132303431372E3131383638363832303833203135363639352E33393239303739343137372C203132303431372E3230383030393037303433203135363639352E38363634363235353638352C203132303431382E3932363030393036353138203135363730332E30353334363235353538342C203132303431392E3036313033373337323336203135363730332E35313737363635353232382C203132303432312E3432313033373337313737203135363731302E33373637363635353333382C203132303432312E3631303434313835323734203135363731302E38343739373238323533342C203132303432342E3538363434313835363236203135363731372E32383539373238323633362C203132303432342E3638393632383532393833203135363731372E34393631333334323930332C203132303432352E3639373632383533313134203135363731392E3433333133333432382C203132303432352E3730323035323137353838203135363731392E343431363134323033362C203132303433362E3738383035323137313335203135363734302E363435363134323033352C203132303435382E3230373438363835393839203135363738312E353833343435353132392C203132303435382E3938333230373132353933203135363738332E30363639313035353738332C203132303435392E3832393236393632353238203135363738342E363834303330323733362C203132303437302E3636323832323930383437203135363830352E34313031373536343431322C203132303437342E3634383331383335343034203135363831332E30323330333433383937342C203132303437342E36353833323034353036203135363831332E30343230343033343733382C203132303437382E3830373332303434373039203135363832302E38383530343033343538362C203132303530302E3731333338323937353738203135363836322E32393231353835333736362C203132303530362E3531303534393633383833203135363837332E323435343733353938322C203132303531372E3632313537363131313439203135363839342E323439313831353531342C203132303532312E3032393531333937313233203135363930302E37363835383436333936382C203132303533372E3330333133363339383535203135363933312E393234383631373731342C203132303536382E3232353039323232383233203135363939312E313131373737323738392C203132303537342E3239343832333739343635203135373030322E37333632363331383630332C203132303538382E3335303233303533333935203135373032392E36343330343139393234342C203132303539392E3736373730373639383839203135373035312E34393433383630303933322C203132303630352E3832343938313131303432203135373036332E323034323438363136352C203132303631392E3931393833303633353139203135373039302E343233383930313837372C203132303635382E3130363435393337303438203135373136342E31383931373330313438332C203132303638352E3237303231363532373637203135373231362E36383837303336363235342C203132303638352E3237333638383232313332203135373231362E36393534303130333838332C203132303638352E3730333638383232313032203135373231372E35323334303130343034342C203132303638352E38313436323034393831203135373231372E37323534373936373938322C203132303639332E31313936323034393738203135373233302E33333434373936383039332C203132303639332E3336313537323731373937203135373233302E37313139393936313330342C203132303730322E3637333537323731363936203135373234332E38393939393936313033322C203132303730322E3933323536343939323732203135373234342E32333536333436303437332C203132303731342E3531383536343938383139203135373235382E30303136333436303733352C203132303731342E3738343238333337323439203135373235382E32393331383436333834362C203132303731362E3434383238333337373032203135373235392E39383031383436333734352C203132303731362E3435363031373036393732203135373235392E39383830303739393333352C203132303732352E3532373031373037323035203135373236392E31343430303739393238342C203132303732382E3938303139363939343935203135373237322E36323931383935393737332C203132303732392E3131363137323837353037203135373237322E37363133313832363337372C203132303734372E3238373933383438313935203135373238392E37363130393839383233332C203132303739382E3539383335303034383333203135373333372E37373436313236313334332C203132303830332E3433323939373037303431203135373334322E3330353334343639322C203132303833302E3331383637393338353337203135373336372E34363338353635333931372C203132303833302E33323530303236343638203135373336372E34363937363333333135322C203132303833352E3035333933333236353237203135373337312E38373935373538393835382C203132303834372E3632363935313333343738203135373338332E37373332393533353632382C203132303930382E3534313836313737373732203135373434312E33363831353633393636372C203132303934382E3838383635353132303632203135373437392E34393636323130393630342C203132303938312E3638303130313333383938203135373531302E393336363235393131342C203132313030382E3738313538323539303235203135373533362E39333631323832353734352C203132313031352E39313733343138333239203135373534332E37373838353634373731382C203132313031372E3332313830333232363832203135373534352E31323532393838363531372C203132313031382E3434393235323539303137203135373534362E32303537323936333138322C203132313034322E3234333936323535373232203135373536392E303135343531363031382C203132313034322E33393136333934373038203135373536392E313531343332393131382C203132313035362E3336373633393436363837203135373538312E353131343332393131322C203132313035362E3637353931383938323933203135373538312E37363239333539383039352C203132313037322E3439363931383938353236203135373539332E36353339333539383335372C203132313037322E3831303236323539313435203135373539332E38373132353334353730342C203132313039302E3535323236323539303134203135373630352E31393932353334353439322C203132313039302E3731313333373831353332203135373630352E32393636393138343538372C203132313131342E35303033333738313234203135373631392E32363436393138343830382C203132313131342E3639313935323739313234203135373631392E33373136313733323733332C203132313132322E3336333935323739373038203135373632332E34333436313733323436322C203132313132322E3337303036383933353735203135373632332E34333738353039343238342C203132313133382E33383530363839323839203135373633312E38393038353039343434342C203132313133382E38333935333939333236203135373633322E31303233313733373232322C203132313135372E3539373533393933333931203135373633392E37313133313733373333322C203132313135372E383637393437383832203135373633392E38313230323036323736342C203132313138322E3837353330323139363538203135373634382E33313138303131363433382C203132313230322E3330343635363532313938203135373635342E39323135383135303832342C203132313230322E3331363033353536303038203135373635342E393235343337333539322C203132313231362E3435303732393731383436203135373635392E363936313333333239382C203132313231382E3333363736363338303039203135373636302E33373538343736373637372C203132313231382E3432313036383732373435203135373636302E34303533383135303032362C203132313235382E3232313334393634333331203135373637332E393530373735343337312C203132313235392E3934333332363430333636203135373637342E35343036353637343833322C203132313331392E3733313938373036393239203135373639352E32323835313931333830342C203132313333302E3139383232313930393531203135373639392E343837343339373638352C203132313334302E3438373733373534373131203135373730352E31383935343234333735382C203132313334392E3239363332323935353337203135373731322E343734393332353732322C203132313334392E3433363833313637323632203135373731322E35393039323538333139362C203132313335362E3236303238373233303136203135373731382E323936303837333935352C203132313336322E3337363230343738373136203135373732342E313335393432353039332C203132313336372E3234353538363738343433203135373733302E31363535323138393238362C203132313337312E3131363530353832323131203135373733372E333931393330393831372C203132313337312E3636313738393337323337203135373733382E32303634323538313236382C203132313337322E3335353439353531303937203135373733382E38393838393038313034342C203132313337332E3137303936353530303033203135373733392E34343237313439333334352C203132313337342E3037363836313238353138203135373733392E38313639393933323536372C203132313337352E3033383336393739393435203135373734302E30303733363034343738342C203132313337362E3031383534303830393836203135373734302E30303634383238323837332C203132313337362E3937393730363839343134203135373733392E38313434303031393437372C203132313337372E3838343933303937383732203135373733392E34333834393431373338372C203132313337382E3639393432353830393637203135373733382E38393332313036323336322C203132313337392E3339313839303830373431203135373733382E3139393530343438352C203132313337392E3933353731343933303434203135373733372E33383430333434393539352C203132313338302E3330393939393332323636203135373733362E34373831333837313037382C203132313338302E3530303336303434343831203135373733352E353136363330313936352C203132313338302E34393934383238323537203135373733342E353336343539313836312C203132313338302E3330373430303139313736203135373733332E35373532393331303138342C203132313337392E3933313439343137303836203135373733322E36373030363930313732372C203132313337352E38333834393431373631203135373732352E303239303639303138333829291A2F687474703A2F2F7777772E6F70656E6769732E6E65742F6F6E742F67656F73706172716C23776B744C69746572616C86011283010A2412220A20396366333433396266356631316239656532623630633534626237343564396212330A310A2F687474703A2F2F7777772E77332E6F72672F313939392F30322F32322D7264662D73796E7461782D6E7323747970651A260A240A22687474703A2F2F7777772E77332E6F72672F6E732F6C6F636E2347656F6D657472798B011288010A2412220A20363963333161383563356231343566333834303731613233393066373637333412310A2F0A2D687474703A2F2F7777772E77332E6F72672F323030342F30322F736B6F732F636F726523707265664C6162656C1A2D1A2B0A2242657065726B746520646F6F7267616E6720766F6F7220766F657467616E6765727312056E6C2D6265', '2024-06-27 08:47:04.004000', '9f3a0219-e12d-4891-859f-6c9c5f967d48', diff --git a/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/members/member.ttl b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/members/member.ttl new file mode 100644 index 0000000000..0751418e2c --- /dev/null +++ b/ldes-server-infra-postgres/postgres-fragmentation-repository/src/test/resources/members/member.ttl @@ -0,0 +1,9 @@ +@prefix dc: . +@prefix prov: . +@prefix xsd: . +@prefix rdf: . + + + dc:isVersionOf ; + rdf:type ; + dc:created "2023-04-06T09:58:15.867Z"^^xsd:dateTime . \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/pom.xml b/ldes-server-infra-postgres/postgres-ingest-repository/pom.xml index 27160d7f89..197593f17a 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/pom.xml +++ b/ldes-server-infra-postgres/postgres-ingest-repository/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server-infra-postgres - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT postgres-ingest-repository @@ -14,7 +14,7 @@ be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-ingest + ldes-server-ingest-common ${project.version} @@ -22,17 +22,6 @@ postgres-admin-repository ${project.version} - - be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-common - ${project.version} - compile - - - be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-fetch - ${project.version} - be.vlaanderen.informatievlaanderen.vsds diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/MemberPostgresRepository.java b/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/MemberPostgresRepository.java index af3e9f00ce..11d39efa2c 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/MemberPostgresRepository.java +++ b/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/MemberPostgresRepository.java @@ -1,31 +1,31 @@ package be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.repository.TreeMemberRepository; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.entities.IngestedMember; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.mapper.MemberEntityMapper; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.mapper.MemberRowMapper; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.repository.MemberEntityRepository; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.repositories.MemberRepository; +import org.springframework.dao.DuplicateKeyException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import javax.sql.DataSource; import java.util.List; -import java.util.stream.Collectors; import java.util.stream.Stream; @Repository -public class MemberPostgresRepository implements MemberRepository, TreeMemberRepository { +public class MemberPostgresRepository implements MemberRepository { + private static final String INSERT_SQL = "INSERT INTO members (subject, collection_id, version_of, timestamp, transaction_id, member_model) VALUES (?,?,?,?,?,?)"; private final MemberEntityRepository repository; private final MemberEntityMapper mapper; private final DatabaseColumnModelConverter modelConverter; private final JdbcTemplate jdbcTemplate; public MemberPostgresRepository(MemberEntityRepository repository, - MemberEntityMapper mapper, DatabaseColumnModelConverter modelConverter, DataSource dataSource) { + MemberEntityMapper mapper, + DatabaseColumnModelConverter modelConverter, + DataSource dataSource) { this.repository = repository; this.mapper = mapper; this.modelConverter = modelConverter; @@ -34,13 +34,15 @@ public MemberPostgresRepository(MemberEntityRepository repository, @Override @Transactional - public List insertAll(List members) { + public int insertAll(List members) { final int collectionId = getCollectionId(members.getFirst().getCollectionName()); - final List subjects = members.stream().map(IngestedMember::getSubject).toList(); - if (!membersContainDuplicateIds(members) && !membersExistInCollection(collectionId, subjects)) { - String sql = "INSERT INTO members (subject, collection_id, version_of, timestamp, transaction_id, member_model, old_id) VALUES (?,?,?,?,?,?,?)"; - final List batchArgs = members.stream() + if (membersContainDuplicateIds(members)) { + return 0; + } + + try { + var batchArgs = members.stream() .map(member -> new Object[]{ member.getSubject(), collectionId, @@ -48,35 +50,36 @@ public List insertAll(List members) { member.getTimestamp(), member.getTransactionId(), modelConverter.convertToDatabaseColumn(member.getModel()), - member.getCollectionName() + "/" + member.getSubject() }) .toList(); - jdbcTemplate.batchUpdate(sql, batchArgs); + jdbcTemplate.batchUpdate(INSERT_SQL, batchArgs); - return members; - } else { - return List.of(); + updateCollectionStats(members.size(), collectionId); + + return members.size(); + } catch (DuplicateKeyException e) { + return 0; } } - protected boolean membersExistInCollection(int collectionId, List subjects) { - return repository.existsByCollectionAndSubjectIn(collectionId, subjects); + private void updateCollectionStats(int memberCount, int collectionId) { + String sql = """ + update collection_stats cs set + ingested_count = cs.ingested_count + ? + where collection_id = ?; + """; + + jdbcTemplate.update(sql, ps -> { + ps.setInt(1, memberCount); + ps.setInt(2, collectionId); + }); } protected boolean membersContainDuplicateIds(List members) { - return members.stream() - .map(IngestedMember::getSubject) - .collect(Collectors.toSet()) - .size() != members.size(); + return members.size() != members.stream().map(IngestedMember::getSubject).distinct().count(); } - @Override - public Stream findAllByIds(List memberIds) { - return repository.findAllByOldIdIn(memberIds) - .stream() - .map(mapper::toMember); - } @Override public Stream findAllByCollectionAndSubject(String collectionName, List subjects) { @@ -91,23 +94,6 @@ public void deleteMembersByCollectionNameAndSubjects(String collectionName, List repository.deleteAllByCollectionNameAndSubjectIn(collectionName, subjects); } - @Override - @Transactional - public void removeFromEventSource(List ids) { - jdbcTemplate.update("UPDATE members SET is_in_event_source = false WHERE member_id IN ?", ids); - } - - @Override - public Stream findAllByTreeNodeUrl(String url) { - final String sql = """ - SELECT m.subject, m.member_model - FROM members m - JOIN page_members USING (member_id) - JOIN pages p USING (page_id) - WHERE p.partial_url = ?"""; - return jdbcTemplate.query(sql, new MemberRowMapper(), url).stream(); - } - private int getCollectionId(String collectionName) { final Integer collectionId = jdbcTemplate.queryForObject("SELECT collection_id FROM collections WHERE name = ?", Integer.class, collectionName); if (collectionId == null) { diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/PostgresIngestMemberConstants.java b/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/PostgresIngestMemberConstants.java index eb4751f06b..5d779aa9f9 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/PostgresIngestMemberConstants.java +++ b/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/PostgresIngestMemberConstants.java @@ -6,5 +6,4 @@ public class PostgresIngestMemberConstants { private PostgresIngestMemberConstants() { } public static final Lang SERIALISATION_LANG = Lang.RDFPROTO; - public static final String LDES_SERVER_DELETED_MEMBERS_COUNT = "ldes_server_deleted_members_count"; } diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/entity/MemberEntity.java b/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/entity/MemberEntity.java index 038962c80c..64fc19b813 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/entity/MemberEntity.java +++ b/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/entity/MemberEntity.java @@ -12,7 +12,6 @@ @Entity @Table(name = "members", indexes = { @Index(columnList = "member_id, timestamp"), - @Index(columnList = "old_id"), @Index(columnList = "subject, collection_id", unique = true) }) public class MemberEntity { @@ -20,8 +19,6 @@ public class MemberEntity { @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "member_id", columnDefinition = "BIGINT", nullable = false) private long id; - @Column(name = "old_id", nullable = false) - private String oldId; @Column(name = "subject", nullable = false) private String subject; @ManyToOne(fetch = FetchType.EAGER) @@ -61,9 +58,7 @@ protected MemberEntity() { public long getId() { return id; } - public String getOldId() { - return oldId; - } + public String getSubject() { return subject; diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/projection/TreeMemberProjection.java b/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/projection/TreeMemberProjection.java deleted file mode 100644 index 8dffc1d014..0000000000 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/projection/TreeMemberProjection.java +++ /dev/null @@ -1,12 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.projection; - -import org.apache.jena.rdf.model.Model; - -import java.time.LocalDateTime; - -public interface TreeMemberProjection { - String getSubject(); - Model getModel(); - String getVersionOf(); - LocalDateTime getTimestamp(); -} diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/repository/MemberEntityRepository.java b/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/repository/MemberEntityRepository.java index 4dc0abf600..83fe1a5bea 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/repository/MemberEntityRepository.java +++ b/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/repository/MemberEntityRepository.java @@ -9,12 +9,11 @@ public interface MemberEntityRepository extends JpaRepository { @Query(value = """ - select count(*) - from members m - INNER JOIN public.collections c on c.collection_id = m.collection_id - WHERE c.name = :collectionName - LIMIT 1 - """, nativeQuery = true) + SELECT cs.ingested_count + FROM collection_stats cs + INNER JOIN collections c on c.collection_id = cs.collection_id + WHERE c.name = :collectionName + """, nativeQuery = true) int countMemberEntitiesByColl(String collectionName); @Query(value = "SELECT CASE WHEN COUNT(*) > 0 THEN true ELSE false END " + @@ -24,8 +23,6 @@ select count(*) nativeQuery = true) boolean existsByCollectionAndSubjectIn(int collectionId, List subjects); - List findAllByOldIdIn(List oldIds); - List findAllByCollectionNameAndSubjectIn(String collectionName, List subjects); void deleteAllByCollectionNameAndSubjectIn(String collectionName, List subjects); diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberRepositorySteps.java b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberRepositorySteps.java index 2a24354548..5ad926723d 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberRepositorySteps.java +++ b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberRepositorySteps.java @@ -1,9 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.server.ingest; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.entities.IngestedMember; -import io.cucumber.datatable.DataTable; import io.cucumber.java.DataTableType; -import io.cucumber.java.Transpose; import io.cucumber.java.en.And; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; @@ -27,12 +25,11 @@ public class MemberRepositorySteps extends PostgresIngestIntegrationTest { @When("I save the members using the MemberRepository") public void iSaveTheMembers(List members) { - List actualIngestedMembers = members.stream() + members.stream() .collect(Collectors.groupingBy(IngestedMember::getCollectionName)) .values().stream() - .flatMap(groupedMembers -> memberRepository.insertAll(groupedMembers).stream()) - .toList(); - this.members.addAll(actualIngestedMembers); + .filter(groupedMembers -> memberRepository.insertAll(groupedMembers) != 0) + .forEach(this.members::addAll); } @DataTableType(replaceWithEmptyString = "[blank]") @@ -77,11 +74,6 @@ public List memberIdTransformer(Map row) { return row.values().stream().toList(); } - @When("I try to retrieve the following members by Id") - public void iTryToRetrieveTheFollowingMembersByIdMemberIds(@Transpose DataTable table) { - members = memberRepository.findAllByIds(table.column(0).stream().toList()).toList(); - } - @Then("I expect a list of {int} members") public void iExpectAListOfMembers(int memberCount) { assertEquals(memberCount, members.size()); diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/PostgresIngestIntegrationTest.java b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/PostgresIngestIntegrationTest.java index 4aa383250b..30d28f9f5d 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/PostgresIngestIntegrationTest.java +++ b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/PostgresIngestIntegrationTest.java @@ -2,7 +2,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.admin.domain.eventstream.repository.EventStreamRepository; import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.eventstream.repository.EventStreamEntityRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.ServerMetrics; +import be.vlaanderen.informatievlaanderen.ldes.server.ingest.metrics.IngestionMetricsService; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.MemberPostgresRepository; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.repository.MemberEntityRepository; import io.cucumber.spring.CucumberContextConfiguration; @@ -21,7 +21,7 @@ @CucumberContextConfiguration @EnableAutoConfiguration @DataJpaTest -@AutoConfigureEmbeddedDatabase +@AutoConfigureEmbeddedDatabase(type = AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES) @ActiveProfiles("postgres-test") @EntityScan(basePackages = {"be.vlaanderen.informatievlaanderen.ldes.server"}) @ComponentScan(basePackages = {"be.vlaanderen.informatievlaanderen.ldes.server.ingest", @@ -39,5 +39,5 @@ public class PostgresIngestIntegrationTest { @Autowired EventStreamRepository eventStreamRepository; @MockBean - ServerMetrics serverMetrics; + IngestionMetricsService metricsService; } diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/FragmentationMemberRowMapperTest.java b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/FragmentationMemberRowMapperTest.java deleted file mode 100644 index 6811ee4d71..0000000000 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/FragmentationMemberRowMapperTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.mapper; - -import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.FragmentationMember; -import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.valueobjects.EventStreamProperties; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.PostgresIngestMemberConstants; -import org.apache.jena.rdf.model.Model; -import org.apache.jena.riot.RDFParser; -import org.apache.jena.riot.RDFWriter; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.io.ByteArrayOutputStream; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.time.LocalDateTime; - -import static be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.mapper.FragmentationMemberRowMapper.*; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -class FragmentationMemberRowMapperTest { - public static final long MEMBER_ID = 123L; - public static final String SUBJECT = "http://mob-hind/1/be-vla/123"; - public static final String VERSION_OF = "http://mob-hind/1/be-vla"; - public static final LocalDateTime TIMESTAMP = LocalDateTime.now(); - public static final String EVENT_STREAM_NAME = "mobility-hindrances"; - public static final String TIMESTAMP_PATH = "http://purl.org/dc/terms/created"; - public static final String VERSION_OF_PATH = "http://purl.org/dc/terms/isVersionOf"; - public static final boolean VERSION_CREATION_ENABLED = false; - private static Model memberModel; - private static FragmentationMember fragmentationMember; - private final FragmentationMemberRowMapper rowMapper = new FragmentationMemberRowMapper(); - @Mock - private ResultSet resultSet; - - @BeforeAll - static void beforeAll() { - memberModel = RDFParser.source("members/member.ttl").toModel(); - fragmentationMember = new FragmentationMember( - MEMBER_ID, - SUBJECT, - VERSION_OF, - TIMESTAMP, - new EventStreamProperties(EVENT_STREAM_NAME, VERSION_OF_PATH, TIMESTAMP_PATH, VERSION_CREATION_ENABLED), - memberModel - ); - } - - - @Test - void test_MapRow() throws SQLException { - when(resultSet.getLong(MEMBER_ID_COLUMN_KEY)).thenReturn(MEMBER_ID); - when(resultSet.getString(SUBJECT_COLUMN_KEY)).thenReturn(SUBJECT); - when(resultSet.getString(VERSION_OF_COLUMN_KEY)).thenReturn(VERSION_OF); - when(resultSet.getObject(TIMESTAMP_COLUMN_KEY, LocalDateTime.class)).thenReturn(TIMESTAMP); - when(resultSet.getString(EVENT_STREAM_NAME_COLUMN_KEY)).thenReturn(EVENT_STREAM_NAME); - when(resultSet.getString(TIMESTAMP_PATH_COLUMN_KEY)).thenReturn(TIMESTAMP_PATH); - when(resultSet.getString(VERSION_OF_PATH_COLUMN_KEY)).thenReturn(VERSION_OF_PATH); - when(resultSet.getBoolean(CREATE_VERSIONS_COLUMN_KEY)).thenReturn(VERSION_CREATION_ENABLED); - when(resultSet.getBytes(MEMBER_MODEL_COLUMN_KEY)).thenReturn(mapModelToByteArray()); - - final FragmentationMember result = rowMapper.mapRow(resultSet, 1); - - assertThat(result) - .isNotNull() - .matches(actual -> actual.getVersionModel().isIsomorphicWith(memberModel)) - .usingRecursiveComparison() - .ignoringFields("model") - .isEqualTo(fragmentationMember); - } - - private byte[] mapModelToByteArray() { - final ByteArrayOutputStream output = new ByteArrayOutputStream(); - RDFWriter.source(memberModel).lang(PostgresIngestMemberConstants.SERIALISATION_LANG).output(output); - return output.toByteArray(); - } -} \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/MemberRowMapperTest.java b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/MemberRowMapperTest.java deleted file mode 100644 index da93b081d3..0000000000 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/mapper/MemberRowMapperTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.mapper; - -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.PostgresIngestMemberConstants; -import org.apache.jena.rdf.model.Model; -import org.apache.jena.riot.RDFParser; -import org.apache.jena.riot.RDFWriter; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.io.ByteArrayOutputStream; -import java.sql.ResultSet; -import java.sql.SQLException; - -import static be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.mapper.MemberRowMapper.MEMBER_MODEL_KEY; -import static be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.mapper.MemberRowMapper.SUBJECT_KEY; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -class MemberRowMapperTest { - private static Model memberModel; - private final MemberRowMapper memberRowMapper = new MemberRowMapper(); - @Mock - private ResultSet resultSet; - - @BeforeAll - static void beforeAll() { - memberModel = RDFParser.source("members/member.ttl").toModel(); - } - - @Test - void given_ValidAndCompleteResultSet_test_MapRow() throws SQLException { - final String subject = "http://mob-hind/1/0"; - when(resultSet.getString(SUBJECT_KEY)).thenReturn(subject); - when(resultSet.getBytes(MEMBER_MODEL_KEY)).thenReturn(readMemberModel()); - - final Member result = memberRowMapper.mapRow(resultSet, 1); - - assertThat(result) - .isNotNull() - .satisfies(actual -> assertThat(actual.subject()).isEqualTo(subject)) - .satisfies(actual -> assertThat(actual.model()).matches(memberModel::isIsomorphicWith)); - } - - private byte[] readMemberModel() { - final ByteArrayOutputStream output = new ByteArrayOutputStream(); - RDFWriter - .source(memberModel) - .lang(PostgresIngestMemberConstants.SERIALISATION_LANG) - .output(output); - return output.toByteArray(); - } - - -} \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/application-postgres-test.yml b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/application-postgres-test.yml index 726be1ba56..b64611b749 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/application-postgres-test.yml +++ b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/application-postgres-test.yml @@ -2,4 +2,11 @@ spring: liquibase: change-log: classpath:/db/changelog/master.xml main: - allow-bean-definition-overriding: true \ No newline at end of file + allow-bean-definition-overriding: true + +zonky: + test: + database: + postgres: + docker: + image: postgres:14-alpine \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/ingest/init-collections.sql b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/ingest/init-collections.sql index a727a4e0fc..4293564f74 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/ingest/init-collections.sql +++ b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/ingest/init-collections.sql @@ -1,4 +1,4 @@ -insert into collections (name, timestamp_path, version_of_path, create_versions, is_closed) -values ('mobility-hindrances', '', '', 'false', 'false'), - ('gipod', '', '', 'false', 'false'), - ('other', '', '', 'false', 'false'); \ No newline at end of file +insert into collections (name, timestamp_path, version_of_path, version_delimiter, is_closed) +values ('mobility-hindrances', '', '', NULL, 'false'), + ('gipod', '', '', NULL, 'false'), + ('other', '', '', NULL, 'false'); \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/features/member.feature b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/features/member.feature index 222ec590d6..13409e0d8f 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/features/member.feature +++ b/ldes-server-infra-postgres/postgres-ingest-repository/src/test/resources/features/member.feature @@ -55,4 +55,6 @@ Feature: MemberRepository And I save the members using the MemberRepository | subject | collectionName | versionOf | timestamp | | http://test-data/mobility-hindrance/1/1 | mobility-hindrances | http://test-data/mobility-hindrance/2 | 2022-08-12T18:35:00 | + | http://test-data/mobility-hindrance/1/2 | mobility-hindrances | http://test-data/mobility-hindrance/3 | 2022-08-12T18:35:00 | Then The member with collection "mobility-hindrances" and subject "http://test-data/mobility-hindrance/1/1" will exist + Then The member with collection "mobility-hindrances" and subject "http://test-data/mobility-hindrance/1/2" will not exist diff --git a/ldes-server-infra-postgres/postgres-liquibase/pom.xml b/ldes-server-infra-postgres/postgres-liquibase/pom.xml index f890b5ed85..587cae58f8 100644 --- a/ldes-server-infra-postgres/postgres-liquibase/pom.xml +++ b/ldes-server-infra-postgres/postgres-liquibase/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server-infra-postgres - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT postgres-liquibase diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-collection-stats.sql b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-collection-stats.sql new file mode 100644 index 0000000000..7cc1affd0a --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-collection-stats.sql @@ -0,0 +1,14 @@ +-- create collection statistics table +CREATE TABLE collection_stats +( + collection_id bigint NOT NULL, + ingested_count bigint NOT NULL default 0 +); +ALTER TABLE "collection_stats" ADD FOREIGN KEY ("collection_id") REFERENCES "collections" ("collection_id") ON DELETE CASCADE; +ALTER TABLE "collection_stats" ADD PRIMARY KEY ("collection_id"); + +-- initialize current counts +insert into collection_stats(collection_id, ingested_count) +select c.collection_id, count(m.member_id) +from members m join collections c on m.collection_id = c.collection_id +group by c.collection_id; diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-open-pages-view.sql b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-open-pages-view.sql new file mode 100644 index 0000000000..da2df9824a --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-open-pages-view.sql @@ -0,0 +1,9 @@ +create view open_pages as +select p.page_id, p.bucket_id, p.partial_url, v.page_size, COUNT(member_id) AS assigned_members +from pages p +join buckets b on b.bucket_id = p.bucket_id +join views v ON v.view_id = b.view_id +left join page_members pm on pm.page_id = p.page_id +where not p.immutable +group by p.page_id, v.page_size +; diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-processable-members.sql b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-processable-members.sql new file mode 100644 index 0000000000..cc0277f56f --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-processable-members.sql @@ -0,0 +1,5 @@ +create view processable_members as +SELECT * +FROM members +WHERE xmin::text::bigint < pg_snapshot_xmin(pg_current_snapshot())::text::bigint +; diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-unprocessed-members.sql b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-unprocessed-members.sql new file mode 100644 index 0000000000..cf4390748d --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-unprocessed-members.sql @@ -0,0 +1,8 @@ +create view unprocessed_members as +SELECT m.member_id, c.collection_id, v.view_id +FROM collections c +JOIN views v ON v.collection_id = c.collection_id +JOIN view_stats vs ON vs.view_id = v.view_id +join processable_members m on m.collection_id = c.collection_id +WHERE m.member_id > vs.bucketized_last_id +; diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-version-delimiter.xml b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-version-delimiter.xml new file mode 100644 index 0000000000..e4d5f8a348 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/add-version-delimiter.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + UPDATE collections SET version_delimiter = '/' WHERE create_versions; + + + \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/drop-obsolete-views.sql b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/drop-obsolete-views.sql new file mode 100644 index 0000000000..29ab9abaa2 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/drop-obsolete-views.sql @@ -0,0 +1,4 @@ +-- drop obsolete member and bucket stats +DROP VIEW member_stats; +DROP VIEW bucket_stats; +DROP view bucket_last_page; diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/drop-old-member-id.xml b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/drop-old-member-id.xml new file mode 100644 index 0000000000..e4faff2b96 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/drop-old-member-id.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/drop-old-tables-with-cascade.xml b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/drop-old-tables-with-cascade.xml new file mode 100644 index 0000000000..00d2adf100 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/drop-old-tables-with-cascade.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/extend-view-stats.sql b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/extend-view-stats.sql new file mode 100644 index 0000000000..aca04cc004 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/extend-view-stats.sql @@ -0,0 +1,11 @@ +-- add last ID columns +ALTER TABLE "view_stats" ADD COLUMN "bucketized_last_id" bigint NOT NULL default 0; +ALTER TABLE "view_stats" ADD PRIMARY KEY ("view_id"); + +-- initialize last ID values +UPDATE view_stats vs SET bucketized_last_id = coalesce( + (select max(distinct(member_id)) + from page_members pm + WHERE pm.view_id = vs.view_id), + (0)::bigint +); diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/handle-collection-inserted.sql b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/handle-collection-inserted.sql new file mode 100644 index 0000000000..38cf9f0697 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/handle-collection-inserted.sql @@ -0,0 +1,12 @@ +-- create function to insert a stats row for the new collection +create function on_collection_inserted() returns trigger language plpgsql as $$ +begin + -- auto-create collection_stats record for each new collection + insert into collection_stats(collection_id) values (NEW.collection_id); + return null; +end +$$; + +-- add stats row after collection inserted +create trigger collections_ai after insert on collections +for each row execute procedure on_collection_inserted(); diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/make-page-relations-unique.xml b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/make-page-relations-unique.xml new file mode 100644 index 0000000000..df4f1f5324 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/make-page-relations-unique.xml @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/master.xml b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/master.xml new file mode 100644 index 0000000000..df61a935e2 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/master.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/redefine-needs-bucketization.sql b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/redefine-needs-bucketization.sql new file mode 100644 index 0000000000..98ad64bf2d --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/redefine-needs-bucketization.sql @@ -0,0 +1,20 @@ +-- drop needs_bucketization and related +DROP VIEW "unprocessed_views"; +DROP VIEW "needs_bucketization"; + +-- use collection stats for needs bucketization +CREATE OR REPLACE VIEW "needs_bucketization" AS +SELECT v.collection_id, v.view_id, (exists(select um.member_id + from unprocessed_members um + where v.view_id = um.view_id)) AS should_bucketize +FROM views v +GROUP BY v.collection_id, v.view_id; + +-- recreate unprocessed_views +CREATE OR REPLACE VIEW "unprocessed_views" AS +SELECT c.collection_id, c.name AS collection_name, v.view_id, v.name AS view_name +FROM collections c +JOIN views v ON c.collection_id = v.collection_id +JOIN needs_bucketization nb ON nb.collection_id = c.collection_id AND nb.view_id = v.view_id +JOIN needs_pagination np ON np.collection_id = c.collection_id AND np.view_id = v.view_id +WHERE nb.should_bucketize OR np.should_paginate; diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/remove-delete-view-trigger.sql b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/remove-delete-view-trigger.sql new file mode 100644 index 0000000000..9e6c2c3517 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/remove-delete-view-trigger.sql @@ -0,0 +1,3 @@ +-- remove unneeded trigger, cascading does the job +drop trigger views_ad on views; +drop function on_view_deleted; diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/remove-page-member-triggers.sql b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/remove-page-member-triggers.sql new file mode 100644 index 0000000000..23b3b7083c --- /dev/null +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_5_0/remove-page-member-triggers.sql @@ -0,0 +1,7 @@ +-- remove pagination counting triggers and functions +drop trigger page_member_ai on page_members; +drop function on_page_member_inserted; + +-- remove pagination counting triggers and functions +drop trigger page_member_bu on page_members; +drop function on_page_member_updating; diff --git a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/master.xml b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/master.xml index 13866f7194..5d260ea502 100644 --- a/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/master.xml +++ b/ldes-server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/master.xml @@ -9,5 +9,6 @@ + \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/pom.xml b/ldes-server-infra-postgres/postgres-maintenance-repository/pom.xml new file mode 100644 index 0000000000..88190c284d --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + + be.vlaanderen.informatievlaanderen.vsds + ldes-server-infra-postgres + 3.5.0-SNAPSHOT + + + postgres-maintenance-repository + + + + be.vlaanderen.informatievlaanderen.vsds + ldes-server-retention + ${project.version} + + + be.vlaanderen.informatievlaanderen.vsds + ldes-server-compaction + ${project.version} + + + be.vlaanderen.informatievlaanderen.vsds + postgres-admin-repository + ${project.version} + compile + + + + \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/CompactionPagePostgresRepository.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/CompactionPagePostgresRepository.java new file mode 100644 index 0000000000..358bb02cbd --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/CompactionPagePostgresRepository.java @@ -0,0 +1,42 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres; + +import be.vlaanderen.informatievlaanderen.ldes.server.compaction.domain.entities.CompactionCandidate; +import be.vlaanderen.informatievlaanderen.ldes.server.compaction.domain.repository.CompactionPageRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.mapper.CompactionCandidateMapper; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.repository.CompactionPageEntityRepository; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.List; + +@Repository +public class CompactionPagePostgresRepository implements CompactionPageRepository { + private final CompactionPageEntityRepository pageEntityRepository; + + public CompactionPagePostgresRepository(CompactionPageEntityRepository pageEntityRepository) { + this.pageEntityRepository = pageEntityRepository; + } + + @Override + public List getPossibleCompactionCandidates(ViewName viewName, int capacityPerPage) { + return pageEntityRepository + .findCompactionCandidates(viewName.getCollectionName(), viewName.getViewName(), capacityPerPage) + .stream() + .map(CompactionCandidateMapper::fromProjection) + .toList(); + } + + @Override + @Transactional + public void deleteOutdatedFragments(LocalDateTime deleteTime) { + pageEntityRepository.deleteByExpirationBefore(deleteTime); + } + + @Override + @Transactional + public void setDeleteTime(List ids, LocalDateTime deleteTime) { + pageEntityRepository.setDeleteTime(ids, deleteTime); + } +} diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/CompactionPageRelationPostgresRepository.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/CompactionPageRelationPostgresRepository.java new file mode 100644 index 0000000000..3bb78a663e --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/CompactionPageRelationPostgresRepository.java @@ -0,0 +1,23 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres; + +import be.vlaanderen.informatievlaanderen.ldes.server.compaction.domain.repository.CompactionPageRelationRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.repository.CompactionPageRelationEntityRepository; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Repository +public class CompactionPageRelationPostgresRepository implements CompactionPageRelationRepository { + private final CompactionPageRelationEntityRepository pageRelationEntityRepository; + + public CompactionPageRelationPostgresRepository(CompactionPageRelationEntityRepository pageRelationEntityRepository) { + this.pageRelationEntityRepository = pageRelationEntityRepository; + } + + @Override + @Transactional + public void updateCompactionBucketRelations(List compactedPageIds, long targetId) { + pageRelationEntityRepository.updateToPageRelations(compactedPageIds, targetId); + } +} diff --git a/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/MemberPropertiesPostgresRepository.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/MemberPropertiesPostgresRepository.java similarity index 76% rename from ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/MemberPropertiesPostgresRepository.java rename to ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/MemberPropertiesPostgresRepository.java index b3f5f922d2..d3005f39a1 100644 --- a/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/MemberPropertiesPostgresRepository.java +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/MemberPropertiesPostgresRepository.java @@ -1,11 +1,11 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.retention.postgres; +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.entity.MemberEntity; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.projection.RetentionMemberProjection; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity.RetentionMemberEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.mapper.MemberPropertiesEntityMapper; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.projection.RetentionMemberProjection; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.repository.RetentionMemberEntityRepository; import be.vlaanderen.informatievlaanderen.ldes.server.retention.entities.MemberProperties; -import be.vlaanderen.informatievlaanderen.ldes.server.retention.postgres.mapper.MemberPropertiesEntityMapper; -import be.vlaanderen.informatievlaanderen.ldes.server.retention.postgres.repository.RetentionMemberEntityRepository; import be.vlaanderen.informatievlaanderen.ldes.server.retention.repositories.MemberPropertiesRepository; import be.vlaanderen.informatievlaanderen.ldes.server.retention.services.retentionpolicy.definition.timeandversionbased.TimeAndVersionBasedRetentionPolicy; import be.vlaanderen.informatievlaanderen.ldes.server.retention.services.retentionpolicy.definition.timebased.TimeBasedRetentionPolicy; @@ -34,14 +34,6 @@ public MemberPropertiesPostgresRepository(EntityManager entityManager, this.propertiesMapper = propertiesMapper; this.memberEntityRepository = memberEntityRepository; } - @Override - public void removePageMemberEntity(Long id, String collectionName, String viewName) { - Query query = entityManager.createQuery("DELETE FROM PageMemberEntity p WHERE p.member.id = :memberId AND p.bucket.view.name = :viewName AND p.bucket.view.eventStream.name = :collectionName"); - query.setParameter("viewName", viewName); - query.setParameter("collectionName", collectionName); - query.setParameter("memberId", id); - query.executeUpdate(); - } @Override @Transactional @@ -52,7 +44,7 @@ public void deleteAllByIds(List ids) { @Override @Transactional public void removeFromEventSource(List ids) { - Query query = entityManager.createQuery("UPDATE MemberEntity m SET m.isInEventSource = :isInEventSource " + + Query query = entityManager.createQuery("UPDATE RetentionMemberEntity m SET m.isInEventSource = :isInEventSource " + "WHERE m.id IN :memberIds"); query.setParameter("isInEventSource", false); query.setParameter("memberIds", ids); @@ -64,8 +56,8 @@ public void removeFromEventSource(List ids) { public List findExpiredMembers(ViewName viewName, TimeBasedRetentionPolicy policy) { return memberEntityRepository.findAllByViewNameAndTimestampBefore(viewName.getViewName(), viewName.getCollectionName(), LocalDateTime.now().minus(policy.duration())) - .sorted(Comparator.comparing(MemberEntity::getId).reversed()) - .map(MemberEntity::getId) + .sorted(Comparator.comparing(RetentionMemberEntity::getId).reversed()) + .map(RetentionMemberEntity::getId) .toList(); } @@ -75,13 +67,13 @@ public List findExpiredMembers(ViewName viewName, VersionBasedRetentionPolicy policy) { return memberEntityRepository.findAllByViewName(viewName.getViewName(), viewName.getCollectionName()) - .collect(Collectors.groupingBy(MemberEntity::getVersionOf)) + .collect(Collectors.groupingBy(RetentionMemberEntity::getVersionOf)) .values() .stream() .flatMap(memberPropertiesGroup -> memberPropertiesGroup.stream() - .sorted(Comparator.comparing(MemberEntity::getId).reversed()) + .sorted(Comparator.comparing(RetentionMemberEntity::getId).reversed()) .skip(policy.numberOfMembersToKeep())) - .map(MemberEntity::getId) + .map(RetentionMemberEntity::getId) .toList(); } @@ -91,13 +83,13 @@ public List findExpiredMembers(ViewName viewName, public List findExpiredMembers(ViewName viewName, TimeAndVersionBasedRetentionPolicy policy) { return memberEntityRepository.findAllByViewNameAndTimestampBefore(viewName.getViewName(), viewName.getCollectionName(), LocalDateTime.now().minus(policy.duration())) - .collect(Collectors.groupingBy(MemberEntity::getVersionOf)) + .collect(Collectors.groupingBy(RetentionMemberEntity::getVersionOf)) .values() .stream() .flatMap(memberPropertiesGroup -> memberPropertiesGroup.stream() - .sorted(Comparator.comparing(MemberEntity::getId).reversed()) + .sorted(Comparator.comparing(RetentionMemberEntity::getId).reversed()) .skip(policy.numberOfMembersToKeep())) - .map(MemberEntity::getId) + .map(RetentionMemberEntity::getId) .toList(); } diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/RetentionPageMemberPostgresRepository.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/RetentionPageMemberPostgresRepository.java new file mode 100644 index 0000000000..8cb8a56b70 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/RetentionPageMemberPostgresRepository.java @@ -0,0 +1,33 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres; + +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.repository.RetentionPageMemberEntityRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.repository.PageMemberRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Component +public class RetentionPageMemberPostgresRepository implements PageMemberRepository { + + private final RetentionPageMemberEntityRepository entityRepository; + + public RetentionPageMemberPostgresRepository(RetentionPageMemberEntityRepository entityRepository) { + this.entityRepository = entityRepository; + } + + @Override + @Transactional + public void setPageMembersToNewPage(long newPageId, List pageIds) { + entityRepository.setPageMembersToNewPage(newPageId, pageIds); + } + + @Override + @Modifying + @Transactional + public void deleteByViewNameAndMembersIds(ViewName viewName, List memberIds) { + entityRepository.removePageMembers(viewName.getCollectionName(), viewName.getViewName(), memberIds); + } +} diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/CompactionPageEntity.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/CompactionPageEntity.java new file mode 100644 index 0000000000..c85cf9539e --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/CompactionPageEntity.java @@ -0,0 +1,70 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity; + +import jakarta.persistence.*; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "pages") +public class CompactionPageEntity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "page_id", unique = true, nullable = false, columnDefinition = "BIGINT") + private Long id; + + @Column(name = "bucket_id", columnDefinition = "BIGINT") + private Long bucketId; + + @Column(name = "immutable", nullable = false, columnDefinition = "BOOLEAN") + private boolean immutable; + + @Column(name = "expiration", columnDefinition = "TIMESTAMP") + private LocalDateTime expiration; + + @Column(name = "next_update_ts", columnDefinition = "TIMESTAMP") + private LocalDateTime nextUpdateTs; + + @Column(name = "partial_url", nullable = false, unique = true) + private String partialUrl; + + public CompactionPageEntity() { + } + + public CompactionPageEntity(Long pageId) { + this.id = pageId; + } + + public CompactionPageEntity(Long bucketId, String partialUrl) { + this.bucketId = bucketId; + this.immutable = false; + this.partialUrl = partialUrl; + } + + public Long getId() { + return id; + } + + public Long getBucketId() { + return bucketId; + } + + public boolean isImmutable() { + return immutable; + } + + public LocalDateTime getExpiration() { + return expiration; + } + + public LocalDateTime getNextUpdateTs() { + return nextUpdateTs; + } + + public String getPartialUrl() { + return partialUrl; + } + + public void setId(Long id) { + this.id = id; + } +} diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/CompactionPageRelationEntity.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/CompactionPageRelationEntity.java new file mode 100644 index 0000000000..36cfa7e60c --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/CompactionPageRelationEntity.java @@ -0,0 +1,63 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity; + +import jakarta.persistence.*; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +@Entity +@Table(name = "page_relations") +public class CompactionPageRelationEntity { + @EmbeddedId + private RelationId relationId; + + @ManyToOne + @MapsId("fromPageId") + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinColumn(name = "from_page_id", nullable = false, columnDefinition = "BIGINT") + private CompactionPageEntity fromPage; + + @ManyToOne + @MapsId("toPageId") + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinColumn(name = "to_page_id", nullable = false, columnDefinition = "BIGINT") + private CompactionPageEntity toPage; + + @Column(name = "relation_type", nullable = false, columnDefinition = "VARCHAR(255)") + private String treeRelationType; + + @Column(name = "value", columnDefinition = "VARCHAR(255)") + private String treeValue; + + @Column(name = "value_type", columnDefinition = "VARCHAR(255)") + private String treeValueType; + + @Column(name = "path", columnDefinition = "VARCHAR(255)") + private String treePath; + + protected CompactionPageRelationEntity() { + } + + public RelationId getRelationId() { + return relationId; + } + + public CompactionPageEntity getToPage() { + return toPage; + } + + public String getTreeRelationType() { + return treeRelationType; + } + + public String getTreeValue() { + return treeValue; + } + + public String getTreeValueType() { + return treeValueType; + } + + public String getTreePath() { + return treePath; + } +} diff --git a/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/entity/MemberPropertiesEntity.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/MemberPropertiesEntity.java similarity index 95% rename from ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/entity/MemberPropertiesEntity.java rename to ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/MemberPropertiesEntity.java index af8a6f8b7d..7bb17aaf08 100644 --- a/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/entity/MemberPropertiesEntity.java +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/MemberPropertiesEntity.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.retention.postgres.entity; +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity; import jakarta.persistence.*; diff --git a/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/entity/MemberViewsEntity.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/MemberViewsEntity.java similarity index 90% rename from ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/entity/MemberViewsEntity.java rename to ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/MemberViewsEntity.java index 9c6e839298..09921b2934 100644 --- a/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/entity/MemberViewsEntity.java +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/MemberViewsEntity.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.retention.postgres.entity; +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity; import jakarta.persistence.*; diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/PageMemberId.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/PageMemberId.java new file mode 100644 index 0000000000..6710588b57 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/PageMemberId.java @@ -0,0 +1,54 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; + +import java.io.Serializable; + +@Embeddable +public class PageMemberId implements Serializable { + @Column(name = "member_id", nullable = false, columnDefinition = "BIGINT") + private Long memberId; + + @Column(name = "bucket_id", nullable = false, columnDefinition = "BIGINT") + private Long bucketId; + + public PageMemberId() { + } + + public PageMemberId(Long memberId, Long bucketId) { + this.memberId = memberId; + this.bucketId = bucketId; + } + + public Long getMemberId() { + return memberId; + } + + public void setMemberId(Long memberId) { + this.memberId = memberId; + } + + public Long getBucketId() { + return bucketId; + } + + public void setBucketId(Long bucketId) { + this.bucketId = bucketId; + } + + @Override + public final boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof PageMemberId that)) return false; + + return memberId.equals(that.memberId) && bucketId.equals(that.bucketId); + } + + @Override + public int hashCode() { + int result = memberId.hashCode(); + result = 31 * result + bucketId.hashCode(); + return result; + } +} diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/RelationId.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/RelationId.java new file mode 100644 index 0000000000..bad3689bf2 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/RelationId.java @@ -0,0 +1,46 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; + +import java.io.Serializable; + +@Embeddable +public class RelationId implements Serializable { + @Column(name = "from_page_id", nullable = false, columnDefinition = "BIGINT") + private Long fromPageId; + + @Column(name = "to_page_id", nullable = false, columnDefinition = "BIGINT") + private Long toPageId; + + public RelationId() { + } + + public RelationId(Long fromPageId, Long toPageId) { + this.fromPageId = fromPageId; + this.toPageId = toPageId; + } + + public Long getFromPageId() { + return fromPageId; + } + + public Long getToPageId() { + return toPageId; + } + + @Override + public final boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof RelationId that)) return false; + + return fromPageId.equals(that.fromPageId) && toPageId.equals(that.toPageId); + } + + @Override + public int hashCode() { + int result = fromPageId.hashCode(); + result = 31 * result + toPageId.hashCode(); + return result; + } +} diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/RetentionMemberEntity.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/RetentionMemberEntity.java new file mode 100644 index 0000000000..7025bafc3e --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/RetentionMemberEntity.java @@ -0,0 +1,90 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity; + +import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.eventstream.entity.EventStreamEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.mapper.RetentionDatabaseColumnModelConverter; +import jakarta.persistence.*; +import org.apache.jena.rdf.model.Model; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "members", indexes = { + @Index(columnList = "member_id, timestamp"), + @Index(columnList = "subject, collection_id", unique = true) +}) +public class RetentionMemberEntity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "member_id", columnDefinition = "BIGINT", nullable = false) + private long id; + @Column(name = "subject", nullable = false) + private String subject; + @ManyToOne(fetch = FetchType.EAGER) + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinColumn(name = "collection_id", nullable = false) + private EventStreamEntity collection; + @Column(name = "version_of", nullable = false) + private String versionOf; + @Column(name = "timestamp", nullable = false) + private LocalDateTime timestamp; + @Column(name = "transaction_id", nullable = false) + private String transactionId; + @Column(name = "is_in_event_source", nullable = false) + private boolean isInEventSource; + @Convert(converter = RetentionDatabaseColumnModelConverter.class) + @Column(name = "member_model", nullable = false, columnDefinition = "bytea") + private Model model; + + @SuppressWarnings("java:S107") + public RetentionMemberEntity(String subject, EventStreamEntity collection, String versionOf, LocalDateTime timestamp, String transactionId, boolean isInEventSource, Model model) { + this.subject = subject; + this.collection = collection; + this.versionOf = versionOf; + this.timestamp = timestamp; + this.transactionId = transactionId; + this.isInEventSource = isInEventSource; + this.model = model; + } + + public RetentionMemberEntity(long id) { + this.id = id; + } + + protected RetentionMemberEntity() { + } + + public long getId() { + return id; + } + + + public String getSubject() { + return subject; + } + + public EventStreamEntity getCollection() { + return collection; + } + + public String getVersionOf() { + return versionOf; + } + + public LocalDateTime getTimestamp() { + return timestamp; + } + + public String getTransactionId() { + return transactionId; + } + + public boolean isInEventSource() { + return isInEventSource; + } + + public Model getModel() { + return model; + } +} diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/RetentionPageMemberEntity.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/RetentionPageMemberEntity.java new file mode 100644 index 0000000000..dca73de8d1 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/entity/RetentionPageMemberEntity.java @@ -0,0 +1,22 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; + +@Entity +@Table(name = "page_members") +public class RetentionPageMemberEntity { + @EmbeddedId + private PageMemberId pageMemberId; + + @Column(name = "member_id", nullable = false, columnDefinition = "BIGINT", insertable=false, updatable=false) + private Long memberId; + + @Column(name = "bucket_id", nullable = false, columnDefinition = "BIGINT", insertable=false, updatable=false) + private Long bucketId; + + @Column(name = "page_id", columnDefinition = "BIGINT") + private Long pageId; +} diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/mapper/CompactionCandidateMapper.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/mapper/CompactionCandidateMapper.java new file mode 100644 index 0000000000..da67737534 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/mapper/CompactionCandidateMapper.java @@ -0,0 +1,17 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.mapper; + +import be.vlaanderen.informatievlaanderen.ldes.server.compaction.domain.entities.CompactionCandidate; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.projection.CompactionCandidateProjection; + +public class CompactionCandidateMapper { + private CompactionCandidateMapper() {} + + public static CompactionCandidate fromProjection(CompactionCandidateProjection projection) { + return new CompactionCandidate( + projection.getFragmentId(), + projection.getSize(), + projection.getToPage(), + projection.getBucketId(), + projection.getPartialUrl()); + } +} diff --git a/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/mapper/MemberPropertiesEntityMapper.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/mapper/MemberPropertiesEntityMapper.java similarity index 70% rename from ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/mapper/MemberPropertiesEntityMapper.java rename to ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/mapper/MemberPropertiesEntityMapper.java index 3d9eeb57af..657d881d18 100644 --- a/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/mapper/MemberPropertiesEntityMapper.java +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/mapper/MemberPropertiesEntityMapper.java @@ -1,7 +1,7 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.retention.postgres.mapper; +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.mapper; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.projection.RetentionMemberProjection; import be.vlaanderen.informatievlaanderen.ldes.server.retention.entities.MemberProperties; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.projection.RetentionMemberProjection; import org.springframework.stereotype.Component; @Component diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/mapper/RetentionDatabaseColumnModelConverter.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/mapper/RetentionDatabaseColumnModelConverter.java new file mode 100644 index 0000000000..530452ab96 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/mapper/RetentionDatabaseColumnModelConverter.java @@ -0,0 +1,29 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.mapper; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.riot.Lang; +import org.apache.jena.riot.RDFParser; +import org.apache.jena.riot.RDFWriter; +import org.springframework.stereotype.Component; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +@Converter +@Component +public class RetentionDatabaseColumnModelConverter implements AttributeConverter { + public static final Lang SERIALISATION_LANG = Lang.RDFPROTO; + @Override + public byte[] convertToDatabaseColumn(Model attribute) { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + RDFWriter.source(attribute).lang(SERIALISATION_LANG).output(stream); + return stream.toByteArray(); + } + + @Override + public Model convertToEntityAttribute(byte[] dbData) { + return RDFParser.source(new ByteArrayInputStream(dbData)).lang(SERIALISATION_LANG).toModel(); + } +} diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/projection/CompactionCandidateProjection.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/projection/CompactionCandidateProjection.java new file mode 100644 index 0000000000..e00fbb2f25 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/projection/CompactionCandidateProjection.java @@ -0,0 +1,9 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.projection; + +public interface CompactionCandidateProjection { + Long getFragmentId(); + Integer getSize(); + Long getToPage(); + Long getBucketId(); + String getPartialUrl(); +} diff --git a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/projection/RetentionMemberProjection.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/projection/RetentionMemberProjection.java similarity index 73% rename from ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/projection/RetentionMemberProjection.java rename to ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/projection/RetentionMemberProjection.java index 982d2d0cdd..7bda050225 100644 --- a/ldes-server-infra-postgres/postgres-ingest-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/postgres/projection/RetentionMemberProjection.java +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/projection/RetentionMemberProjection.java @@ -1,4 +1,4 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.projection; +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.projection; import java.time.LocalDateTime; diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/CompactionPageEntityRepository.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/CompactionPageEntityRepository.java new file mode 100644 index 0000000000..b7a09057a5 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/CompactionPageEntityRepository.java @@ -0,0 +1,40 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.repository; + +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity.CompactionPageEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.projection.CompactionCandidateProjection; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.List; + +public interface CompactionPageEntityRepository extends JpaRepository { + + @Query(value = """ + SELECT p.page_id as fragmentId, COUNT(*) AS size, r.to_page_id AS toPage, p.bucket_id AS bucketId, p.partial_url AS partialUrl + FROM pages p JOIN buckets b ON p.bucket_id = b.bucket_id + JOIN views v ON b.view_id = v.view_id + JOIN page_relations r ON p.page_id = r.from_page_id + JOIN collections c on c.collection_id = v.collection_id + WHERE c.name = :collectionName + AND v.name = :viewName + AND p.expiration IS NULL AND p.immutable + GROUP BY p.page_id, r.to_page_id + HAVING COUNT(*) < :capacityPerPage + """, nativeQuery = true) + @Transactional(readOnly = true) + List findCompactionCandidates(@Param("collectionName") String collectionName, + @Param("viewName") String viewName, + @Param("capacityPerPage") Integer capacityPerPage); + + @Modifying + @Query("DELETE FROM CompactionPageEntity p WHERE CAST(p.expiration AS timestamp) < CAST(:expiration AS timestamp)") + void deleteByExpirationBefore(@Param("expiration") LocalDateTime expiration); + + @Modifying + @Query("UPDATE CompactionPageEntity p SET p.expiration = :expiration WHERE p.id IN :ids") + void setDeleteTime(@Param("ids") List ids, @Param("expiration") LocalDateTime expiration); +} \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/CompactionPageRelationEntityRepository.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/CompactionPageRelationEntityRepository.java new file mode 100644 index 0000000000..0f364699c0 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/CompactionPageRelationEntityRepository.java @@ -0,0 +1,17 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.repository; + +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity.CompactionPageRelationEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity.RelationId; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +public interface CompactionPageRelationEntityRepository extends JpaRepository { + + @Modifying + @Query("UPDATE CompactionPageRelationEntity r SET r.toPage = ( SELECT p FROM CompactionPageEntity p WHERE p.id = :targetId ) " + + "WHERE r.toPage.id IN :ids OR r.fromPage.id IN : ids") + void updateToPageRelations(List ids, long targetId); +} diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/RetentionMemberEntityRepository.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/RetentionMemberEntityRepository.java new file mode 100644 index 0000000000..8f2383c3e2 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/RetentionMemberEntityRepository.java @@ -0,0 +1,26 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.repository; + +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity.RetentionMemberEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.projection.RetentionMemberProjection; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Stream; + +public interface RetentionMemberEntityRepository extends JpaRepository { + + void deleteAllByIdIn(List ids); + @Query("SELECT m FROM RetentionMemberEntity m JOIN ViewEntity v ON m.collection = v.eventStream JOIN RetentionPageMemberEntity pm ON pm.memberId = m.id WHERE v.name = :viewName AND v.eventStream.name = :collectionName AND CAST(m.timestamp as timestamp) < CAST(:timestamp as timestamp)") + Stream findAllByViewNameAndTimestampBefore(String viewName, String collectionName, LocalDateTime timestamp); + + @Query("SELECT m FROM RetentionMemberEntity m JOIN ViewEntity v ON m.collection = v.eventStream JOIN RetentionPageMemberEntity pm ON pm.memberId = m.id WHERE v.name = :viewName AND v.eventStream.name = :collectionName") + Stream findAllByViewName(String viewName, String collectionName); + + @Query("SELECT m.id AS id, m.versionOf AS versionOf, m.timestamp AS timestamp, CASE WHEN (SELECT COUNT(p.memberId) FROM RetentionPageMemberEntity p WHERE p.memberId = m.id) > 0 THEN true ELSE false END AS inView, m.isInEventSource AS inEventSource, c.name AS collectionName FROM RetentionMemberEntity m JOIN EventStreamEntity c ON m.collection = c WHERE c.name = :collectionName GROUP BY m.id, c.name") + List findAllByCollectionName(String collectionName); + + @Query("SELECT m.id AS id, m.versionOf AS versionOf, m.timestamp AS timestamp, CASE WHEN (SELECT COUNT(p.memberId) FROM RetentionPageMemberEntity p WHERE p.memberId = m.id) > 0 THEN true ELSE false END AS inView, m.isInEventSource AS inEventSource, c.name AS collectionName FROM RetentionMemberEntity m JOIN EventStreamEntity c ON m.collection = c WHERE c.name = :collectionName AND CAST(m.timestamp AS timestamp) < CAST(:timestamp as timestamp) GROUP BY m.id, c.name") + List findAllByCollectionNameAndTimestampBefore(String collectionName, LocalDateTime timestamp); +} diff --git a/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/RetentionPageMemberEntityRepository.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/RetentionPageMemberEntityRepository.java new file mode 100644 index 0000000000..1a853fe34c --- /dev/null +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/maintenance/postgres/repository/RetentionPageMemberEntityRepository.java @@ -0,0 +1,29 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.repository; + +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity.PageMemberId; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.entity.RetentionPageMemberEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +public interface RetentionPageMemberEntityRepository extends JpaRepository { + + @Modifying + @Query("UPDATE PageMemberEntity m SET m.page = (SELECT p FROM PageEntity p WHERE p.id = :newPageId) WHERE m.page.id IN (:pageIds)") + void setPageMembersToNewPage(long newPageId, List pageIds); + + @Modifying + @Query(value = """ + DELETE FROM page_members + WHERE member_id IN ( + SELECT pm.member_id + FROM page_members pm + JOIN views v ON pm.view_id = v.view_id + JOIN collections c ON c.collection_id = v.collection_id + WHERE c.name = :collectionName AND v.name = :viewName AND pm.member_id IN (:memberIds) + ); + """, nativeQuery = true) + void removePageMembers(String collectionName, String viewName, List memberIds); +} \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-retention-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/PostgresRetentionIntegrationTest.java b/ldes-server-infra-postgres/postgres-maintenance-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/PostgresRetentionIntegrationTest.java similarity index 89% rename from ldes-server-infra-postgres/postgres-retention-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/PostgresRetentionIntegrationTest.java rename to ldes-server-infra-postgres/postgres-maintenance-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/PostgresRetentionIntegrationTest.java index 7206f90906..fce181cb79 100644 --- a/ldes-server-infra-postgres/postgres-retention-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/PostgresRetentionIntegrationTest.java +++ b/ldes-server-infra-postgres/postgres-maintenance-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/PostgresRetentionIntegrationTest.java @@ -1,6 +1,6 @@ package be.vlaanderen.informatievlaanderen.ldes.server.retention; -import be.vlaanderen.informatievlaanderen.ldes.server.retention.postgres.MemberPropertiesPostgresRepository; +import be.vlaanderen.informatievlaanderen.ldes.server.maintenance.postgres.MemberPropertiesPostgresRepository; import io.cucumber.spring.CucumberContextConfiguration; import io.zonky.test.db.AutoConfigureEmbeddedDatabase; import org.springframework.beans.factory.annotation.Autowired; diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/pom.xml b/ldes-server-infra-postgres/postgres-pagination-repository/pom.xml index 60f6bf45ed..dec00259bb 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/pom.xml +++ b/ldes-server-infra-postgres/postgres-pagination-repository/pom.xml @@ -6,16 +6,12 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server-infra-postgres - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT postgres-pagination-repository - - be.vlaanderen.informatievlaanderen.vsds - ldes-server-domain - be.vlaanderen.informatievlaanderen.vsds ldes-server-pagination @@ -28,20 +24,14 @@ ${project.version} - be.vlaanderen.informatievlaanderen.vsds - postgres-ingest-repository - ${project.version} - compile + org.springframework.batch + spring-batch-test + test be.vlaanderen.informatievlaanderen.vsds - ldes-server-compaction + postgres-ingest-repository ${project.version} - compile - - - org.springframework.batch - spring-batch-test test diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PageMemberPostgresRepository.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PageMemberPostgresRepository.java index 9037e48cfb..f3be74105e 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PageMemberPostgresRepository.java +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PageMemberPostgresRepository.java @@ -1,18 +1,14 @@ package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.entities.Page; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.entity.PageEntity; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.repository.PageMemberEntityRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.retention.repositories.PageMemberRepository; -import org.springframework.data.jpa.repository.Modifying; import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; import java.util.List; @Repository -public class PageMemberPostgresRepository implements PageMemberRepository, be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories.PageMemberRepository { +public class PageMemberPostgresRepository implements be.vlaanderen.informatievlaanderen.ldes.server.pagination.repositories.PageMemberRepository { private final PageMemberEntityRepository entityRepository; @@ -20,19 +16,6 @@ public PageMemberPostgresRepository(PageMemberEntityRepository entityRepository) this.entityRepository = entityRepository; } - @Override - @Transactional - public void setPageMembersToNewPage(long newPageId, List pageIds) { - entityRepository.setPageMembersToNewPage(newPageId, pageIds); - } - - @Override - @Modifying - @Transactional - public void deleteByViewNameAndMembersIds(ViewName viewName, List memberIds) { - entityRepository.deleteAllByBucket_View_EventStream_NameAndBucket_View_NameAndMember_IdIn(viewName.getCollectionName(), viewName.getViewName(), memberIds); - } - @Override public List getUnpaginatedMembersForBucket(long bucketId) { return entityRepository.findByBucketIdAndPageIdIsNullOrderByMemberId(bucketId); diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PagePostgresRepository.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PagePostgresRepository.java index 56a2cd20b8..6b95b05fd4 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PagePostgresRepository.java +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PagePostgresRepository.java @@ -1,7 +1,5 @@ package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.CompactionCandidate; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.entities.Page; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.batch.PaginationRowMapper; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.entity.PageEntity; @@ -12,10 +10,6 @@ import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; -import java.util.List; -import java.util.stream.Stream; - @Repository public class PagePostgresRepository implements PageRepository { private final JdbcTemplate jdbcTemplate; @@ -32,15 +26,9 @@ public PagePostgresRepository(JdbcTemplate jdbcTemplate, PageEntityRepository pa @Transactional(readOnly = true) public Page getOpenPage(long bucketId) { String sql = """ - select p.page_id, p.bucket_id, p.partial_url, v.page_size, COUNT(member_id) AS assigned_members - from pages p - left join page_members pm on pm.page_id = p.page_id - JOIN buckets b ON p.bucket_id = b.bucket_id - JOIN views v ON v.view_id = b.view_id - join bucket_last_page blp on blp.bucket_id = b.bucket_id AND blp.last_page_id = p.page_id - where b.bucket_id = ? - group by p.page_id, v.page_size - order by page_id + select page_id, bucket_id, partial_url, page_size, assigned_members + from open_pages + where bucket_id = ? """; return jdbcTemplate.query(sql, new PaginationRowMapper(), bucketId) .stream() @@ -66,23 +54,4 @@ public Page createNextPage(Page parentPage) { public void markAllPagesImmutableByCollectionName(String collectionName) { pageEntityRepository.markAllPagesImmutableByCollectionName(collectionName); } - - @Override - public Stream getPossibleCompactionCandidates(ViewName viewName, int capacityPerPage) { - return pageEntityRepository.findCompactionCandidates(viewName.getCollectionName(), viewName.getViewName(), capacityPerPage) - .stream().map(projection -> new CompactionCandidate(projection.getFragmentId(), projection.getSize(), projection.getToPage(), - projection.getImmutable(), projection.getExpiration(), projection.getBucketId(), projection.getPartialUrl())); - } - - @Override - @Transactional - public void deleteOutdatedFragments(LocalDateTime deleteTime) { - pageEntityRepository.deleteByExpirationBefore(deleteTime); - } - - @Override - @Transactional - public void setDeleteTime(List ids, LocalDateTime deleteTime) { - pageEntityRepository.setDeleteTime(ids, deleteTime); - } } diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PageRelationPostgresRepository.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PageRelationPostgresRepository.java index f894a98293..ab97a0cc88 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PageRelationPostgresRepository.java +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PageRelationPostgresRepository.java @@ -6,8 +6,6 @@ import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; -import java.util.List; - @Repository public class PageRelationPostgresRepository implements PageRelationRepository { private final PageRelationEntityRepository pageRelationEntityRepository; @@ -21,10 +19,4 @@ public PageRelationPostgresRepository(PageRelationEntityRepository pageRelationE public void insertGenericBucketRelation(long fromPageId, long toPageId) { pageRelationEntityRepository.insertRelation(fromPageId, toPageId, RdfConstants.GENERIC_TREE_RELATION); } - - @Override - @Transactional - public void updateCompactionBucketRelations(List compactedPageIds, long targetId) { - pageRelationEntityRepository.updateToPageRelations(compactedPageIds, targetId); - } } diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/entity/MemberEntity.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/entity/MemberEntity.java new file mode 100644 index 0000000000..d676216c37 --- /dev/null +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/entity/MemberEntity.java @@ -0,0 +1,50 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.entity; + +import be.vlaanderen.informatievlaanderen.ldes.server.admin.postgres.eventstream.entity.EventStreamEntity; +import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.mapper.MemberModelConverter; +import jakarta.persistence.*; +import org.apache.jena.rdf.model.Model; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +import java.time.LocalDateTime; + +@Entity(name = "PaginationMemberEntity") +@Table(name = "members", indexes = { + @Index(columnList = "member_id, timestamp"), + @Index(columnList = "subject, collection_id", unique = true) +}) +public class MemberEntity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "member_id", columnDefinition = "BIGINT", nullable = false) + private long id; + @Column(name = "subject", nullable = false) + private String subject; + @ManyToOne(fetch = FetchType.EAGER) + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinColumn(name = "collection_id", nullable = false) + private EventStreamEntity collection; + @Column(name = "version_of", nullable = false) + private String versionOf; + @Column(name = "timestamp", nullable = false) + private LocalDateTime timestamp; + @Column(name = "transaction_id", nullable = false) + private String transactionId; + @Column(name = "is_in_event_source", nullable = false) + private boolean isInEventSource; + @Convert(converter = MemberModelConverter.class) + @Column(name = "member_model", nullable = false, columnDefinition = "bytea") + private Model model; + + public MemberEntity(long id) { + this.id = id; + } + + protected MemberEntity() { + } + + public long getId() { + return id; + } +} diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/entity/PageMemberEntity.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/entity/PageMemberEntity.java index 6612d9a235..9e944c3e27 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/entity/PageMemberEntity.java +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/entity/PageMemberEntity.java @@ -1,7 +1,6 @@ package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.entity; import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.postgres.entity.BucketEntity; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.entity.MemberEntity; import jakarta.persistence.*; import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/mapper/MemberModelConverter.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/mapper/MemberModelConverter.java new file mode 100644 index 0000000000..e58dd15f9b --- /dev/null +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/mapper/MemberModelConverter.java @@ -0,0 +1,29 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.mapper; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.riot.RDFParser; +import org.apache.jena.riot.RDFWriter; +import org.springframework.stereotype.Component; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.ServerConstants.SERIALISATION_LANG; + +@Converter +@Component("PaginationMemberModelConverter") +public class MemberModelConverter implements AttributeConverter { + @Override + public byte[] convertToDatabaseColumn(Model attribute) { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + RDFWriter.source(attribute).lang(SERIALISATION_LANG).output(stream); + return stream.toByteArray(); + } + + @Override + public Model convertToEntityAttribute(byte[] dbData) { + return RDFParser.source(new ByteArrayInputStream(dbData)).lang(SERIALISATION_LANG).toModel(); + } +} diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/mapper/TreeNodeMapper.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/mapper/TreeNodeMapper.java deleted file mode 100644 index 09a35d58ce..0000000000 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/mapper/TreeNodeMapper.java +++ /dev/null @@ -1,25 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.mapper; - -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.Member; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.entities.TreeNode; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.projection.TreeNodeProjection; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.projection.TreeRelationProjection; - -import java.util.List; - -public class TreeNodeMapper { - private TreeNodeMapper() { - } - - public static TreeNode fromProjection(TreeNodeProjection projection, List relations, List members) { - return new TreeNode( - projection.getPartialUrl(), - projection.isImmutable(), - projection.isView(), - relations.stream().map(TreeRelationMapper::fromProjection).toList(), - members, - projection.getCollectionName(), - projection.getNextUpdateTs() - ); - } -} diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/mapper/TreeRelationMapper.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/mapper/TreeRelationMapper.java deleted file mode 100644 index 3cec2777cd..0000000000 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/mapper/TreeRelationMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.mapper; - -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.LdesFragmentIdentifier; -import be.vlaanderen.informatievlaanderen.ldes.server.fetching.valueobjects.TreeRelation; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.projection.TreeRelationProjection; - -public class TreeRelationMapper { - private TreeRelationMapper() {} - - public static TreeRelation fromProjection(TreeRelationProjection projection) { - return new TreeRelation( - projection.getTreePath(), - LdesFragmentIdentifier.fromFragmentId(projection.getToPagePartialUrl()), - projection.getTreeValue(), - projection.getTreeValueType(), - projection.getTreeRelationType() - ); - } -} diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/projection/CompactionCandidateProjection.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/projection/CompactionCandidateProjection.java deleted file mode 100644 index 0b73227f2d..0000000000 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/projection/CompactionCandidateProjection.java +++ /dev/null @@ -1,13 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.projection; - -import java.time.LocalDateTime; - -public interface CompactionCandidateProjection { - Long getFragmentId(); - Integer getSize(); - Long getToPage(); - Boolean getImmutable(); - LocalDateTime getExpiration(); - Long getBucketId(); - String getPartialUrl(); -} diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageEntityRepository.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageEntityRepository.java index 289e4a77f3..02054ee99f 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageEntityRepository.java +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageEntityRepository.java @@ -1,22 +1,11 @@ package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.repository; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.entity.PageEntity; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.projection.CompactionCandidateProjection; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.projection.TreeNodeProjection; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Optional; public interface PageEntityRepository extends JpaRepository { - @Transactional(readOnly = true) - Optional findTreeNodeByPartialUrl(String partialUrl); - @Modifying @Query(value = "UPDATE pages SET immutable = true WHERE page_id = ?", nativeQuery = true) void setPageImmutable(long pageId); @@ -31,24 +20,4 @@ JOIN views USING (view_id) JOIN collections c using (collection_id) WHERE c.name = :collectionName); """, nativeQuery = true) void markAllPagesImmutableByCollectionName(String collectionName); - - @Query(value = "SELECT p.id as fragmentId, COUNT(*) AS size, r.toPage.id AS toPage, p.immutable AS immutable, " + - "p.expiration AS expiration, " + - "p.bucket.bucketId AS bucketId, p.partialUrl AS partialUrl " + - "FROM PageEntity p JOIN BucketEntity b ON p.bucket = b JOIN ViewEntity v ON b.view = v JOIN PageRelationEntity r ON p = r.fromPage " + - "WHERE v.eventStream.name = :collectionName AND v.name = :viewName " + - "GROUP BY p.id, r.toPage.id " + - "HAVING COUNT(*) < :capacityPerPage") - @Transactional(readOnly = true) - List findCompactionCandidates(@Param("collectionName") String collectionName, - @Param("viewName") String viewName, - @Param("capacityPerPage") Integer capacityPerPage); - - @Modifying - @Query("DELETE FROM PageEntity p WHERE CAST(p.expiration AS timestamp) < CAST(:expiration AS timestamp)") - void deleteByExpirationBefore(@Param("expiration") LocalDateTime expiration); - - @Modifying - @Query("UPDATE PageEntity p SET p.expiration = :expiration WHERE p.id IN :ids") - void setDeleteTime(@Param("ids") List ids, @Param("expiration") LocalDateTime expiration); } \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageMemberEntityRepository.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageMemberEntityRepository.java index 19214a1dab..52672e49ee 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageMemberEntityRepository.java +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageMemberEntityRepository.java @@ -1,6 +1,5 @@ package be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.repository; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.projection.TreeMemberProjection; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.entity.PageEntity; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.entity.PageMemberEntity; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.entity.PageMemberId; @@ -13,8 +12,6 @@ import java.util.List; public interface PageMemberEntityRepository extends JpaRepository { - @Query("SELECT m.subject AS subject, m.model AS model, m.versionOf AS versionOf, m.timestamp AS timestamp FROM PageMemberEntity p JOIN p.member m WHERE p.page.id = :pageId") - List findAllMembersByPageId(long pageId); @Modifying @Query("UPDATE PageMemberEntity m SET m.page = (SELECT p FROM PageEntity p WHERE p.id = :newPageId) WHERE m.page.id IN (:pageIds)") @@ -49,5 +46,4 @@ public interface PageMemberEntityRepository extends JpaRepository findByBucketIdAndPageIdIsNullOrderByMemberId(long bucketId); - void deleteAllByBucket_View_EventStream_NameAndBucket_View_NameAndMember_IdIn(String collectionName, String viewName, List memberIds); } \ No newline at end of file diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageRelationEntityRepository.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageRelationEntityRepository.java index 7f4bf5f80e..ad590cf49f 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageRelationEntityRepository.java +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/repository/PageRelationEntityRepository.java @@ -2,34 +2,16 @@ import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.entity.PageRelationEntity; import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.entity.RelationId; -import be.vlaanderen.informatievlaanderen.ldes.server.pagination.postgres.projection.TreeRelationProjection; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import java.util.List; - public interface PageRelationEntityRepository extends JpaRepository { @Modifying @Query(value = """ INSERT INTO page_relations (from_page_id, to_page_id, relation_type) VALUES (?, ?, ?) + on conflict do nothing """, nativeQuery = true) void insertRelation(Long fromPageId, Long toPageId, String treeRelationType); - - @Modifying - @Query(value = """ - INSERT INTO page_relations (from_page_id, to_page_id, relation_type, value, value_type, path) - SELECT (SELECT page_id FROM pages WHERE partial_url = :fromPagePartialUrl), - (SELECT page_id FROM pages WHERE partial_url = :toPagePartialUrl), - :treeRelationType, :treeValue, :treeValueType, :treePath - """, nativeQuery = true) - void insertRelation(String fromPagePartialUrl, String toPagePartialUrl, String treeRelationType, String treeValue, String treeValueType, String treePath); - - List findDistinctByFromPageId(long pageId); - - @Modifying - @Query("UPDATE PageRelationEntity r SET r.toPage = ( SELECT p FROM PageEntity p WHERE p.id = :targetId ) " + - "WHERE r.toPage.id IN :ids OR r.fromPage.id IN : ids") - void updateToPageRelations(List ids, long targetId); } diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PaginationSteps.java b/ldes-server-infra-postgres/postgres-pagination-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PaginationSteps.java index 395bb21d35..ed78933c22 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PaginationSteps.java +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/PaginationSteps.java @@ -89,7 +89,7 @@ public void theOldPageHasAGenericRelationToTheNewPage() { private void saveMembers(List memberIds) { var collectionId = eventStreamEntityRepository.findAll().getFirst().getId(); String eventStream = "http://example.com/es"; - String sql = "INSERT INTO members (subject, collection_id, version_of, timestamp, transaction_id, member_model, old_id) VALUES (?,?,?,?,?,?,?)"; + String sql = "INSERT INTO members (subject, collection_id, version_of, timestamp, transaction_id, member_model) VALUES (?,?,?,?,?,?)"; final List batchArgs = memberIds.stream() diff --git a/ldes-server-infra-postgres/postgres-pagination-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/init-paged-test.sql b/ldes-server-infra-postgres/postgres-pagination-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/init-paged-test.sql index 47619a32aa..aeaeb9bd23 100644 --- a/ldes-server-infra-postgres/postgres-pagination-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/init-paged-test.sql +++ b/ldes-server-infra-postgres/postgres-pagination-repository/src/test/resources/be/vlaanderen/informatievlaanderen/ldes/server/pagination/postgres/init-paged-test.sql @@ -1,6 +1,6 @@ WITH new_collection AS ( - INSERT INTO collections (name, timestamp_path, version_of_path, create_versions, is_closed, skolemization_domain) - VALUES ('es', '', '', false, false, null) + INSERT INTO collections (name, timestamp_path, version_of_path, version_delimiter, is_closed, skolemization_domain) + VALUES ('es', '', '', NULL, false, null) RETURNING collection_id ), new_view AS ( diff --git a/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/repository/RetentionMemberEntityRepository.java b/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/repository/RetentionMemberEntityRepository.java deleted file mode 100644 index 972b3d34fa..0000000000 --- a/ldes-server-infra-postgres/postgres-retention-repository/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/retention/postgres/repository/RetentionMemberEntityRepository.java +++ /dev/null @@ -1,26 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server.retention.postgres.repository; - -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.entity.MemberEntity; -import be.vlaanderen.informatievlaanderen.ldes.server.ingest.postgres.projection.RetentionMemberProjection; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.stream.Stream; - -public interface RetentionMemberEntityRepository extends JpaRepository { - - void deleteAllByIdIn(List oldIds); - @Query("SELECT m FROM MemberEntity m JOIN ViewEntity v ON m.collection = v.eventStream JOIN PageMemberEntity pm ON pm.member = m WHERE v.name = :viewName AND v.eventStream.name = :collectionName AND CAST(m.timestamp as timestamp) < CAST(:timestamp as timestamp)") - Stream findAllByViewNameAndTimestampBefore(String viewName, String collectionName, LocalDateTime timestamp); - - @Query("SELECT m FROM MemberEntity m JOIN ViewEntity v ON m.collection = v.eventStream JOIN PageMemberEntity pm ON pm.member = m WHERE v.name = :viewName AND v.eventStream.name = :collectionName") - Stream findAllByViewName(String viewName, String collectionName); - - @Query("SELECT m.id AS id, m.versionOf AS versionOf, m.timestamp AS timestamp, CASE WHEN (SELECT COUNT(p.id) FROM PageMemberEntity p WHERE p.member.id = m.id) > 0 THEN true ELSE false END AS inView, m.isInEventSource AS inEventSource, c.name AS collectionName FROM MemberEntity m JOIN EventStreamEntity c ON m.collection = c WHERE c.name = :collectionName GROUP BY m.id, c.name") - List findAllByCollectionName(String collectionName); - - @Query("SELECT m.id AS id, m.versionOf AS versionOf, m.timestamp AS timestamp, CASE WHEN (SELECT COUNT(p.id) FROM PageMemberEntity p WHERE p.member.id = m.id) > 0 THEN true ELSE false END AS inView, m.isInEventSource AS inEventSource, c.name AS collectionName FROM MemberEntity m JOIN EventStreamEntity c ON m.collection = c WHERE c.name = :collectionName AND CAST(m.timestamp AS timestamp) < CAST(:timestamp as timestamp) GROUP BY m.id, c.name") - List findAllByCollectionNameAndTimestampBefore(String collectionName, LocalDateTime timestamp); -} diff --git a/ldes-server-port-ingest/pom.xml b/ldes-server-ingest/ldes-server-ingest-common/pom.xml similarity index 93% rename from ldes-server-port-ingest/pom.xml rename to ldes-server-ingest/ldes-server-ingest-common/pom.xml index dab0a9b4d3..2813270599 100644 --- a/ldes-server-port-ingest/pom.xml +++ b/ldes-server-ingest/ldes-server-ingest-common/pom.xml @@ -5,11 +5,11 @@ 4.0.0 be.vlaanderen.informatievlaanderen.vsds - ldes-server - 3.4.1-SNAPSHOT + ldes-server-ingest + 3.5.0-SNAPSHOT - ldes-server-port-ingest + ldes-server-ingest-common diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngester.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngester.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngester.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngester.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImpl.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImpl.java similarity index 87% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImpl.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImpl.java index 36e2a307a5..71272e4476 100644 --- a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImpl.java +++ b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImpl.java @@ -1,10 +1,10 @@ package be.vlaanderen.informatievlaanderen.ldes.server.ingest; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.ServerMetrics; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.collection.MemberExtractorCollection; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.entities.IngestedMember; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.extractor.MemberExtractor; +import be.vlaanderen.informatievlaanderen.ldes.server.ingest.metrics.IngestionMetricsService; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.repositories.MemberRepository; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.validation.MemberIngestValidator; import org.apache.jena.rdf.model.Model; @@ -22,17 +22,17 @@ public class MemberIngesterImpl implements MemberIngester { private final MemberIngestValidator validator; private final MemberRepository memberRepository; private final MemberExtractorCollection memberExtractorCollection; - private final ServerMetrics serverMetrics; + private final IngestionMetricsService ingestionMetricsService; private static final Logger log = LoggerFactory.getLogger(MemberIngesterImpl.class); public MemberIngesterImpl(MemberIngestValidator validator, MemberRepository memberRepository, MemberExtractorCollection memberExtractorCollection, - ServerMetrics serverMetrics) { + IngestionMetricsService ingestionMetricsService) { this.validator = validator; this.memberRepository = memberRepository; this.memberExtractorCollection = memberExtractorCollection; - this.serverMetrics = serverMetrics; + this.ingestionMetricsService = ingestionMetricsService; } @Override @@ -42,13 +42,13 @@ public boolean ingest(String collectionName, Model ingestedModel) { members.forEach(validator::validate); members.forEach(IngestedMember::removeTreeMember); - int ingestedMembersCount = memberRepository.insertAll(members).size(); + int ingestedMembersCount = memberRepository.insertAll(members); if (ingestedMembersCount != members.size()) { log.warn(DUPLICATE_MEMBERS_DETECTED); return false; } - serverMetrics.incrementIngestCount(collectionName, ingestedMembersCount); + ingestionMetricsService.incrementIngestCount(collectionName, ingestedMembersCount); members.forEach(member -> logSuccessfulMemberIngestion(member.getSubject())); return true; } diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollection.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollection.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollection.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollection.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollectionImpl.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollectionImpl.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollectionImpl.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollectionImpl.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/constants/IngestConstants.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/constants/IngestConstants.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/constants/IngestConstants.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/constants/IngestConstants.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/entities/IngestedMember.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/entities/IngestedMember.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/entities/IngestedMember.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/entities/IngestedMember.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/exceptions/MemberSubjectNotFoundException.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/exceptions/MemberSubjectNotFoundException.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/exceptions/MemberSubjectNotFoundException.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/exceptions/MemberSubjectNotFoundException.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/BaseMemberExtractor.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/BaseMemberExtractor.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/BaseMemberExtractor.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/BaseMemberExtractor.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberExtractor.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberExtractor.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberExtractor.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberExtractor.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberExtractorFactory.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberExtractorFactory.java similarity index 95% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberExtractorFactory.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberExtractorFactory.java index 42a08efbac..c968e2acc7 100644 --- a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberExtractorFactory.java +++ b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberExtractorFactory.java @@ -17,7 +17,7 @@ public static MemberExtractor createMemberExtractor(EventStream eventStream) { private static MemberExtractor getBaseMemberExtractor(EventStream eventStream) { if (eventStream.isVersionCreationEnabled()) { - return new StateObjectMemberExtractor(eventStream.getCollection()); + return new StateObjectMemberExtractor(eventStream.getCollection(), eventStream.getVersionDelimiter()); } return new VersionObjectMemberExtractor(eventStream.getCollection(), eventStream.getVersionOfPath(), eventStream.getTimestampPath()); } diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberModelExtractor.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberModelExtractor.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberModelExtractor.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberModelExtractor.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractor.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractor.java similarity index 81% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractor.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractor.java index af1d321cc3..494840b4d0 100644 --- a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractor.java +++ b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractor.java @@ -9,9 +9,11 @@ public class StateObjectMemberExtractor implements MemberExtractor { private final String collectionName; + private final String delimiter; - public StateObjectMemberExtractor(String collectionName) { + public StateObjectMemberExtractor(String collectionName, String delimiter) { this.collectionName = collectionName; + this.delimiter = delimiter; } @Override @@ -20,7 +22,7 @@ public List extractMembers(Model ingestedModel) { final LocalDateTime ingestedTimestamp = LocalDateTime.now(); return MemberModelExtractor.initialize(ingestedModel).extractAllMemberModels().stream() - .map(memberModel -> memberModel.mapToMember(collectionName, ingestedTimestamp, txId)) + .map(memberModel -> memberModel.mapToMember(collectionName, delimiter, ingestedTimestamp, txId)) .toList(); } } diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/VersionObjectMemberExtractor.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/VersionObjectMemberExtractor.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/VersionObjectMemberExtractor.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/VersionObjectMemberExtractor.java diff --git a/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/metrics/IngestionMetricsService.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/metrics/IngestionMetricsService.java new file mode 100644 index 0000000000..c8d54ff1bf --- /dev/null +++ b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/metrics/IngestionMetricsService.java @@ -0,0 +1,67 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.ingest.metrics; + +import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamCreatedEvent; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamDeletedEvent; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.ViewInitializationEvent; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.MemberMetricsRepository; +import io.micrometer.core.instrument.Metrics; +import io.micrometer.core.instrument.Tags; +import io.micrometer.core.instrument.config.MeterFilter; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; + +@Component +public class IngestionMetricsService { + public static final String INGEST = "ldes_server_ingested_members_count"; + public static final String COLLECTION = "collection"; + private final MemberMetricsRepository memberMetricsRepository; + private final Map membersIngested = new HashMap<>(); + + public IngestionMetricsService(MemberMetricsRepository memberMetricsRepository) { + this.memberMetricsRepository = memberMetricsRepository; + Metrics.globalRegistry.config() + .meterFilter(MeterFilter.denyNameStartsWith("spring.batch.item")) + .meterFilter(MeterFilter.denyNameStartsWith("spring.batch.chunk")); + } + + public synchronized void incrementIngestCount(String collection, int count) { + membersIngested.computeIfAbsent(collection, s -> + Metrics.gauge(INGEST, Tags.of(COLLECTION, collection), + new AtomicInteger(0))); + membersIngested.get(collection).addAndGet(count); + } + + public synchronized void resetIngestCount(String collection) { + membersIngested.computeIfAbsent(collection, s -> + Metrics.gauge(INGEST, Tags.of(COLLECTION, collection), + new AtomicInteger(0))); + membersIngested.get(collection).set(0); + } + + public synchronized void updateIngestCount(String collection) { + int count = memberMetricsRepository.getTotalCount(collection); + membersIngested.computeIfAbsent(collection, s -> + Metrics.gauge(INGEST, Tags.of(COLLECTION, collection), + new AtomicInteger(count))); + membersIngested.get(collection).set(count); + } + + @EventListener + public void handleEvenStreamCreated(EventStreamCreatedEvent event){ + resetIngestCount(event.eventStream().getCollection()); + } + + @EventListener + public void handleEventStreamDeletedEvent(EventStreamDeletedEvent event) { + resetIngestCount(event.collectionName()); + } + + @EventListener + public void handleViewCreatedEvent(ViewInitializationEvent event) { + updateIngestCount(event.getViewName().getCollectionName()); + } +} diff --git a/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/repositories/MemberRepository.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/repositories/MemberRepository.java new file mode 100644 index 0000000000..486409bee8 --- /dev/null +++ b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/repositories/MemberRepository.java @@ -0,0 +1,14 @@ +package be.vlaanderen.informatievlaanderen.ldes.server.ingest.repositories; + +import be.vlaanderen.informatievlaanderen.ldes.server.ingest.entities.IngestedMember; + +import java.util.List; +import java.util.stream.Stream; + +public interface MemberRepository { + int insertAll(List members); + + Stream findAllByCollectionAndSubject(String collectionName, List subjects); + + void deleteMembersByCollectionNameAndSubjects(String collectionName, List subjects); +} diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedMemberExtractor.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedMemberExtractor.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedMemberExtractor.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedMemberExtractor.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModel.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModel.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModel.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModel.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/StatementBuilder.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/StatementBuilder.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/StatementBuilder.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/StatementBuilder.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/MemberIngestValidator.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/MemberIngestValidator.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/MemberIngestValidator.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/MemberIngestValidator.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/MemberIngestValidatorImpl.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/MemberIngestValidatorImpl.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/MemberIngestValidatorImpl.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/MemberIngestValidatorImpl.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ModelIngestValidatorFactory.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ModelIngestValidatorFactory.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ModelIngestValidatorFactory.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ModelIngestValidatorFactory.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ValidationConfig.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ValidationConfig.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ValidationConfig.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ValidationConfig.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/EmptyValidator.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/EmptyValidator.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/EmptyValidator.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/EmptyValidator.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ModelIngestValidator.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ModelIngestValidator.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ModelIngestValidator.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ModelIngestValidator.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ShaclModelValidator.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ShaclModelValidator.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ShaclModelValidator.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ShaclModelValidator.java diff --git a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/valueobjects/MemberModel.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/valueobjects/MemberModel.java similarity index 82% rename from ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/valueobjects/MemberModel.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/valueobjects/MemberModel.java index 9f79aa5b85..3663686ae7 100644 --- a/ldes-server-port-ingest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/valueobjects/MemberModel.java +++ b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/valueobjects/MemberModel.java @@ -6,7 +6,6 @@ import java.time.LocalDateTime; public class MemberModel { - private static final String DELIMITER = "/"; private final String subjectUri; private final Model model; @@ -23,8 +22,8 @@ public Model getModel() { return model; } - public IngestedMember mapToMember(String collectionName, LocalDateTime ingestedTimestamp, String txId) { - final String memberSubject = "%s%s%s".formatted(subjectUri, DELIMITER, ingestedTimestamp); + public IngestedMember mapToMember(String collectionName, String delimiter, LocalDateTime ingestedTimestamp, String txId) { + final String memberSubject = "%s%s%s".formatted(subjectUri, delimiter, ingestedTimestamp); return new IngestedMember( memberSubject, collectionName, diff --git a/ldes-server-port-ingest/src/main/java/module-info.java b/ldes-server-ingest/ldes-server-ingest-common/src/main/java/module-info.java similarity index 100% rename from ldes-server-port-ingest/src/main/java/module-info.java rename to ldes-server-ingest/ldes-server-ingest-common/src/main/java/module-info.java diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImplTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImplTest.java similarity index 89% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImplTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImplTest.java index daa83ebe0d..21b534207d 100644 --- a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImplTest.java +++ b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/MemberIngesterImplTest.java @@ -1,13 +1,12 @@ package be.vlaanderen.informatievlaanderen.ldes.server.ingest; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.FragmentationMetricsRepository; import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.MemberMetricsRepository; -import be.vlaanderen.informatievlaanderen.ldes.server.domain.services.ServerMetrics; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.collection.MemberExtractorCollection; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.collection.MemberExtractorCollectionImpl; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.entities.IngestedMember; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.extractor.MemberExtractor; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.extractor.VersionObjectMemberExtractor; +import be.vlaanderen.informatievlaanderen.ldes.server.ingest.metrics.IngestionMetricsService; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.repositories.MemberRepository; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.validation.MemberIngestValidator; import io.micrometer.core.instrument.Gauge; @@ -54,8 +53,8 @@ void setUp() { Metrics.globalRegistry.add(meterRegistry); MemberExtractorCollection memberExtractorCollection = new MemberExtractorCollectionImpl(); - ServerMetrics serverMetrics = new ServerMetrics(mock(FragmentationMetricsRepository.class), mock(MemberMetricsRepository.class)); - memberIngestService = new MemberIngesterImpl(validator, memberRepository, memberExtractorCollection, serverMetrics); + IngestionMetricsService ingestionMetricsService = new IngestionMetricsService(mock(MemberMetricsRepository.class)); + memberIngestService = new MemberIngesterImpl(validator, memberRepository, memberExtractorCollection, ingestionMetricsService); final MemberExtractor memberExtractor = new VersionObjectMemberExtractor(COLLECTION_NAME, "http://purl.org/dc/terms/isVersionOf", "http://www.w3.org/ns/prov#generatedAtTime"); memberExtractorCollection.addMemberExtractor(COLLECTION_NAME, memberExtractor); @@ -74,7 +73,7 @@ void whenValidatorThrowsAnException_thenTheIngestIsAborted_andTheExceptionIsThro var exception = assertThrows(RuntimeException.class, () -> memberIngestService.ingest(COLLECTION_NAME, model)); assertEquals("testException", exception.getMessage()); - var counter = meterRegistry.find(ServerMetrics.INGEST).counter(); + var counter = meterRegistry.find(IngestionMetricsService.INGEST).counter(); assertThat(counter).isNull(); verifyNoInteractions(memberRepository); } @@ -87,12 +86,12 @@ void when_TheMemberAlreadyExists_thenEmptyOptionalIsReturned() { MEMBER_SUBJECT, COLLECTION_NAME, VERSION_OF, TIMESTAMP, true, "txId", model); - when(memberRepository.insertAll(List.of(member))).thenReturn(List.of()); + when(memberRepository.insertAll(List.of(member))).thenReturn(0); boolean memberIngested = memberIngestService.ingest(COLLECTION_NAME, model); assertThat(memberIngested).isFalse(); - var counter = meterRegistry.find(ServerMetrics.INGEST).counter(); + var counter = meterRegistry.find(IngestionMetricsService.INGEST).counter(); assertThat(counter).isNull(); verify(memberRepository, times(1)).insertAll(List.of(member)); } @@ -105,12 +104,12 @@ void when_TheMemberDoesNotAlreadyExists_thenMemberIsStored() { MEMBER_SUBJECT, COLLECTION_NAME, VERSION_OF, TIMESTAMP, true, "txId", model); - when(memberRepository.insertAll(List.of(member))).thenReturn(List.of(member)); + when(memberRepository.insertAll(List.of(member))).thenReturn(1); boolean memberIngested = memberIngestService.ingest(COLLECTION_NAME, model); assertThat(memberIngested).isTrue(); - Gauge counter = meterRegistry.find(ServerMetrics.INGEST).gauge(); + Gauge counter = meterRegistry.find(IngestionMetricsService.INGEST).gauge(); assertThat(counter).isNotNull(); assertThat(counter.value()).isEqualTo(1); InOrder inOrder = inOrder(memberRepository); diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollectionImplTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollectionImplTest.java similarity index 89% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollectionImplTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollectionImplTest.java index eee58ec3ba..92563672fc 100644 --- a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollectionImplTest.java +++ b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/collection/MemberExtractorCollectionImplTest.java @@ -3,6 +3,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamCreatedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamDeletedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.VersionCreationProperties; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.extractor.MemberExtractor; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.extractor.StateObjectMemberExtractor; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.extractor.VersionObjectMemberExtractor; @@ -17,6 +18,8 @@ class MemberExtractorCollectionImplTest { private static final String COLLECTION_NAME = "collection"; + public static final String TIMESTAMP_PATH = "timestampPath"; + public static final String VERSION_OF_PATH = "versionOfPath"; private MemberExtractorCollectionImpl memberExtractorCollection; private MemberExtractor memberExtractor; @@ -56,7 +59,7 @@ void test_HandleEventStreamDeletedEvent() { @Test void test_HandleVersionObjectEventStreamCreatedEvent() { - final EventStream eventStream = new EventStream(COLLECTION_NAME, "timestampPath", "versionOfPath", false); + final EventStream eventStream = new EventStream(COLLECTION_NAME, TIMESTAMP_PATH, VERSION_OF_PATH, VersionCreationProperties.disabled()); memberExtractorCollection.handleEventStreamCreatedEvent(new EventStreamCreatedEvent(eventStream)); @@ -66,7 +69,7 @@ void test_HandleVersionObjectEventStreamCreatedEvent() { @Test void test_HandleStateObjectEventStreamCreatedEvent() { - final EventStream eventStream = new EventStream(COLLECTION_NAME, "timestampPath", "versionOfPath", true); + final EventStream eventStream = new EventStream(COLLECTION_NAME, TIMESTAMP_PATH, VERSION_OF_PATH, VersionCreationProperties.enabledWithDefault()); memberExtractorCollection.handleEventStreamCreatedEvent(new EventStreamCreatedEvent(eventStream)); @@ -76,7 +79,7 @@ void test_HandleStateObjectEventStreamCreatedEvent() { @Test void test_HandleStateObjectSkolemizationDomeinEventStreamCreatedEvent() { - final EventStream eventStream = new EventStream(COLLECTION_NAME, "timestampPath", "versionOfPath", true, "http://example.org"); + final EventStream eventStream = new EventStream(COLLECTION_NAME, TIMESTAMP_PATH, VERSION_OF_PATH, VersionCreationProperties.enabledWithDefault(), "http://example.org"); memberExtractorCollection.handleEventStreamCreatedEvent(new EventStreamCreatedEvent(eventStream)); @@ -97,7 +100,7 @@ void test_HandleStateObjectSkolemizationDomeinEventStreamCreatedEvent() { @Test void test_HandleVersionObjectsSkolemizationDomeinEventStreamCreatedEvent() { - final EventStream eventStream = new EventStream(COLLECTION_NAME, "timestampPath", "versionOfPath", false, "http://example.org"); + final EventStream eventStream = new EventStream(COLLECTION_NAME, "timestampPath", "versionOfPath", VersionCreationProperties.disabled(), "http://example.org"); memberExtractorCollection.handleEventStreamCreatedEvent(new EventStreamCreatedEvent(eventStream)); diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/entities/MemberTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/entities/MemberTest.java similarity index 100% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/entities/MemberTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/entities/MemberTest.java diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberModelExtractorTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberModelExtractorTest.java similarity index 100% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberModelExtractorTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/MemberModelExtractorTest.java diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractorTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractorTest.java similarity index 55% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractorTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractorTest.java index 30c4805e20..c46ef93090 100644 --- a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractorTest.java +++ b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/StateObjectMemberExtractorTest.java @@ -4,8 +4,9 @@ import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFParser; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import java.time.LocalDateTime; import java.util.List; @@ -16,13 +17,10 @@ class StateObjectMemberExtractorTest { private StateObjectMemberExtractor stateObjectMemberExtractor; - @BeforeEach - void setUp() { - stateObjectMemberExtractor = new StateObjectMemberExtractor("simpsons"); - } - @Test void test_memberExtraction() { + stateObjectMemberExtractor = new StateObjectMemberExtractor("simpsons", "/"); + final Model ingestedModel = RDFParser.source("bulk-members/simpsons/all.nq").lang(Lang.NQ).toModel(); List members = stateObjectMemberExtractor.extractMembers(ingestedModel); @@ -41,6 +39,30 @@ void test_memberExtraction() { assertThat(members) .map(IngestedMember::getSubject) .containsExactlyInAnyOrderElementsOf(expectedMemberIds); + } + + @ParameterizedTest(name = "delimiter=\"{0}\"") + @ValueSource(strings = {"/", "?version="}) + void test_memberExtraction(String delimiter) { + stateObjectMemberExtractor = new StateObjectMemberExtractor("simpsons", delimiter); + + final Model ingestedModel = RDFParser.source("bulk-members/simpsons/all.nq").lang(Lang.NQ).toModel(); + + List members = stateObjectMemberExtractor.extractMembers(ingestedModel); + + List txIds = members.stream().map(IngestedMember::getTransactionId).distinct().toList(); + assertThat(txIds).hasSize(1); + + List ingestedTimestamps = members.stream().map(IngestedMember::getTimestamp).distinct().toList(); + assertThat(ingestedTimestamps).hasSize(1); + final List expectedMemberIds = Stream.of("bart", "lisa", "homer") + .map(memberIdPart -> "http://temporary.org#%s%s%s".formatted(memberIdPart, delimiter, ingestedTimestamps.getFirst().toString())) + .toList(); + + + assertThat(members) + .map(IngestedMember::getSubject) + .containsExactlyInAnyOrderElementsOf(expectedMemberIds); } } \ No newline at end of file diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/VersionObjectMemberExtractorTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/VersionObjectMemberExtractorTest.java similarity index 94% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/VersionObjectMemberExtractorTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/VersionObjectMemberExtractorTest.java index e4f97f644a..4295d14e2c 100644 --- a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/VersionObjectMemberExtractorTest.java +++ b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/extractor/VersionObjectMemberExtractorTest.java @@ -88,19 +88,19 @@ private Model readModelWithTwoVersionOfPaths() throws IOException { final List lines = readContentFromFile(); lines.add(" .\n"); final String modelString = String.join("\n", lines); - return RDFParser.fromString(modelString).lang(Lang.NQ).toModel(); + return RDFParser.create().fromString(modelString).lang(Lang.NQ).toModel(); } private Model readModelWithoutSpecifiedPath(String path) throws IOException { final String modelString = readContentFromFile().stream() .filter(line -> !line.contains(path)) .collect(Collectors.joining("\n")); - return RDFParser.fromString(modelString).lang(Lang.NQ).toModel(); + return RDFParser.create().fromString(modelString).lang(Lang.NQ).toModel(); } private Model readValidModel() throws IOException { final String modelString = String.join("\n", readContentFromFile()); - return RDFParser.fromString(modelString).lang(Lang.NQ).toModel(); + return RDFParser.create().fromString(modelString).lang(Lang.NQ).toModel(); } private List readContentFromFile() throws IOException { diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedMemberExtractorTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedMemberExtractorTest.java similarity index 100% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedMemberExtractorTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedMemberExtractorTest.java diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModelAssert.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModelAssert.java similarity index 100% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModelAssert.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModelAssert.java diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModelTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModelTest.java similarity index 100% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModelTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/skolemization/SkolemizedModelTest.java diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/MemberIngestValidatorImplTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/MemberIngestValidatorImplTest.java similarity index 100% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/MemberIngestValidatorImplTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/MemberIngestValidatorImplTest.java diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ModelIngestValidatorFactoryTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ModelIngestValidatorFactoryTest.java similarity index 100% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ModelIngestValidatorFactoryTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ModelIngestValidatorFactoryTest.java diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ValidationConfigTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ValidationConfigTest.java similarity index 100% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ValidationConfigTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/ValidationConfigTest.java diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/EmptyValidatorTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/EmptyValidatorTest.java similarity index 100% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/EmptyValidatorTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/EmptyValidatorTest.java diff --git a/ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ShaclModelValidatorTest.java b/ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ShaclModelValidatorTest.java similarity index 100% rename from ldes-server-port-ingest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ShaclModelValidatorTest.java rename to ldes-server-ingest/ldes-server-ingest-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/validation/defaultimpl/modelingestvalidator/ShaclModelValidatorTest.java diff --git a/ldes-server-port-ingest/src/test/resources/bulk-members/people/a-person.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/people/a-person.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/bulk-members/people/a-person.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/people/a-person.nq diff --git a/ldes-server-port-ingest/src/test/resources/bulk-members/people/b-person.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/people/b-person.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/bulk-members/people/b-person.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/people/b-person.nq diff --git a/ldes-server-port-ingest/src/test/resources/bulk-members/people/multiple.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/people/multiple.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/bulk-members/people/multiple.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/people/multiple.nq diff --git a/ldes-server-port-ingest/src/test/resources/bulk-members/simpsons/all.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/simpsons/all.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/bulk-members/simpsons/all.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/simpsons/all.nq diff --git a/ldes-server-port-ingest/src/test/resources/bulk-members/simpsons/bart.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/simpsons/bart.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/bulk-members/simpsons/bart.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/simpsons/bart.nq diff --git a/ldes-server-port-ingest/src/test/resources/bulk-members/simpsons/homer.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/simpsons/homer.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/bulk-members/simpsons/homer.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/simpsons/homer.nq diff --git a/ldes-server-port-ingest/src/test/resources/bulk-members/simpsons/lisa.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/simpsons/lisa.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/bulk-members/simpsons/lisa.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/simpsons/lisa.nq diff --git a/ldes-server-port-ingest/src/test/resources/bulk-members/single-member-with-nested-bnodes.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/single-member-with-nested-bnodes.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/bulk-members/single-member-with-nested-bnodes.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/bulk-members/single-member-with-nested-bnodes.nq diff --git a/ldes-server-port-ingest/src/test/resources/example-ldes-member.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/example-ldes-member.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/example-ldes-member.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/example-ldes-member.nq diff --git a/ldes-server-port-ingest/src/test/resources/member-with-nested-isversionof-bnodes.ttl b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/member-with-nested-isversionof-bnodes.ttl similarity index 100% rename from ldes-server-port-ingest/src/test/resources/member-with-nested-isversionof-bnodes.ttl rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/member-with-nested-isversionof-bnodes.ttl diff --git a/ldes-server-port-ingest/src/test/resources/skolemization/activity.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/skolemization/activity.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/skolemization/activity.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/skolemization/activity.nq diff --git a/ldes-server-port-ingest/src/test/resources/skolemization/mob-hind-member.ttl b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/skolemization/mob-hind-member.ttl similarity index 100% rename from ldes-server-port-ingest/src/test/resources/skolemization/mob-hind-member.ttl rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/skolemization/mob-hind-member.ttl diff --git a/ldes-server-port-ingest/src/test/resources/skolemization/skolemized-product.nq b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/skolemization/skolemized-product.nq similarity index 100% rename from ldes-server-port-ingest/src/test/resources/skolemization/skolemized-product.nq rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/skolemization/skolemized-product.nq diff --git a/ldes-server-port-ingest/src/test/resources/validation/example-data-invalid.ttl b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/validation/example-data-invalid.ttl similarity index 100% rename from ldes-server-port-ingest/src/test/resources/validation/example-data-invalid.ttl rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/validation/example-data-invalid.ttl diff --git a/ldes-server-port-ingest/src/test/resources/validation/example-data.ttl b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/validation/example-data.ttl similarity index 100% rename from ldes-server-port-ingest/src/test/resources/validation/example-data.ttl rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/validation/example-data.ttl diff --git a/ldes-server-port-ingest/src/test/resources/validation/example-shape.ttl b/ldes-server-ingest/ldes-server-ingest-common/src/test/resources/validation/example-shape.ttl similarity index 100% rename from ldes-server-port-ingest/src/test/resources/validation/example-shape.ttl rename to ldes-server-ingest/ldes-server-ingest-common/src/test/resources/validation/example-shape.ttl diff --git a/ldes-server-port-ingest-rest/pom.xml b/ldes-server-ingest/ldes-server-ingest-rest/pom.xml similarity index 80% rename from ldes-server-port-ingest-rest/pom.xml rename to ldes-server-ingest/ldes-server-ingest-rest/pom.xml index d58372d091..38761e76fb 100644 --- a/ldes-server-port-ingest-rest/pom.xml +++ b/ldes-server-ingest/ldes-server-ingest-rest/pom.xml @@ -5,21 +5,17 @@ 4.0.0 be.vlaanderen.informatievlaanderen.vsds - ldes-server - 3.4.1-SNAPSHOT + ldes-server-ingest + 3.5.0-SNAPSHOT - ldes-server-port-ingest-rest + ldes-server-ingest-rest be.vlaanderen.informatievlaanderen.vsds - ldes-server-domain - - - be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-ingest + ldes-server-ingest-common ${project.version} diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/MemberIngestController.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/MemberIngestController.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/MemberIngestController.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/MemberIngestController.java diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/OpenApiMemberIngestController.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/OpenApiMemberIngestController.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/OpenApiMemberIngestController.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/OpenApiMemberIngestController.java diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/collection/VersionOfPathCollection.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/collection/VersionOfPathCollection.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/collection/VersionOfPathCollection.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/collection/VersionOfPathCollection.java diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/converters/IngestedModelConverter.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/converters/IngestedModelConverter.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/converters/IngestedModelConverter.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/converters/IngestedModelConverter.java diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/exception/IngestionRestResponseEntityExceptionHandler.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/exception/IngestionRestResponseEntityExceptionHandler.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/exception/IngestionRestResponseEntityExceptionHandler.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/exception/IngestionRestResponseEntityExceptionHandler.java diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/exception/MemberIdNotFoundException.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/exception/MemberIdNotFoundException.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/exception/MemberIdNotFoundException.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/exception/MemberIdNotFoundException.java diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/IngestValidator.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/IngestValidator.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/IngestValidator.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/IngestValidator.java diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/BlankNodesValidator.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/BlankNodesValidator.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/BlankNodesValidator.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/BlankNodesValidator.java diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/IngestReportValidator.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/IngestReportValidator.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/IngestReportValidator.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/IngestReportValidator.java diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/PathsValidator.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/PathsValidator.java similarity index 88% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/PathsValidator.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/PathsValidator.java index d9aee7dc60..5c47edfbfd 100644 --- a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/PathsValidator.java +++ b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/PathsValidator.java @@ -1,13 +1,13 @@ package be.vlaanderen.informatievlaanderen.ldes.server.ingest.rest.validators.ingestreportvalidator; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.datatypes.xsd.XSDDatatype; import org.apache.jena.rdf.model.*; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import java.util.List; -import java.util.Objects; @Order(2) @Component @@ -18,7 +18,6 @@ public void validate(Model model, EventStream eventStream, ShaclReportManager re List memberSubjects = model.listSubjects().filterDrop(RDFNode::isAnon).toList(); if (memberSubjects.size() > 1 && !eventStream.isVersionCreationEnabled()) { - // To be removed when bulk ingest is allowed when version creation is disabled memberSubjects.forEach(subject -> reportManager.addEntry(subject, "Only 1 member is allowed per request on collection with version creation disabled" ) @@ -31,6 +30,7 @@ public void validate(Model model, EventStream eventStream, ShaclReportManager re private void validateTimestampPath(List memberSubjects, Model model, EventStream eventStream, ShaclReportManager reportManager) { int expectedNumber = eventStream.isVersionCreationEnabled() ? 0 : 1; + List validTypes = List.of(XSDDatatype.XSDdateTime, XSDDatatype.XSDstring); memberSubjects.forEach(subject -> { List timestampStatements = getStatementsOfPath(subject, model, eventStream.getTimestampPath()); if (timestampStatements.size() != expectedNumber) { @@ -40,9 +40,9 @@ private void validateTimestampPath(List memberSubjects, Model model, E } timestampStatements.forEach(statement -> { - if (!statement.getObject().isLiteral() || !Objects.equals(statement.getObject().asLiteral().getDatatype(), XSDDatatype.XSDdateTime)) { + if (!statement.getObject().isLiteral() || !validTypes.contains(statement.getLiteral().getDatatype())) { reportManager.addEntry(subject, - String.format(String.format("Object of statement with predicate: %s should be a literal of type %s", eventStream.getTimestampPath(), XSDDatatype.XSDdateTime.getURI())) + String.format(String.format("Object of statement with predicate: %s should be a literal either of type %s or %s", eventStream.getTimestampPath(), XSDDatatype.XSDdateTime.getURI(), XSDDatatype.XSDstring.getURI())) ); } }); diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/ShaclReportManager.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/ShaclReportManager.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/ShaclReportManager.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/ingestreportvalidator/ShaclReportManager.java diff --git a/ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/memberingestvalidator/MemberIngestValidator.java b/ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/memberingestvalidator/MemberIngestValidator.java similarity index 100% rename from ldes-server-port-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/memberingestvalidator/MemberIngestValidator.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/main/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/memberingestvalidator/MemberIngestValidator.java diff --git a/ldes-server-port-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/MemberIngestControllerTest.java b/ldes-server-ingest/ldes-server-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/MemberIngestControllerTest.java similarity index 97% rename from ldes-server-port-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/MemberIngestControllerTest.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/MemberIngestControllerTest.java index b247eadaf2..48d276b2b0 100644 --- a/ldes-server-port-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/MemberIngestControllerTest.java +++ b/ldes-server-ingest/ldes-server-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/MemberIngestControllerTest.java @@ -5,6 +5,7 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.MissingResourceException; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.ShaclValidationException; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.VersionCreationProperties; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.MemberIngester; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.rest.converters.IngestedModelConverter; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.rest.exception.IngestionRestResponseEntityExceptionHandler; @@ -68,8 +69,8 @@ class MemberIngestControllerTest { @BeforeEach void setUp() { Stream.of( - new EventStream("mobility-hindrances", "http://www.w3.org/ns/prov#generatedAtTime", "http://purl.org/dc/terms/isVersionOf", false), - new EventStream("restaurant", "http://www.w3.org/ns/prov#generatedAtTime", "https://vocabulary.uncefact.org/elementVersionId", false)) + new EventStream("mobility-hindrances", "http://www.w3.org/ns/prov#generatedAtTime", "http://purl.org/dc/terms/isVersionOf", VersionCreationProperties.disabled()), + new EventStream("restaurant", "http://www.w3.org/ns/prov#generatedAtTime", "https://vocabulary.uncefact.org/elementVersionId", VersionCreationProperties.disabled())) .map(EventStreamCreatedEvent::new) .forEach(eventPublisher::publishEvent); } @@ -186,7 +187,6 @@ public Stream provideArguments(ExtensionContext context) { Arguments.of("text/plain", Lang.NTRIPLES), Arguments.of("application/rdf+xml", Lang.RDFXML), Arguments.of("x/ld-json-11", Lang.JSONLD11), - Arguments.of("x/ld-json-10", Lang.JSONLD10), Arguments.of("text/rdf+n3", Lang.N3), Arguments.of("application/trix", Lang.TRIX), Arguments.of("text/turtle", Lang.TURTLE), diff --git a/ldes-server-port-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/memberingestvalidator/MemberIngestValidatorTest.java b/ldes-server-ingest/ldes-server-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/memberingestvalidator/MemberIngestValidatorTest.java similarity index 87% rename from ldes-server-port-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/memberingestvalidator/MemberIngestValidatorTest.java rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/memberingestvalidator/MemberIngestValidatorTest.java index ae46db4cb2..aa57a3e177 100644 --- a/ldes-server-port-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/memberingestvalidator/MemberIngestValidatorTest.java +++ b/ldes-server-ingest/ldes-server-ingest-rest/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/ingest/rest/validators/memberingestvalidator/MemberIngestValidatorTest.java @@ -4,11 +4,13 @@ import be.vlaanderen.informatievlaanderen.ldes.server.domain.events.admin.EventStreamCreatedEvent; import be.vlaanderen.informatievlaanderen.ldes.server.domain.exceptions.ShaclValidationException; import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.EventStream; +import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.VersionCreationProperties; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.rest.validators.ingestreportvalidator.BlankNodesValidator; import be.vlaanderen.informatievlaanderen.ldes.server.ingest.rest.validators.ingestreportvalidator.PathsValidator; import org.apache.jena.datatypes.xsd.XSDDatatype; import org.apache.jena.rdf.model.Model; import org.apache.jena.riot.RDFDataMgr; +import org.assertj.core.api.Condition; import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -36,9 +38,9 @@ class MemberIngestValidatorTest { void setup() { validator = new MemberIngestValidator(List.of(new BlankNodesValidator(), new PathsValidator())); validator.handleEventStreamInitEvent(new EventStreamCreatedEvent( - new EventStream(STATE, TIMESTAMP_PATH, VERSIONOF_PATH, true))); + new EventStream(STATE, TIMESTAMP_PATH, VERSIONOF_PATH, VersionCreationProperties.enabledWithDefault()))); validator.handleEventStreamInitEvent(new EventStreamCreatedEvent( - new EventStream(VERSION,TIMESTAMP_PATH, VERSIONOF_PATH, false))); + new EventStream(VERSION,TIMESTAMP_PATH, VERSIONOF_PATH, VersionCreationProperties.disabled()))); } @ParameterizedTest(name = "Receiving incorrect member {0}") @@ -46,7 +48,7 @@ void setup() { void when_IncorrectMemberReceived_Then_ValidationThrowsException(String modelName, String collectionName, List expectedMessages) { Model model = RDFDataMgr.loadModel(modelName); String actualMessage = assertThrows(ShaclValidationException.class, () -> validator.validate(model, collectionName)).getMessage(); - expectedMessages.forEach(expectedMessage -> assertTrue(actualMessage.contains(expectedMessage))); + assertThat(actualMessage).has(errorMessages(expectedMessages)); } @ParameterizedTest @@ -68,7 +70,7 @@ void when_EventStreamClosedEvent_validationThrowsException(Model model, String c @Test void when_EventStreamInit_Then_EventstreamAddedToMap() { - EventStream stream = new EventStream("new", TIMESTAMP_PATH, VERSIONOF_PATH, false); + EventStream stream = new EventStream("new", TIMESTAMP_PATH, VERSIONOF_PATH, null); validator.handleEventStreamInitEvent(new EventStreamCreatedEvent(stream)); @@ -79,7 +81,7 @@ void when_EventStreamInit_Then_EventstreamAddedToMap() { @Test void when_ClosedEventStreamInit_Then_EventstreamAddedToMap() { - EventStream stream = new EventStream("closed", TIMESTAMP_PATH, VERSIONOF_PATH, false, true, null); + EventStream stream = new EventStream("closed", TIMESTAMP_PATH, VERSIONOF_PATH, VersionCreationProperties.disabled(), true, null); validator.handleEventStreamInitEvent(new EventStreamCreatedEvent(stream)); @@ -110,7 +112,7 @@ public Stream provideArguments(ExtensionContext extensionCo Arguments.of("example-ldes-member-wrong-type-version-of.nq", VERSION, List.of("Object of statement with predicate: " + VERSIONOF_PATH + " should be a resource")), Arguments.of("example-ldes-member-wrong-type-timestamp.nq", VERSION, - List.of("Object of statement with predicate: " + TIMESTAMP_PATH + " should be a literal of type " + XSDDatatype.XSDdateTime.getURI())), + List.of("Object of statement with predicate: " + TIMESTAMP_PATH + " should be a literal either of type " + XSDDatatype.XSDdateTime.getURI() + " or " + XSDDatatype.XSDstring.getURI())), Arguments.of("example-ldes-member-dangling-nodes.nq", VERSION, List.of("Object graphs don't allow blank nodes to occur outside of a named object.")), Arguments.of("example-ldes-member-blank-node.nq", VERSION, List.of("Object graphs don't allow blank nodes to occur outside of a named object.")), Arguments.of("example-ldes-member-shared-blank-node.nq", VERSION, List.of("Blank nodes must be scoped to one object."))); @@ -122,7 +124,15 @@ static class CorrectMemberArgumentsProvider implements ArgumentsProvider { public Stream provideArguments(ExtensionContext extensionContext) { return Stream.of( Arguments.of(RDFDataMgr.loadModel("example-ldes-member-state.nq"), STATE), - Arguments.of(RDFDataMgr.loadModel("example-ldes-member.nq"), VERSION)); + Arguments.of(RDFDataMgr.loadModel("example-ldes-member-typeless-time.nq"), VERSION), + Arguments.of(RDFDataMgr.loadModel("example-ldes-member-string-time.nq"), VERSION), + Arguments.of(RDFDataMgr.loadModel("example-ldes-member.nq"), VERSION) + ); } } + + private Condition errorMessages(List expectedMessages) { + return new Condition<>(actual -> expectedMessages.stream().allMatch(actual::contains), "contained by %s".formatted(expectedMessages)); + } + } \ No newline at end of file diff --git a/ldes-server-port-ingest-rest/src/test/resources/application-test.yml b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/application-test.yml similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/application-test.yml rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/application-test.yml diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-complex-ldes-member.ttl b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-complex-ldes-member.ttl similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-complex-ldes-member.ttl rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-complex-ldes-member.ttl diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-blank-node.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-blank-node.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-blank-node.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-blank-node.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-dangling-nodes.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-dangling-nodes.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-dangling-nodes.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-dangling-nodes.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-multiple-version-ofs.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-multiple-version-ofs.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-multiple-version-ofs.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-multiple-version-ofs.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-shared-blank-node.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-shared-blank-node.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-shared-blank-node.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-shared-blank-node.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-state.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-state.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-state.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-state.nq diff --git a/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-string-time.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-string-time.nq new file mode 100644 index 0000000000..d29bd26b0e --- /dev/null +++ b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-string-time.nq @@ -0,0 +1,21 @@ + . + . + "2022-05-20T09:58:15.8610896Z"^^ . + "omschrijving" . + . + "2022-05-20T09:58:15.8646433Z"^^ . + . + _:genid1 . + "MobilityHindranceZoneWasAdded"@nl-be . + "2022-05-20T09:58:15.867Z"^^ . + . + . + _:genid2 . + . + "10810464"^^ . +_:genid1 . +_:genid1 "10810464"^^ . +_:genid1 "https://gipod.vlaanderen.be"@nl-be . +_:genid2 "2022-05-27T17:00:00Z"^^ . +_:genid2 "2022-05-27T07:00:00Z"^^ . +_:genid2 . \ No newline at end of file diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-wrong-type-timestamp.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-typeless-time.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-wrong-type-timestamp.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-typeless-time.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-versionOf-in-blank-node.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-versionOf-in-blank-node.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-versionOf-in-blank-node.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-versionOf-in-blank-node.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-with-multiple-nodes.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-with-multiple-nodes.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-with-multiple-nodes.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-with-multiple-nodes.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-without-id.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-without-id.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-without-id.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-without-id.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-without-root-timestamp.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-without-root-timestamp.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-without-root-timestamp.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-without-root-timestamp.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-without-timestamp.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-without-timestamp.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-without-timestamp.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-without-timestamp.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-without-version-of.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-without-version-of.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-without-version-of.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-without-version-of.nq diff --git a/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-wrong-type-timestamp.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-wrong-type-timestamp.nq new file mode 100644 index 0000000000..3bb7c0cb16 --- /dev/null +++ b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-wrong-type-timestamp.nq @@ -0,0 +1,21 @@ + . + . + "2022-05-20T09:58:15.8610896Z"^^ . + "omschrijving" . + . + "2022-05-20T09:58:15.8646433Z"^^ . + . + _:genid1 . + "MobilityHindranceZoneWasAdded"@nl-be . + "2022-05-20T09:58:15.867Z"^^ . + . + . + _:genid2 . + . + "10810464"^^ . +_:genid1 . +_:genid1 "10810464"^^ . +_:genid1 "https://gipod.vlaanderen.be"@nl-be . +_:genid2 "2022-05-27T17:00:00Z"^^ . +_:genid2 "2022-05-27T07:00:00Z"^^ . +_:genid2 . \ No newline at end of file diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-wrong-type-version-of.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-wrong-type-version-of.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member-wrong-type-version-of.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member-wrong-type-version-of.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/example-ldes-member.nq b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member.nq similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/example-ldes-member.nq rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/example-ldes-member.nq diff --git a/ldes-server-port-ingest-rest/src/test/resources/menu-items/example-data-new.ttl b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/menu-items/example-data-new.ttl similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/menu-items/example-data-new.ttl rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/menu-items/example-data-new.ttl diff --git a/ldes-server-port-ingest-rest/src/test/resources/menu-items/example-data-old.ttl b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/menu-items/example-data-old.ttl similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/menu-items/example-data-old.ttl rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/menu-items/example-data-old.ttl diff --git a/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/menu-items/example-shape-new.ttl b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/menu-items/example-shape-new.ttl new file mode 100644 index 0000000000..cdca7c67d4 --- /dev/null +++ b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/menu-items/example-shape-new.ttl @@ -0,0 +1,43 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . +@prefix sh: . +@prefix : . +@prefix skos: . + + +:MenuItemShape + a sh:NodeShape ; + sh:targetClass :MenuItem ; + sh:property [ + sh:path :name ; + sh:datatype xsd:string ; + sh:minCount 1 ; + sh:maxCount 1 ; + ]; + sh:property [ + sh:path :category ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + sh:in (:mainDish :starter :dessert) ; + ]; + sh:property [ + sh:path :price ; + sh:datatype xsd:decimal ; + sh:minCount 1 ; + sh:maxCount 1 ; + ]; + sh:property [ + sh:path :ingredients ; + sh:datatype xsd:string ; + sh:minCount 1 ; + ] . + +:mainDish a skos:Concept ; + skos:prefLabel "Main Dish" . + +:starter a skos:Concept ; + skos:prefLabel "Starter" . + +:dessert a skos:Concept ; + skos:prefLabel "Dessert" . \ No newline at end of file diff --git a/ldes-server-port-ingest-rest/src/test/resources/menu-items/example-shape-old.ttl b/ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/menu-items/example-shape-old.ttl similarity index 100% rename from ldes-server-port-ingest-rest/src/test/resources/menu-items/example-shape-old.ttl rename to ldes-server-ingest/ldes-server-ingest-rest/src/test/resources/menu-items/example-shape-old.ttl diff --git a/ldes-server-ingest/pom.xml b/ldes-server-ingest/pom.xml new file mode 100644 index 0000000000..6ae54b0b38 --- /dev/null +++ b/ldes-server-ingest/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + be.vlaanderen.informatievlaanderen.vsds + ldes-server + 3.5.0-SNAPSHOT + + pom + + ldes-server-ingest + + + ldes-server-ingest-common + ldes-server-ingest-rest + + + \ No newline at end of file diff --git a/ldes-server-instrumentation/pom.xml b/ldes-server-instrumentation/pom.xml deleted file mode 100644 index 510f7b0574..0000000000 --- a/ldes-server-instrumentation/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - 4.0.0 - - be.vlaanderen.informatievlaanderen.vsds - ldes-server - 3.4.1-SNAPSHOT - - - ldes-server-instrumentation - - - - io.pyroscope - agent - - - org.springframework - spring-context - compile - - - jakarta.annotation - jakarta.annotation-api - compile - - - - - ${project.artifactId} - - - org.apache.maven.plugins - maven-assembly-plugin - - - - \ No newline at end of file diff --git a/ldes-server-integration-test/pom.xml b/ldes-server-integration-test/pom.xml index 6dbdfde4ad..6d377014e8 100644 --- a/ldes-server-integration-test/pom.xml +++ b/ldes-server-integration-test/pom.xml @@ -6,27 +6,29 @@ be.vlaanderen.informatievlaanderen.vsds ldes-server - 3.4.1-SNAPSHOT + 3.5.0-SNAPSHOT ldes-server-integration-test + be.vlaanderen.informatievlaanderen.vsds postgres-liquibase ${project.version} test + be.vlaanderen.informatievlaanderen.vsds - ldes-server-retention + postgres-pagination-repository ${project.version} test be.vlaanderen.informatievlaanderen.vsds - postgres-retention-repository + postgres-fetch-repository ${project.version} test @@ -38,51 +40,55 @@ be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-ingest + postgres-maintenance-repository ${project.version} test + be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-ingest-rest + ldes-server-fragmentation-geospatial ${project.version} test + be.vlaanderen.informatievlaanderen.vsds - ldes-server-admin + ldes-server-fragmentation-timebased-hierarchical ${project.version} test be.vlaanderen.informatievlaanderen.vsds - postgres-admin-repository + ldes-server-fragmentation-reference ${project.version} test + be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-common + ldes-server-ingest-rest ${project.version} test be.vlaanderen.informatievlaanderen.vsds - ldes-server-pagination + ldes-server-admin-rest ${project.version} test be.vlaanderen.informatievlaanderen.vsds - postgres-pagination-repository + ldes-server-fetch-rest ${project.version} test + + + - be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-geospatial - ${project.version} - test + org.springframework.boot + spring-boot-starter-test io.zonky.test @@ -90,40 +96,7 @@ 2.5.0 test - - be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-timebased-hierarchical - ${project.version} - test - - - be.vlaanderen.informatievlaanderen.vsds - ldes-fragmentisers-reference - ${project.version} - test - - - be.vlaanderen.informatievlaanderen.vsds - postgres-fragmentation-repository - ${project.version} - test - - - be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-fetch - ${project.version} - test - - - be.vlaanderen.informatievlaanderen.vsds - ldes-server-port-fetch-rest - ${project.version} - test - - - org.springframework.boot - spring-boot-starter-test - + org.springframework.boot spring-boot-starter-webflux diff --git a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/CompactionServiceSteps.java b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/CompactionServiceSteps.java index 46b872d426..d22bbdf796 100644 --- a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/CompactionServiceSteps.java +++ b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/CompactionServiceSteps.java @@ -105,7 +105,7 @@ public void verifyUpdateOfPredecessorRelations(long pointingCount) { @And("verify the following pages have no members") public void verifyFragmentationOfMembers(List ids) { await().untilAsserted(() -> { - var count = entityManager.createQuery("SELECT COUNT(*) FROM PageMemberEntity p where p.page.id IN :ids") + var count = entityManager.createQuery("SELECT COUNT(*) FROM RetentionPageMemberEntity p where p.pageId IN :ids") .setParameter("ids", ids).getSingleResult(); diff --git a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerIntegrationTest.java b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerIntegrationTest.java index 75073aa294..2ed21783e8 100644 --- a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerIntegrationTest.java +++ b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerIntegrationTest.java @@ -8,6 +8,7 @@ import io.cucumber.spring.CucumberContextConfiguration; import io.zonky.test.db.AutoConfigureEmbeddedDatabase; import jakarta.persistence.EntityManager; +import org.springframework.batch.core.explore.JobExplorer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.autoconfigure.actuate.observability.AutoConfigureObservability; @@ -28,13 +29,15 @@ @SpringBootTest @AutoConfigureMockMvc @AutoConfigureEmbeddedDatabase(type = AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES, - refresh = AutoConfigureEmbeddedDatabase.RefreshMode.AFTER_EACH_TEST_METHOD, replace = AutoConfigureEmbeddedDatabase.Replace.ANY) @ActiveProfiles("postgres-test") -@ContextConfiguration(classes = { MemberEntityRepository.class, PageRelationPostgresRepository.class, PageRelationEntityRepository.class }) -@ComponentScan(value = { "be.vlaanderen.informatievlaanderen.ldes.server" }) -@TestPropertySource(properties = { "ldes-server.fragmentation-cron=*/1 * * * * *", "ldes-server.compaction-cron=*/10 * * * * *", - "ldes-server.deletion-cron=*/20 * * * * *", "ldes-server.compaction-duration=PT1S" }) +@ContextConfiguration(classes = {MemberEntityRepository.class, PageRelationPostgresRepository.class, PageRelationEntityRepository.class}) +@ComponentScan(value = {"be.vlaanderen.informatievlaanderen.ldes.server"}) +@TestPropertySource(properties = { + "ldes-server.fragmentation-cron=*/1 * * * * *", + "ldes-server.maintenance-cron=*/10 * * * * *", + "ldes-server.compaction-duration=PT1S" +}) @SuppressWarnings("java:S2187") public class LdesServerIntegrationTest { @Autowired @@ -54,4 +57,6 @@ public class LdesServerIntegrationTest { @Autowired DataSource dataSource; + @Autowired + JobExplorer jobExplorer; } diff --git a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerRetentionIT.java b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerRetentionIT.java deleted file mode 100644 index ac84b1cfb1..0000000000 --- a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerRetentionIT.java +++ /dev/null @@ -1,11 +0,0 @@ -package be.vlaanderen.informatievlaanderen.ldes.server; - -import org.junit.platform.suite.api.IncludeEngines; -import org.junit.platform.suite.api.SelectClasspathResource; -import org.junit.platform.suite.api.Suite; - -@Suite -@IncludeEngines("cucumber") -@SelectClasspathResource("features/retention") -public class LdesServerRetentionIT extends LdesServerIntegrationTest { -} diff --git a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerSteps.java b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerSteps.java index bdc8c39692..0ec36d412f 100644 --- a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerSteps.java +++ b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/LdesServerSteps.java @@ -16,6 +16,9 @@ import org.apache.jena.riot.*; import org.apache.jena.vocabulary.RDF; import org.awaitility.Awaitility; +import org.springframework.batch.core.BatchStatus; +import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobInstance; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.mock.web.MockHttpServletResponse; @@ -44,6 +47,7 @@ import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.TREE_MEMBER; import static be.vlaanderen.informatievlaanderen.ldes.server.domain.constants.RdfConstants.TREE_REMAINING_ITEMS; +import static be.vlaanderen.informatievlaanderen.ldes.server.maintenance.batch.MaintenanceFlows.MAINTENANCE_JOB; import static java.util.concurrent.TimeUnit.SECONDS; import static org.apache.jena.rdf.model.ResourceFactory.createProperty; import static org.apache.jena.rdf.model.ResourceFactory.createResource; @@ -84,23 +88,21 @@ private String getCurrentTimestamp() { } private Model getResponseAsModel(String url, String contentType) throws Exception { - return RDFParser.fromString(mockMvc.perform(get(url) - .accept(contentType)) - .andExpect(status().isOk()).andReturn().getResponse().getContentAsString()) - .lang(RDFLanguages.contentTypeToLang(contentType)).toModel(); + final String content = mockMvc.perform(get(url).accept(contentType)) + .andExpect(status().isOk()) + .andReturn().getResponse().getContentAsString(); + return RDFParser.create().fromString(content).lang(RDFLanguages.contentTypeToLang(contentType)).toModel(); } @When("I ingest {int} members to the collection {string}") public void iIngestMembersToTheCollection(int numberOfMembers, String collectionName) throws Exception { for (int i = 0; i < numberOfMembers; i++) { - Model member = RDFParser.fromString(readMemberTemplate("data/input/members/mob-hind.template.ttl") - .replace("ID", String.valueOf(i)) - .replace("DATETIME", "2023-04-06T09:58:15.867Z")) - .lang(Lang.TURTLE) - .toModel(); + String member = readMemberTemplate("data/input/members/mob-hind.template.ttl") + .replace("ID", String.valueOf(i)) + .replace("DATETIME", "2023-04-06T09:58:15.867Z"); mockMvc.perform(post("/" + collectionName) .contentType("text/turtle") - .content(RDFWriter.source(member).lang(Lang.TURTLE).asString())) + .content(member)) .andExpect(status().is2xxSuccessful()); } } @@ -185,14 +187,14 @@ public void iCreateTheEventstreamEventStreamDescription(String eventStreamDescri String eventstream = readBodyFromFile(eventStreamDescriptionFileSanitized) .replace("CURRENTTIME", getCurrentTimestamp()); - String eventStreamName = RDFParser.fromString(mockMvc.perform(post("/admin/api/v1/eventstreams") - .contentType(RDFLanguages.guessContentType(eventStreamDescriptionFileSanitized).getContentTypeStr()) - .content(eventstream)) - .andExpect(status().isCreated()) - .andReturn() - .getResponse() - .getContentAsString()) - .lang(Lang.TURTLE) + final String content = mockMvc.perform(post("/admin/api/v1/eventstreams") + .contentType(RDFLanguages.guessContentType(eventStreamDescriptionFileSanitized).getContentTypeStr()) + .content(eventstream)) + .andExpect(status().isCreated()) + .andReturn() + .getResponse() + .getContentAsString(); + String eventStreamName = RDFParser.create().fromString(content).lang(Lang.TURTLE) .toModel() .listStatements(null, RDF.type, createResource("https://w3id.org/ldes#EventStream")) .next() @@ -260,7 +262,7 @@ public void firstFragmentOfViewContainsMembers(String view, String collection, l Model fragmentPage = fetchFragment(fragmentUrl); return fragmentPage.listObjectsOfProperty(createProperty("https://w3id.org/tree#member")) - .toList().size() == expectedMemberCount; + .toList().size() == expectedMemberCount; }); } @@ -351,7 +353,7 @@ private Model fetchFragment(String path) throws Exception { .andReturn() .getResponse(); if (response.getStatus() == 404) { - return null; + return ModelFactory.createDefaultModel(); } return new ResponseToModelConverter(response).convert(); } @@ -362,4 +364,13 @@ public void theResponseFromRequestingTheUrlDoesContainAJsonFile(String message, .andReturn().getResponse(); assertTrue(response.getContentAsString().contains("%s{collection=\"%s\"} %s".formatted(message, collection, value))); } + + @And("the background processes did not fail") + public void theBackgroundProcessesDidNotFail() { + JobInstance lastJobInstance = Objects.requireNonNull(jobExplorer.getLastJobInstance(MAINTENANCE_JOB)); + JobExecution lastJobExecution = Objects.requireNonNull(jobExplorer.getLastJobExecution(lastJobInstance)); + boolean hasFailedExecutions = lastJobExecution.getStepExecutions().stream() + .anyMatch(stepExecution -> stepExecution.getStatus().equals(BatchStatus.FAILED)); + assertThat(hasFailedExecutions).isFalse(); + } } diff --git a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/CompactionIT.java b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/MaintenanceIT.java similarity index 69% rename from ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/CompactionIT.java rename to ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/MaintenanceIT.java index 936d0c12e9..135fcce70e 100644 --- a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/CompactionIT.java +++ b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/MaintenanceIT.java @@ -6,7 +6,7 @@ @Suite @IncludeEngines("cucumber") -@SelectClasspathResource("features/compaction") -public class CompactionIT extends LdesServerIntegrationTest { +@SelectClasspathResource("features/maintenance") +public class MaintenanceIT extends LdesServerIntegrationTest { } diff --git a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/resultactionsextensions/ResponseToModelConverter.java b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/resultactionsextensions/ResponseToModelConverter.java index c60917e054..f9df9e4dd2 100644 --- a/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/resultactionsextensions/ResponseToModelConverter.java +++ b/ldes-server-integration-test/src/test/java/be/vlaanderen/informatievlaanderen/ldes/server/resultactionsextensions/ResponseToModelConverter.java @@ -1,6 +1,8 @@ package be.vlaanderen.informatievlaanderen.ldes.server.resultactionsextensions; +import org.apache.jena.atlas.web.ContentType; import org.apache.jena.rdf.model.Model; +import org.apache.jena.riot.Lang; import org.apache.jena.riot.RDFLanguages; import org.apache.jena.riot.RDFParser; import org.springframework.mock.web.MockHttpServletResponse; @@ -8,18 +10,16 @@ import java.io.UnsupportedEncodingException; public class ResponseToModelConverter { - private final MockHttpServletResponse response; + private final MockHttpServletResponse response; - public ResponseToModelConverter(MockHttpServletResponse response) { - this.response = response; - } + public ResponseToModelConverter(MockHttpServletResponse response) { + this.response = response; + } - public Model convert() throws UnsupportedEncodingException { - return RDFParser - .fromString(response.getContentAsString()) - .lang(RDFLanguages.contentTypeToLang(response.getContentType())) - .toModel(); - } + public Model convert() throws UnsupportedEncodingException { + Lang lang = RDFLanguages.contentTypeToLang(ContentType.create(response.getContentType())); + return RDFParser.create().fromString(response.getContentAsString()).lang(lang).toModel(); + } } diff --git a/ldes-server-integration-test/src/test/resources/application-postgres-test.yml b/ldes-server-integration-test/src/test/resources/application-postgres-test.yml index b19995f7fc..e0b815ab7b 100644 --- a/ldes-server-integration-test/src/test/resources/application-postgres-test.yml +++ b/ldes-server-integration-test/src/test/resources/application-postgres-test.yml @@ -1,9 +1,8 @@ ldes-server: host-name: "http://localhost:8080" compaction-duration: "*/10 * * * * *" - retention-cron: "*/10 * * * * *" - deletion-cron: "*/5 * * * * *" fragmentation-cron: "*/10 * * * * *" + maintenance-cron: "*/10 * * * * *" springdoc.swaggerui.path: "/swagger" management: @@ -19,6 +18,13 @@ spring: initialize-schema: always isolation-level-for-create: READ_COMMITTED +zonky: + test: + database: + postgres: + docker: + image: postgres:14-alpine + logging: level: org.springframework.batch.core: WARN \ No newline at end of file diff --git a/ldes-server-integration-test/src/test/resources/data/input/members/mob-hind.string-time.template.ttl b/ldes-server-integration-test/src/test/resources/data/input/members/mob-hind.string-time.template.ttl new file mode 100644 index 0000000000..b264831a7e --- /dev/null +++ b/ldes-server-integration-test/src/test/resources/data/input/members/mob-hind.string-time.template.ttl @@ -0,0 +1,11 @@ +@prefix dc: . +@prefix prov: . +@prefix xsd: . +@prefix rdf: . +@prefix geosparql: . + + + dc:isVersionOf ; + rdf:type ; + geosparql:asWKT "POLYGON ((3.7337472847142124 51.04745170597559, 4.359276660355135 50.851907920816956, 4.711285586572245 50.84364854093491, 4.4020885567877315 51.214619167436666, 3.7337472847142124 51.04745170597559))"^^ ; + dc:created "DATETIME"^^xsd:string . \ No newline at end of file diff --git a/ldes-server-integration-test/src/test/resources/data/input/members/mob-hind.typeless-time.template.ttl b/ldes-server-integration-test/src/test/resources/data/input/members/mob-hind.typeless-time.template.ttl new file mode 100644 index 0000000000..db6a9cee90 --- /dev/null +++ b/ldes-server-integration-test/src/test/resources/data/input/members/mob-hind.typeless-time.template.ttl @@ -0,0 +1,11 @@ +@prefix dc: . +@prefix prov: . +@prefix xsd: . +@prefix rdf: . +@prefix geosparql: . + + + dc:isVersionOf ; + rdf:type ; + geosparql:asWKT "POLYGON ((3.7337472847142124 51.04745170597559, 4.359276660355135 50.851907920816956, 4.711285586572245 50.84364854093491, 4.4020885567877315 51.214619167436666, 3.7337472847142124 51.04745170597559))"^^ ; + dc:created "DATETIME" . \ No newline at end of file diff --git a/ldes-server-integration-test/src/test/resources/features/fragmentation/fragmentation.feature b/ldes-server-integration-test/src/test/resources/features/fragmentation/fragmentation.feature index 255a0aaca2..1cb71bf459 100644 --- a/ldes-server-integration-test/src/test/resources/features/fragmentation/fragmentation.feature +++ b/ldes-server-integration-test/src/test/resources/features/fragmentation/fragmentation.feature @@ -41,7 +41,7 @@ Feature: LDES Server Fragmentation And this fragment is mutable And this fragment has no relations Examples: - | eventStreamDescriptionFile | viewDescriptionFile | template | collection | ingestedMemberCount | restCount | + | eventStreamDescriptionFile | viewDescriptionFile | template | collection | ingestedMemberCount | restCount | | "data/input/eventstreams/fragmentation/mobility-hindrances.ttl" | "data/input/eventstreams/fragmentation/mobility-hindrances.view.paged.ttl" | "data/input/members/mob-hind.template.ttl" | "mobility-hindrances" | 617 | 17 | @geospatial @@ -82,9 +82,11 @@ Feature: LDES Server Fragmentation And I fetch the next fragment through the first "GreaterThanOrEqualToRelation" And I fetch the next fragment through the first "Relation" Examples: - | eventStreamDescriptionFile | template | collection | ingestedMembers | - | "data/input/eventstreams/fragmentation/mobility-hindrances.by-time.ttl" | "data/input/members/mob-hind.template.ttl" | "mobility-hindrances" | 5 | - | "data/input/eventstreams/fragmentation/observations/by-time.ttl" | "data/input/members/two-observations.template.ttl" | "observations" | 10 | + | eventStreamDescriptionFile | template | collection | ingestedMembers | + | "data/input/eventstreams/fragmentation/mobility-hindrances.by-time.ttl" | "data/input/members/mob-hind.template.ttl" | "mobility-hindrances" | 5 | + | "data/input/eventstreams/fragmentation/mobility-hindrances.by-time.ttl" | "data/input/members/mob-hind.string-time.template.ttl" | "mobility-hindrances" | 5 | + | "data/input/eventstreams/fragmentation/mobility-hindrances.by-time.ttl" | "data/input/members/mob-hind.string-time.template.ttl" | "mobility-hindrances" | 5 | + | "data/input/eventstreams/fragmentation/observations/by-time.ttl" | "data/input/members/two-observations.template.ttl" | "observations" | 10 | @reference Scenario Outline: Server Can Fragment an LDES using the Reference Fragmentation strategy diff --git a/ldes-server-integration-test/src/test/resources/features/compaction/compaction.feature b/ldes-server-integration-test/src/test/resources/features/maintenance/compaction.feature similarity index 89% rename from ldes-server-integration-test/src/test/resources/features/compaction/compaction.feature rename to ldes-server-integration-test/src/test/resources/features/maintenance/compaction.feature index c73719ec3b..959f094468 100644 --- a/ldes-server-integration-test/src/test/resources/features/compaction/compaction.feature +++ b/ldes-server-integration-test/src/test/resources/features/maintenance/compaction.feature @@ -1,4 +1,4 @@ -Feature: Execute CompactionService +Feature: LDES Server Compaction Background: Given I create the eventstream "data/input/eventstreams/compaction/mobility-hindrances_paginated_5.ttl" @@ -20,4 +20,5 @@ Feature: Execute CompactionService | 3 | And verify the following pages no longer exist | 2 | - | 3 | \ No newline at end of file + | 3 | + And the background processes did not fail \ No newline at end of file diff --git a/ldes-server-integration-test/src/test/resources/features/retention/retention.feature b/ldes-server-integration-test/src/test/resources/features/maintenance/retention.feature similarity index 82% rename from ldes-server-integration-test/src/test/resources/features/retention/retention.feature rename to ldes-server-integration-test/src/test/resources/features/maintenance/retention.feature index 763bac5b35..304468c3f3 100644 --- a/ldes-server-integration-test/src/test/resources/features/retention/retention.feature +++ b/ldes-server-integration-test/src/test/resources/features/maintenance/retention.feature @@ -7,6 +7,7 @@ Feature: LDES Server Retention Then the first fragment of the "paged" view in collection contains members # Since all added members' timestamp values equal to their ingestion date, they should be removed after 15 seconds Then the first fragment of the "paged" view in collection contains 0 members + And the background processes did not fail Examples: | eventStreamDescriptionFile | template | collection | ingestedMemberCount | | "data/input/eventstreams/retention/mobility-hindrances_timebased.ttl" | "data/input/members/mob-hind.template.ttl" | "mobility-hindrances" | 30 | @@ -17,6 +18,7 @@ Feature: LDES Server Retention Given I create the eventstream When I ingest 30 members of template