From f04ce4f2915ceebf98c2b76941c9eb2821094a6b Mon Sep 17 00:00:00 2001 From: Jonas Bulcke <127748878+jobulcke@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:07:32 +0200 Subject: [PATCH 1/5] ci: prepare release 2.8.0 (#648) --- ldi-api/pom.xml | 2 +- ldi-core/change-detection-filter/pom.xml | 2 +- ldi-core/file-archiving/pom.xml | 2 +- ldi-core/geojson-to-wkt/pom.xml | 2 +- ldi-core/json-to-ld-adapter/pom.xml | 2 +- ldi-core/ldes-client/pom.xml | 2 +- ldi-core/ldes-client/starting-node/pom.xml | 2 +- ldi-core/ldes-client/tree-node-fetcher/pom.xml | 2 +- ldi-core/ldes-client/tree-node-relations-fetcher/pom.xml | 2 +- ldi-core/ldes-client/tree-node-supplier/pom.xml | 2 +- ldi-core/ldi-common/pom.xml | 2 +- ldi-core/ldi-infra-sql/pom.xml | 2 +- ldi-core/ngsiv2-to-ld-adapter/pom.xml | 2 +- ldi-core/pom.xml | 2 +- ldi-core/rdf-adapter/pom.xml | 2 +- ldi-core/repository-materialiser/pom.xml | 2 +- ldi-core/request-executor/pom.xml | 2 +- ldi-core/rml-adapter/pom.xml | 2 +- ldi-core/sparql-construct/pom.xml | 2 +- ldi-core/version-materialiser/pom.xml | 2 +- ldi-core/version-object-creator/pom.xml | 2 +- ldi-extensions/ldes-discoverer/pom.xml | 2 +- ldi-extensions/pom.xml | 2 +- ldi-nifi/ldi-nifi-common/pom.xml | 2 +- ldi-nifi/ldi-nifi-processors/archive-file-in/pom.xml | 2 +- ldi-nifi/ldi-nifi-processors/archive-file-out/pom.xml | 2 +- .../ldi-nifi-processors/change-detection-processor/pom.xml | 2 +- .../create-version-object-processor/pom.xml | 2 +- ldi-nifi/ldi-nifi-processors/geojson-to-wkt-processor/pom.xml | 2 +- ldi-nifi/ldi-nifi-processors/json-to-ld-processor/pom.xml | 2 +- ldi-nifi/ldi-nifi-processors/ldes-client-processor/pom.xml | 2 +- ldi-nifi/ldi-nifi-processors/ldi-processors-bundle/pom.xml | 2 +- ldi-nifi/ldi-nifi-processors/ngsiv2-to-ld-processor/pom.xml | 2 +- ldi-nifi/ldi-nifi-processors/pom.xml | 2 +- .../rdf4j-repository-materialisation-processor/pom.xml | 2 +- ldi-nifi/ldi-nifi-processors/rml-adapter-processor/pom.xml | 2 +- .../ldi-nifi-processors/sparql-interactions-processor/pom.xml | 2 +- .../version-materialisation-processor/pom.xml | 2 +- ldi-nifi/pom.xml | 2 +- ldi-orchestrator/ldio-application/pom.xml | 2 +- ldi-orchestrator/ldio-common/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-amqp/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-archive-file-in/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/pom.xml | 2 +- .../ldio-connectors/ldio-change-detection-filter/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-console-out/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-file-out/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-http-enricher/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-http-in-poller/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-http-in/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-http-out/pom.xml | 2 +- .../ldio-connectors/ldio-json-to-ld-adapter/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-kafka/pom.xml | 2 +- .../ldio-connectors/ldio-ldes-client-connector/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml | 2 +- .../ldio-connectors/ldio-ngsiv2-to-ld-adapter/pom.xml | 4 ++-- ldi-orchestrator/ldio-connectors/ldio-noop-out/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/pom.xml | 2 +- .../ldio-connectors/ldio-repository-materialiser/pom.xml | 2 +- .../ldio-connectors/ldio-request-executor/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/ldio-rml-adapter/pom.xml | 2 +- .../ldio-connectors/ldio-sparql-construct/pom.xml | 2 +- .../ldio-connectors/ldio-version-materialiser/pom.xml | 2 +- .../ldio-connectors/ldio-version-object-creator/pom.xml | 2 +- ldi-orchestrator/ldio-connectors/pom.xml | 2 +- ldi-orchestrator/pom.xml | 2 +- pom.xml | 2 +- 68 files changed, 69 insertions(+), 69 deletions(-) diff --git a/ldi-api/pom.xml b/ldi-api/pom.xml index cf00179bf..105325f75 100644 --- a/ldi-api/pom.xml +++ b/ldi-api/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes linked-data-interactions - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-core/change-detection-filter/pom.xml b/ldi-core/change-detection-filter/pom.xml index ec37f0188..fa8bcb35c 100644 --- a/ldi-core/change-detection-filter/pom.xml +++ b/ldi-core/change-detection-filter/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT change-detection-filter diff --git a/ldi-core/file-archiving/pom.xml b/ldi-core/file-archiving/pom.xml index 5a1ad2cf9..795e81805 100644 --- a/ldi-core/file-archiving/pom.xml +++ b/ldi-core/file-archiving/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT file-archiving diff --git a/ldi-core/geojson-to-wkt/pom.xml b/ldi-core/geojson-to-wkt/pom.xml index 41168098c..7b6ab62cb 100644 --- a/ldi-core/geojson-to-wkt/pom.xml +++ b/ldi-core/geojson-to-wkt/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT geojson-to-wkt diff --git a/ldi-core/json-to-ld-adapter/pom.xml b/ldi-core/json-to-ld-adapter/pom.xml index c7ca51a5d..f0a7bab53 100644 --- a/ldi-core/json-to-ld-adapter/pom.xml +++ b/ldi-core/json-to-ld-adapter/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT json-to-ld-adapter diff --git a/ldi-core/ldes-client/pom.xml b/ldi-core/ldes-client/pom.xml index 5541d4fea..5e8badd34 100644 --- a/ldi-core/ldes-client/pom.xml +++ b/ldi-core/ldes-client/pom.xml @@ -5,7 +5,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-core/ldes-client/starting-node/pom.xml b/ldi-core/ldes-client/starting-node/pom.xml index 3cad5c7aa..54583ded8 100644 --- a/ldi-core/ldes-client/starting-node/pom.xml +++ b/ldi-core/ldes-client/starting-node/pom.xml @@ -5,7 +5,7 @@ ldes-client be.vlaanderen.informatievlaanderen.ldes.client - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 starting-node diff --git a/ldi-core/ldes-client/tree-node-fetcher/pom.xml b/ldi-core/ldes-client/tree-node-fetcher/pom.xml index f9ece0352..73a59334e 100644 --- a/ldi-core/ldes-client/tree-node-fetcher/pom.xml +++ b/ldi-core/ldes-client/tree-node-fetcher/pom.xml @@ -5,7 +5,7 @@ ldes-client be.vlaanderen.informatievlaanderen.ldes.client - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT diff --git a/ldi-core/ldes-client/tree-node-relations-fetcher/pom.xml b/ldi-core/ldes-client/tree-node-relations-fetcher/pom.xml index cf333374a..6f3f30aaf 100644 --- a/ldi-core/ldes-client/tree-node-relations-fetcher/pom.xml +++ b/ldi-core/ldes-client/tree-node-relations-fetcher/pom.xml @@ -5,7 +5,7 @@ ldes-client be.vlaanderen.informatievlaanderen.ldes.client - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-core/ldes-client/tree-node-supplier/pom.xml b/ldi-core/ldes-client/tree-node-supplier/pom.xml index 43f32806d..70c80337a 100644 --- a/ldi-core/ldes-client/tree-node-supplier/pom.xml +++ b/ldi-core/ldes-client/tree-node-supplier/pom.xml @@ -5,7 +5,7 @@ ldes-client be.vlaanderen.informatievlaanderen.ldes.client - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 tree-node-supplier diff --git a/ldi-core/ldi-common/pom.xml b/ldi-core/ldi-common/pom.xml index 919814076..9dc986bce 100644 --- a/ldi-core/ldi-common/pom.xml +++ b/ldi-core/ldi-common/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldi-common diff --git a/ldi-core/ldi-infra-sql/pom.xml b/ldi-core/ldi-infra-sql/pom.xml index 793064339..007a4ef9a 100644 --- a/ldi-core/ldi-infra-sql/pom.xml +++ b/ldi-core/ldi-infra-sql/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldi-infra-sql diff --git a/ldi-core/ngsiv2-to-ld-adapter/pom.xml b/ldi-core/ngsiv2-to-ld-adapter/pom.xml index 8f411ab0c..6f26c1781 100644 --- a/ldi-core/ngsiv2-to-ld-adapter/pom.xml +++ b/ldi-core/ngsiv2-to-ld-adapter/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ngsiv2-to-ld-adapter diff --git a/ldi-core/pom.xml b/ldi-core/pom.xml index 6f2976a9a..195942fff 100644 --- a/ldi-core/pom.xml +++ b/ldi-core/pom.xml @@ -3,7 +3,7 @@ linked-data-interactions be.vlaanderen.informatievlaanderen.ldes - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-core/rdf-adapter/pom.xml b/ldi-core/rdf-adapter/pom.xml index 7a66a1e1e..60d59a6c5 100644 --- a/ldi-core/rdf-adapter/pom.xml +++ b/ldi-core/rdf-adapter/pom.xml @@ -5,7 +5,7 @@ ldi-core be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-core/repository-materialiser/pom.xml b/ldi-core/repository-materialiser/pom.xml index b65dcee63..08aa0e15f 100644 --- a/ldi-core/repository-materialiser/pom.xml +++ b/ldi-core/repository-materialiser/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT diff --git a/ldi-core/request-executor/pom.xml b/ldi-core/request-executor/pom.xml index 7bbf7317a..271f1748b 100644 --- a/ldi-core/request-executor/pom.xml +++ b/ldi-core/request-executor/pom.xml @@ -5,7 +5,7 @@ ldi-core be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 request-executor diff --git a/ldi-core/rml-adapter/pom.xml b/ldi-core/rml-adapter/pom.xml index 538ab0ac9..efebcf6d4 100644 --- a/ldi-core/rml-adapter/pom.xml +++ b/ldi-core/rml-adapter/pom.xml @@ -5,7 +5,7 @@ ldi-core be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-core/sparql-construct/pom.xml b/ldi-core/sparql-construct/pom.xml index 281c30524..bde68c4b5 100644 --- a/ldi-core/sparql-construct/pom.xml +++ b/ldi-core/sparql-construct/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-core - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-core/version-materialiser/pom.xml b/ldi-core/version-materialiser/pom.xml index 7f452e6c8..a272547e8 100644 --- a/ldi-core/version-materialiser/pom.xml +++ b/ldi-core/version-materialiser/pom.xml @@ -3,7 +3,7 @@ ldi-core be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-core/version-object-creator/pom.xml b/ldi-core/version-object-creator/pom.xml index 0ed0efd86..e08652e7b 100644 --- a/ldi-core/version-object-creator/pom.xml +++ b/ldi-core/version-object-creator/pom.xml @@ -3,7 +3,7 @@ ldi-core be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-extensions/ldes-discoverer/pom.xml b/ldi-extensions/ldes-discoverer/pom.xml index ccab8a0d6..70e6791c2 100644 --- a/ldi-extensions/ldes-discoverer/pom.xml +++ b/ldi-extensions/ldes-discoverer/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-extensions - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldes-discoverer diff --git a/ldi-extensions/pom.xml b/ldi-extensions/pom.xml index f01ef2099..d55d2dc1e 100644 --- a/ldi-extensions/pom.xml +++ b/ldi-extensions/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes linked-data-interactions - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT be.vlaanderen.informatievlaanderen.ldes.ldi diff --git a/ldi-nifi/ldi-nifi-common/pom.xml b/ldi-nifi/ldi-nifi-common/pom.xml index df59af287..015676c81 100644 --- a/ldi-nifi/ldi-nifi-common/pom.xml +++ b/ldi-nifi/ldi-nifi-common/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-nifi - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-nifi/ldi-nifi-processors/archive-file-in/pom.xml b/ldi-nifi/ldi-nifi-processors/archive-file-in/pom.xml index 863310ba0..21025460d 100644 --- a/ldi-nifi/ldi-nifi-processors/archive-file-in/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/archive-file-in/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT archive-file-in diff --git a/ldi-nifi/ldi-nifi-processors/archive-file-out/pom.xml b/ldi-nifi/ldi-nifi-processors/archive-file-out/pom.xml index 7a822b702..d03e09b1c 100644 --- a/ldi-nifi/ldi-nifi-processors/archive-file-out/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/archive-file-out/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT archive-file-out diff --git a/ldi-nifi/ldi-nifi-processors/change-detection-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/change-detection-processor/pom.xml index 2b03e7626..d8925f39d 100644 --- a/ldi-nifi/ldi-nifi-processors/change-detection-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/change-detection-processor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT change-detection-processor diff --git a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/pom.xml index 1aa5686eb..c79ef0f70 100644 --- a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-nifi/ldi-nifi-processors/geojson-to-wkt-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/geojson-to-wkt-processor/pom.xml index 75be8f3e3..e2eb4d0c1 100644 --- a/ldi-nifi/ldi-nifi-processors/geojson-to-wkt-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/geojson-to-wkt-processor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT geojson-to-wkt-processor diff --git a/ldi-nifi/ldi-nifi-processors/json-to-ld-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/json-to-ld-processor/pom.xml index 96e0f2bcb..a5b940d45 100644 --- a/ldi-nifi/ldi-nifi-processors/json-to-ld-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/json-to-ld-processor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT json-to-ld-processor diff --git a/ldi-nifi/ldi-nifi-processors/ldes-client-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/ldes-client-processor/pom.xml index 26c10ba6c..b9b46dd66 100644 --- a/ldi-nifi/ldi-nifi-processors/ldes-client-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/ldes-client-processor/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-nifi/ldi-nifi-processors/ldi-processors-bundle/pom.xml b/ldi-nifi/ldi-nifi-processors/ldi-processors-bundle/pom.xml index 7ce312654..fd44ee046 100644 --- a/ldi-nifi/ldi-nifi-processors/ldi-processors-bundle/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/ldi-processors-bundle/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldi-processors-bundle diff --git a/ldi-nifi/ldi-nifi-processors/ngsiv2-to-ld-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/ngsiv2-to-ld-processor/pom.xml index 60562b260..017bafa58 100644 --- a/ldi-nifi/ldi-nifi-processors/ngsiv2-to-ld-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/ngsiv2-to-ld-processor/pom.xml @@ -7,7 +7,7 @@ ldi-nifi-processors be.vlaanderen.informatievlaanderen.ldes.ldi.nifi - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ngsiv2-to-ld-processor diff --git a/ldi-nifi/ldi-nifi-processors/pom.xml b/ldi-nifi/ldi-nifi-processors/pom.xml index eac8ff20b..e25312b1f 100644 --- a/ldi-nifi/ldi-nifi-processors/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-nifi - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/pom.xml index 079f4d3f6..6fbdf1950 100644 --- a/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/rdf4j-repository-materialisation-processor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT rdf4j-repository-materialisation-processor diff --git a/ldi-nifi/ldi-nifi-processors/rml-adapter-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/rml-adapter-processor/pom.xml index 40126dc14..96867c68c 100644 --- a/ldi-nifi/ldi-nifi-processors/rml-adapter-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/rml-adapter-processor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT rml-adapter-processor diff --git a/ldi-nifi/ldi-nifi-processors/sparql-interactions-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/sparql-interactions-processor/pom.xml index 0893c078e..2fa35e250 100644 --- a/ldi-nifi/ldi-nifi-processors/sparql-interactions-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/sparql-interactions-processor/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-nifi/ldi-nifi-processors/version-materialisation-processor/pom.xml b/ldi-nifi/ldi-nifi-processors/version-materialisation-processor/pom.xml index 49a6ef38d..7e19d8241 100644 --- a/ldi-nifi/ldi-nifi-processors/version-materialisation-processor/pom.xml +++ b/ldi-nifi/ldi-nifi-processors/version-materialisation-processor/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi.nifi ldi-nifi-processors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-nifi/pom.xml b/ldi-nifi/pom.xml index 8472159eb..4517902ec 100644 --- a/ldi-nifi/pom.xml +++ b/ldi-nifi/pom.xml @@ -3,7 +3,7 @@ linked-data-interactions be.vlaanderen.informatievlaanderen.ldes - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 pom diff --git a/ldi-orchestrator/ldio-application/pom.xml b/ldi-orchestrator/ldio-application/pom.xml index dbba854b1..1637fbe96 100644 --- a/ldi-orchestrator/ldio-application/pom.xml +++ b/ldi-orchestrator/ldio-application/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-orchestrator - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-common/pom.xml b/ldi-orchestrator/ldio-common/pom.xml index c8c08c06b..9f71899ae 100644 --- a/ldi-orchestrator/ldio-common/pom.xml +++ b/ldi-orchestrator/ldio-common/pom.xml @@ -5,7 +5,7 @@ ldi-orchestrator be.vlaanderen.informatievlaanderen.ldes.ldi - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-amqp/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-amqp/pom.xml index 669d201a8..77c340035 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-amqp/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-amqp/pom.xml @@ -6,7 +6,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldio-amqp diff --git a/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/pom.xml index 172ddfbf6..dac734274 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-archive-file-in/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldio-archive-file-in diff --git a/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/pom.xml index 50bc9d216..e1dbb0284 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-azure-blob-out/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT diff --git a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/pom.xml index ac6a13b5f..9f950330e 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-change-detection-filter/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldio-change-detection-filter diff --git a/ldi-orchestrator/ldio-connectors/ldio-console-out/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-console-out/pom.xml index 547c6e2a4..73899dd6a 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-console-out/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-console-out/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-file-out/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-file-out/pom.xml index bf18e09d4..8152dffda 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-file-out/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-file-out/pom.xml @@ -6,7 +6,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldio-file-out diff --git a/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/pom.xml index 0a73625f7..74d45d511 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-geojson-to-wkt/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldio-geojson-to-wkt diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/pom.xml index 421f75b37..aae2ff7ce 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/pom.xml @@ -5,7 +5,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/pom.xml index 55c38bf0a..6307b2907 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldio-http-in-poller diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-http-in/pom.xml index 54a3f3d15..08fff5071 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in/pom.xml @@ -4,7 +4,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-out/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-http-out/pom.xml index c9db4720f..be490d1ff 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-out/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-http-out/pom.xml @@ -3,7 +3,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/pom.xml index 774198530..e9d3e236f 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-json-to-ld-adapter/pom.xml @@ -5,7 +5,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-kafka/pom.xml index c95aa4db5..1f3027d3f 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/pom.xml @@ -5,7 +5,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/pom.xml index 8b6c88338..58ada3e1c 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/pom.xml @@ -5,7 +5,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml index d68148628..a8ee4b17d 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/pom.xml index 29adabc65..2ee863b72 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-ngsiv2-to-ld-adapter/pom.xml @@ -6,7 +6,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldio-ngsiv2-to-ld-adapter @@ -15,7 +15,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ngsiv2-to-ld-adapter - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT compile diff --git a/ldi-orchestrator/ldio-connectors/ldio-noop-out/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-noop-out/pom.xml index c26b9ea0e..5954a2e9b 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-noop-out/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-noop-out/pom.xml @@ -4,7 +4,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/pom.xml index d68daa460..315a0c74c 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-rdf-adapter/pom.xml @@ -5,7 +5,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/pom.xml index e3d94d870..47a1c148c 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-repository-materialiser/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldio-repository-materialiser diff --git a/ldi-orchestrator/ldio-connectors/ldio-request-executor/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-request-executor/pom.xml index 47a26960a..86d9782b9 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-request-executor/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-request-executor/pom.xml @@ -6,7 +6,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldio-request-executor diff --git a/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/pom.xml index 6c593306b..7b89e7e4f 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-rml-adapter/pom.xml @@ -5,7 +5,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/pom.xml index a64129e36..b9a9b3c79 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-sparql-construct/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldio ldio-connectors - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/pom.xml index 2c1fa82cc..c337ae49f 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-version-materialiser/pom.xml @@ -3,7 +3,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/pom.xml index beb12f2a7..2ab498fe4 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/pom.xml @@ -3,7 +3,7 @@ ldio-connectors be.vlaanderen.informatievlaanderen.ldes.ldio - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/ldio-connectors/pom.xml b/ldi-orchestrator/ldio-connectors/pom.xml index 4ba82346c..6c6b3231e 100644 --- a/ldi-orchestrator/ldio-connectors/pom.xml +++ b/ldi-orchestrator/ldio-connectors/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes.ldi ldi-orchestrator - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/ldi-orchestrator/pom.xml b/ldi-orchestrator/pom.xml index f8db05e4e..8c57eba7b 100644 --- a/ldi-orchestrator/pom.xml +++ b/ldi-orchestrator/pom.xml @@ -3,7 +3,7 @@ be.vlaanderen.informatievlaanderen.ldes linked-data-interactions - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index a98faaec1..243844a29 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ be.vlaanderen.informatievlaanderen.ldes linked-data-interactions pom - 2.7.0-SNAPSHOT + 2.8.0-SNAPSHOT ldi-api From 38e20502f45f0fe8040ea7a87a6a4f8190f89f32 Mon Sep 17 00:00:00 2001 From: Jonas Bulcke <127748878+jobulcke@users.noreply.github.com> Date: Thu, 20 Jun 2024 10:18:37 +0200 Subject: [PATCH 2/5] fix: code smells (#653) --- .../valueobject/SuppliedMemberTest.java | 7 +++-- .../ldes/ldi/MaterialiserTest.java | 1 - .../requestexecutor/RequestExecutorSteps.java | 8 ++--- .../ldi/SparqlConstructTransformerTest.java | 10 +++---- .../discoverer/valueobjects/HeadersTest.java | 3 -- .../ldes/ldio/LdioStepdefs.java | 2 +- .../valueobjects/ComponentPropertiesTest.java | 29 ++++++++++++------- .../ldio/config/LdioAmqpInAutoConfigTest.java | 9 +++--- .../config/KafkaInIntegrationTestSteps.java | 3 +- .../config/LdioKafkaInAutoConfigTest.java | 6 ++-- 10 files changed, 40 insertions(+), 38 deletions(-) diff --git a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/domain/valueobject/SuppliedMemberTest.java b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/domain/valueobject/SuppliedMemberTest.java index 7e324ac35..38e13e4cf 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/domain/valueobject/SuppliedMemberTest.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/domain/valueobject/SuppliedMemberTest.java @@ -4,7 +4,7 @@ import org.apache.jena.rdf.model.ModelFactory; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; class SuppliedMemberTest { @@ -13,8 +13,9 @@ void when_SuppliedMemberIsCreated_ModelIsDeepCopied() { Model model = ModelFactory.createDefaultModel(); SuppliedMember suppliedMember = new SuppliedMember("id", model); - model = null; - assertNotNull(suppliedMember.getModel()); + assertThat(suppliedMember.getModel()) + .isNotNull() + .matches(Model::isEmpty); } } \ No newline at end of file diff --git a/ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/MaterialiserTest.java b/ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/MaterialiserTest.java index f056a4d18..30cb8e3f7 100644 --- a/ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/MaterialiserTest.java +++ b/ldi-core/repository-materialiser/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/MaterialiserTest.java @@ -7,7 +7,6 @@ import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.Resource; import org.eclipse.rdf4j.model.impl.SimpleValueFactory; -import org.eclipse.rdf4j.query.Update; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; import org.eclipse.rdf4j.repository.RepositoryException; diff --git a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/RequestExecutorSteps.java b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/RequestExecutorSteps.java index a727af65e..ba7fcf72d 100644 --- a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/RequestExecutorSteps.java +++ b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/RequestExecutorSteps.java @@ -136,14 +136,14 @@ public void iHaveARequestExecutorWithRateLimiter() { @Then("It takes approximately {int} ms to execute the request {int} times") public void itTakesSecondsToExecuteTheRequestTimes(int ms, int requestCount) { - LocalDateTime start = LocalDateTime.now(); + LocalDateTime startTime = LocalDateTime.now(); for (int i = 0; i < requestCount; i++) { response = requestExecutor.execute(request); } - LocalDateTime end = LocalDateTime.now(); + LocalDateTime endTime = LocalDateTime.now(); - assertTrue(Duration.between(start, end).toMillis() > ms - 250); - assertTrue(Duration.between(start, end).toMillis() < ms + 250); + assertTrue(Duration.between(startTime, endTime).toMillis() > ms - 250); + assertTrue(Duration.between(startTime, endTime).toMillis() < ms + 250); } @Given("I have a requestExecutor which does {int} retries with custom http status code {int} and limits requests") diff --git a/ldi-core/sparql-construct/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/SparqlConstructTransformerTest.java b/ldi-core/sparql-construct/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/SparqlConstructTransformerTest.java index 862500a15..147ca99d0 100644 --- a/ldi-core/sparql-construct/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/SparqlConstructTransformerTest.java +++ b/ldi-core/sparql-construct/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/SparqlConstructTransformerTest.java @@ -26,7 +26,7 @@ class SparqlConstructTransformerTest { private final static Model INIT_MODEL = ModelFactory.createDefaultModel(); - private final static String constructQuery = """ + private final static String defaultConstructQuery = """ CONSTRUCT { "Transformed data" } @@ -60,7 +60,7 @@ class SparqlConstructTransformerTest { @Test void when_executeTransform_ExpectTransformedModel() { SparqlConstructTransformer sparqlConstructTransformer = new SparqlConstructTransformer( - QueryFactory.create(constructQuery), false); + QueryFactory.create(defaultConstructQuery), false); Model model = ModelFactory.createDefaultModel().add(originalData); @@ -74,7 +74,7 @@ void when_executeTransform_ExpectTransformedModel() { @Test void when_executeTransform_includeOriginal_ExpectTransformedModelWithOriginal() { SparqlConstructTransformer sparqlConstructTransformer = new SparqlConstructTransformer( - QueryFactory.create(constructQuery), true); + QueryFactory.create(defaultConstructQuery), true); Model model = ModelFactory.createDefaultModel().add(originalData); @@ -155,9 +155,7 @@ private void assertModels(List expectedModelPaths, Collection res @Test void initGeoFunctionsTest() { - - SparqlConstructTransformer sparqlConstructTransformer = new SparqlConstructTransformer( - QueryFactory.create(geoConstructFirstCoordinateQuery), false); + new SparqlConstructTransformer(QueryFactory.create(geoConstructFirstCoordinateQuery), false); FunctionRegistry registry = FunctionRegistry.get(); diff --git a/ldi-extensions/ldes-discoverer/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/discoverer/valueobjects/HeadersTest.java b/ldi-extensions/ldes-discoverer/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/discoverer/valueobjects/HeadersTest.java index ac477823c..e5a1f2fdd 100644 --- a/ldi-extensions/ldes-discoverer/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/discoverer/valueobjects/HeadersTest.java +++ b/ldi-extensions/ldes-discoverer/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/discoverer/valueobjects/HeadersTest.java @@ -2,7 +2,6 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.discoverer.HeadersMatcher; import org.apache.http.Header; -import org.apache.http.message.BasicHeader; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -13,9 +12,7 @@ import java.util.Collection; import java.util.List; -import static be.vlaanderen.informatievlaanderen.ldes.ldi.discoverer.HeadersMatcher.containsAllHeaders; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) diff --git a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioStepdefs.java b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioStepdefs.java index bd9522d9a..d7e1cdeb1 100644 --- a/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioStepdefs.java +++ b/ldi-orchestrator/ldio-application/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioStepdefs.java @@ -115,7 +115,7 @@ public void theExpectedPipelineHasOneTransformer(int count) { } private void postPipeline(String filePath, String contentType, int statusCode) throws IOException { - var content = IOUtils.toString(new FileInputStream(filePath)); + var content = IOUtils.toByteArray(new FileInputStream(filePath)); client.post() .uri(managementURI) .contentType(MediaType.valueOf(contentType)) diff --git a/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentPropertiesTest.java b/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentPropertiesTest.java index 7b71c5aeb..b53ecc416 100644 --- a/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentPropertiesTest.java +++ b/ldi-orchestrator/ldio-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/valueobjects/ComponentPropertiesTest.java @@ -7,8 +7,9 @@ import java.io.IOException; import java.nio.file.Files; import java.util.Map; -import java.util.Optional; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.*; class ComponentPropertiesTest { @@ -180,32 +181,38 @@ void shouldReturnEmptyWhenPropertyIsMissing() { @Nested class GetOptionalPropertyFromFile { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName, Map.of( - "non-existant", "non-existant-file", - "query", "src/test/resources/query.rq")); + ComponentProperties componentProperties; @Test void shouldReturnEmptyIfFileMissing() { - assertTrue(componentProperties.getOptionalPropertyFromFile("non-existant").isEmpty()); + componentProperties = new ComponentProperties(pipelineName, componentName, Map.of( + "non-existant", "non-existant-file", + "query", "src/test/resources/query.rq")); + + assertThat(componentProperties.getOptionalPropertyFromFile("non-existant")).isEmpty(); } @Test void shouldThrowExceptionIfUnreadableFile() throws IOException { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName, + componentProperties = new ComponentProperties(pipelineName, componentName, Map.of("non-regular-file", Files.createTempDirectory("queryDir").toFile().getAbsolutePath())); - assertThrows(IllegalArgumentException.class, - () -> componentProperties.getOptionalPropertyFromFile("non-regular-file")); + assertThatThrownBy(() -> componentProperties.getOptionalPropertyFromFile("non-regular-file")) + .isInstanceOf(IllegalArgumentException.class); } @Test void shouldReturnFileContentsWhenFileExistsAndIsReadable() { - assertEquals("sparql", componentProperties.getOptionalPropertyFromFile("query").get()); + componentProperties = new ComponentProperties(pipelineName, componentName, Map.of( + "non-existant", "non-existant-file", + "query", "src/test/resources/query.rq")); + + assertThat(componentProperties.getOptionalPropertyFromFile("query")).contains("sparql"); } @Test void shouldReturnEmptyIfNotFilePath() { - ComponentProperties componentProperties = new ComponentProperties(pipelineName, componentName, + componentProperties = new ComponentProperties(pipelineName, componentName, Map.of("query", """ PREFIX schema: @@ -218,7 +225,7 @@ void shouldReturnEmptyIfNotFilePath() { } """)); - assertEquals(Optional.empty(), componentProperties.getOptionalPropertyFromFile("query")); + assertThat(componentProperties.getOptionalPropertyFromFile("query")).isEmpty(); } } diff --git a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfigTest.java b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfigTest.java index 26cef4ee6..c140c598f 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfigTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-amqp/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioAmqpInAutoConfigTest.java @@ -16,6 +16,7 @@ class LdioAmqpInAutoConfigTest { private ApplicationEventPublisher applicationEventPublisher = mock(ApplicationEventPublisher.class); + @Test void shouldThrowExceptionWhenInvalidUrlConfig() { var configurator = new LdioAmqpInAutoConfig.LdioJmsInConfigurator( @@ -26,11 +27,11 @@ void shouldThrowExceptionWhenInvalidUrlConfig() { ComponentProperties componentProperties = new ComponentProperties("pipelineName", NAME, config); IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, - () -> configurator.configure((content) -> Stream.of(), null, applicationEventPublisher, componentProperties)); + () -> configurator.configure(content -> Stream.of(), null, applicationEventPublisher, componentProperties)); assertEquals("Property remote-url is not in format of either " + - "'amqp[s]://hostname:port[?option=value[&option2=value...]]' or " + - "'amqpws[s]://hostname:port[/path][?option=value[&option2=value...]]", exception.getMessage()); + "'amqp[s]://hostname:port[?option=value[&option2=value...]]' or " + + "'amqpws[s]://hostname:port[/path][?option=value[&option2=value...]]", exception.getMessage()); } @Test @@ -41,7 +42,7 @@ void shouldNotThrowExceptionWhenNoUrlConfig() { Map config = getBasicConfig(); assertDoesNotThrow( - () -> configurator.configure((content) -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); + () -> configurator.configure(content -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); } private Map getBasicConfig() { diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaInIntegrationTestSteps.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaInIntegrationTestSteps.java index 252d662a8..6256e4e49 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaInIntegrationTestSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/KafkaInIntegrationTestSteps.java @@ -55,7 +55,6 @@ public void iPrepareTheResultLists() { componentExecutorResult = new ArrayList<>(); } - @SuppressWarnings("unchecked") @And("I start a listener with an LdioKafkaIn component") public void iCreateAnLdioKafkaInComponent() { ComponentProperties properties = new ComponentProperties("pipelineName", NAME, config); @@ -112,7 +111,7 @@ public void theListenerWillWaitForTheMessage() { } @Then("Wait for a grace period") - public void theListenerWillWaitForPeriod() throws InterruptedException { + public void theListenerWillWaitForPeriod() { Awaitility.waitAtMost(1500, TimeUnit.MILLISECONDS); } diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaInAutoConfigTest.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaInAutoConfigTest.java index 6a0995eca..5f1fe83e9 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaInAutoConfigTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/config/LdioKafkaInAutoConfigTest.java @@ -33,7 +33,7 @@ void shouldThrowExceptionWhenInvalidAuthConfig() { ComponentProperties componentProperties = new ComponentProperties("pipelineName", NAME, config); IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, - () -> configurator.configure((content) -> Stream.of(), null, applicationEventPublisher, componentProperties)); + () -> configurator.configure(content -> Stream.of(), null, applicationEventPublisher, componentProperties)); assertEquals("java.lang.IllegalArgumentException: Invalid 'security-protocol', " + "the supported protocols are: [NO_AUTH, SASL_SSL_PLAIN]", exception.getMessage()); @@ -46,7 +46,7 @@ void shouldNotThrowExceptionWhenNoAuthConfig() { Map config = getBasicConfig(); assertDoesNotThrow( - () -> configurator.configure((content) -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); + () -> configurator.configure(content -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); } @Test @@ -59,7 +59,7 @@ void shouldNotThrowExceptionWhenSaslSslPlain() { config.put(KafkaInConfigKeys.SASL_JAAS_PASSWORD, "secret"); assertDoesNotThrow( - () -> configurator.configure((content) -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); + () -> configurator.configure(content -> Stream.of(), null, applicationEventPublisher, new ComponentProperties("pipelineName", NAME, config))); } private Map getBasicConfig() { From c81ea87a3f35125469e19caefb2c7ad35a6402ee Mon Sep 17 00:00:00 2001 From: Jan Robert <15772440+Yalz@users.noreply.github.com> Date: Tue, 25 Jun 2024 13:36:51 +0200 Subject: [PATCH 3/5] feat: ldes client status (#654) Co-authored-by: Yalz --- .../treenodesupplier/TreeNodeProcessor.java | 25 +- .../domain/valueobject/ClientStatus.java | 5 + .../performance/TreeNodeProcessorFactory.java | 4 +- .../treenodesupplier/MemberSupplierSteps.java | 15 +- .../ldi/processors/LdesClientProcessor.java | 13 +- .../LdioLdesClientConnectorAutoConfig.java | 16 +- .../ldio-connectors/ldio-ldes-client/pom.xml | 5 + .../ldes/ldio/LdioLdesClient.java | 13 +- .../ldio/config/LdioLdesClientAutoConfig.java | 15 +- .../ldio/config/MemberSupplierFactory.java | 9 +- .../status/ClientStatusConsumer.java | 28 ++ .../status/ClientStatusController.java | 51 +++ .../status/ClientStatusService.java | 40 +++ .../management/status/ClientStatusTo.java | 6 + .../ldes/ldio/LdioLdesClientTest.java | 8 +- .../ldio/config/LdioLdesClientITSteps.java | 18 +- .../config/MemberSupplierFactoryTest.java | 17 +- .../status/ClientStatusServiceTest.java | 37 +++ .../resources/features/ldes-client-in.feature | 12 +- .../mappings/page-without-relations.json | 314 ++++++++++++++++++ 20 files changed, 606 insertions(+), 45 deletions(-) create mode 100644 ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/domain/valueobject/ClientStatus.java create mode 100644 ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusConsumer.java create mode 100644 ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusController.java create mode 100644 ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusService.java create mode 100644 ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusTo.java create mode 100644 ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusServiceTest.java create mode 100644 ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/mappings/page-without-relations.json diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/TreeNodeProcessor.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/TreeNodeProcessor.java index 98d5c2b0c..6d4465123 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/TreeNodeProcessor.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/TreeNodeProcessor.java @@ -14,9 +14,12 @@ import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.List; +import java.util.Objects; import java.util.Optional; +import java.util.function.Consumer; import static java.lang.Thread.sleep; +import static ldes.client.treenodesupplier.domain.valueobject.ClientStatus.*; public class TreeNodeProcessor { @@ -25,13 +28,16 @@ public class TreeNodeProcessor { private final TreeNodeFetcher treeNodeFetcher; private final LdesMetaData ldesMetaData; private final RequestExecutor requestExecutor; + private final Consumer clientStatusConsumer; private MemberRecord memberRecord; public TreeNodeProcessor(LdesMetaData ldesMetaData, StatePersistence statePersistence, - RequestExecutor requestExecutor, TimestampExtractor timestampExtractor) { + RequestExecutor requestExecutor, TimestampExtractor timestampExtractor, + Consumer clientStatusConsumer) { this.treeNodeRecordRepository = statePersistence.getTreeNodeRecordRepository(); this.memberRepository = statePersistence.getMemberRepository(); this.requestExecutor = requestExecutor; + this.clientStatusConsumer = clientStatusConsumer; this.treeNodeFetcher = new TreeNodeFetcher(requestExecutor, timestampExtractor); this.ldesMetaData = ldesMetaData; } @@ -99,11 +105,24 @@ private void saveNewRelations(TreeNodeResponse treeNodeResponse) { } private TreeNodeRecord getNextTreeNode() { - return treeNodeRecordRepository + TreeNodeRecord treeNodeRecord = treeNodeRecordRepository .getTreeNodeRecordWithStatusAndEarliestNextVisit(TreeNodeStatus.IMMUTABLE_WITH_UNPROCESSED_MEMBERS) .orElseGet(() -> treeNodeRecordRepository.getTreeNodeRecordWithStatusAndEarliestNextVisit(TreeNodeStatus.NOT_VISITED) .orElseGet(() -> treeNodeRecordRepository.getTreeNodeRecordWithStatusAndEarliestNextVisit(TreeNodeStatus.MUTABLE_AND_ACTIVE) - .orElseThrow(() -> new EndOfLdesException("No fragments to mutable or new fragments to process -> LDES ends.")))); + .orElseThrow(() -> { + clientStatusConsumer.accept(COMPLETED); + return new EndOfLdesException("No fragments to mutable or new fragments to process -> LDES ends."); + }))); + + if (Objects.requireNonNull(treeNodeRecord.getTreeNodeStatus()) == TreeNodeStatus.IMMUTABLE_WITH_UNPROCESSED_MEMBERS || + treeNodeRecord.getTreeNodeStatus() == TreeNodeStatus.IMMUTABLE_WITHOUT_UNPROCESSED_MEMBERS || + treeNodeRecord.getTreeNodeStatus() == TreeNodeStatus.NOT_VISITED) { + clientStatusConsumer.accept(REPLICATING); + } else if (treeNodeRecord.getTreeNodeStatus() == TreeNodeStatus.MUTABLE_AND_ACTIVE) { + clientStatusConsumer.accept(SYNCHRONISING); + } + + return treeNodeRecord; } private void waitUntilNextVisit(TreeNodeRecord treeNodeRecord) { diff --git a/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/domain/valueobject/ClientStatus.java b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/domain/valueobject/ClientStatus.java new file mode 100644 index 000000000..b2dc3c64c --- /dev/null +++ b/ldi-core/ldes-client/tree-node-supplier/src/main/java/ldes/client/treenodesupplier/domain/valueobject/ClientStatus.java @@ -0,0 +1,5 @@ +package ldes.client.treenodesupplier.domain.valueobject; + +public enum ClientStatus { + REPLICATING, SYNCHRONISING, COMPLETED, ERROR +} diff --git a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/performance/TreeNodeProcessorFactory.java b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/performance/TreeNodeProcessorFactory.java index db301dbea..311f71e4a 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/performance/TreeNodeProcessorFactory.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/performance/TreeNodeProcessorFactory.java @@ -19,9 +19,11 @@ import ldes.client.treenodesupplier.repository.MemberVersionRepository; import ldes.client.treenodesupplier.repository.TreeNodeRecordRepository; import org.apache.jena.riot.Lang; +import org.mockito.Mockito; import org.testcontainers.containers.PostgreSQLContainer; import java.util.List; +import java.util.function.Consumer; class TreeNodeProcessorFactory { @@ -36,7 +38,7 @@ TreeNodeProcessor createTreeNodeProcessor(StatePersistenceStrategy statePersiste }; final RequestExecutor requestExecutor = requestExecutorFactory.createNoAuthExecutor(); final TimestampExtractor timestampExtractor = new TimestampFromCurrentTimeExtractor(); - return new TreeNodeProcessor(ldesMetaData, statePersistence, requestExecutor, timestampExtractor); + return new TreeNodeProcessor(ldesMetaData, statePersistence, requestExecutor, timestampExtractor, Mockito.mock(Consumer.class)); } private PostgreSQLContainer startPostgresContainer() { diff --git a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/MemberSupplierSteps.java b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/MemberSupplierSteps.java index 8856e5529..0c5c84ab8 100644 --- a/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/MemberSupplierSteps.java +++ b/ldi-core/ldes-client/tree-node-supplier/src/test/java/ldes/client/treenodesupplier/MemberSupplierSteps.java @@ -15,10 +15,7 @@ import ldes.client.treenodesupplier.domain.services.MemberRepositoryFactory; import ldes.client.treenodesupplier.domain.services.MemberVersionRepositoryFactory; import ldes.client.treenodesupplier.domain.services.TreeNodeRecordRepositoryFactory; -import ldes.client.treenodesupplier.domain.valueobject.LdesMetaData; -import ldes.client.treenodesupplier.domain.valueobject.StatePersistence; -import ldes.client.treenodesupplier.domain.valueobject.SuppliedMember; -import ldes.client.treenodesupplier.domain.valueobject.TreeNodeStatus; +import ldes.client.treenodesupplier.domain.valueobject.*; import ldes.client.treenodesupplier.filters.ExactlyOnceFilter; import ldes.client.treenodesupplier.filters.LatestStateFilter; import ldes.client.treenodesupplier.filters.MemberFilter; @@ -31,9 +28,11 @@ import ldes.client.treenodesupplier.repository.TreeNodeRecordRepository; import org.apache.jena.riot.Lang; import org.junit.After; +import org.mockito.Mockito; import org.testcontainers.containers.PostgreSQLContainer; import java.util.List; +import java.util.function.Consumer; import static org.apache.jena.rdf.model.ResourceFactory.createProperty; import static org.assertj.core.api.Assertions.assertThat; @@ -50,6 +49,7 @@ public class MemberSupplierSteps { private LdesMetaData ldesMetaData; private SuppliedMember suppliedMember; private PostgreSQLContainer postgreSQLContainer; + private final Consumer clientStatusConsumer = Mockito.mock(Consumer.class); // Multi MemberSupplier private final MemberSupplier[] memberSuppliers = new MemberSupplier[2]; @@ -105,7 +105,8 @@ public void iCreateAProcessor() { treeNodeProcessor = new TreeNodeProcessor(ldesMetaData, new StatePersistence(memberRepository, memberIdRepository, treeNodeRecordRepository, memberVersionRepository), requestExecutorFactory.createNoAuthExecutor(), - timestampPath.isEmpty() ? new TimestampFromCurrentTimeExtractor() : new TimestampFromPathExtractor(createProperty(timestampPath))); + timestampPath.isEmpty() ? new TimestampFromCurrentTimeExtractor() : new TimestampFromPathExtractor(createProperty(timestampPath)), + clientStatusConsumer); } @Then("Member {string} is processed") @@ -206,11 +207,11 @@ public void aStatePersistenceStrategyProcessorAndAStatePersistenceStrategyProces memberSuppliers[0] = new MemberSupplierImpl(new TreeNodeProcessor(ldesMetaData, defineStatePersistence(arg0), requestExecutorFactory.createNoAuthExecutor(), - new TimestampFromPathExtractor(createProperty(timestampPath))), false); + new TimestampFromPathExtractor(createProperty(timestampPath)), clientStatusConsumer), false); memberSuppliers[1] = new MemberSupplierImpl(new TreeNodeProcessor(ldesMetaData, defineStatePersistence(arg1), requestExecutorFactory.createNoAuthExecutor(), - new TimestampFromPathExtractor(createProperty(timestampPath))), false); + new TimestampFromPathExtractor(createProperty(timestampPath)), clientStatusConsumer), false); } @When("I request one member from the MemberSuppliers") diff --git a/ldi-nifi/ldi-nifi-processors/ldes-client-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/LdesClientProcessor.java b/ldi-nifi/ldi-nifi-processors/ldes-client-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/LdesClientProcessor.java index 22bfb1163..ffe7745e2 100644 --- a/ldi-nifi/ldi-nifi-processors/ldes-client-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/LdesClientProcessor.java +++ b/ldi-nifi/ldi-nifi-processors/ldes-client-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/LdesClientProcessor.java @@ -14,10 +14,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.timestampextractor.TimestampFromPathExtractor; import io.github.resilience4j.retry.Retry; import ldes.client.treenodesupplier.TreeNodeProcessor; -import ldes.client.treenodesupplier.domain.valueobject.EndOfLdesException; -import ldes.client.treenodesupplier.domain.valueobject.LdesMetaData; -import ldes.client.treenodesupplier.domain.valueobject.StatePersistence; -import ldes.client.treenodesupplier.domain.valueobject.SuppliedMember; +import ldes.client.treenodesupplier.domain.valueobject.*; import ldes.client.treenodesupplier.filters.ExactlyOnceFilter; import ldes.client.treenodesupplier.filters.LatestStateFilter; import ldes.client.treenodesupplier.membersuppliers.FilteredMemberSupplier; @@ -47,6 +44,7 @@ import java.util.List; import java.util.Set; +import java.util.function.Consumer; import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.config.CommonProperties.DATA_DESTINATION_FORMAT; import static be.vlaanderen.informatievlaanderen.ldes.ldi.processors.config.LdesProcessorProperties.*; @@ -115,7 +113,8 @@ public void onScheduled(final ProcessContext context) { String timestampPath = LdesProcessorProperties.getTimestampPath(context); TimestampExtractor timestampExtractor = timestampPath.isBlank() ? new TimestampFromCurrentTimeExtractor() : new TimestampFromPathExtractor(createProperty(timestampPath)); - TreeNodeProcessor treeNodeProcessor = new TreeNodeProcessor(ldesMetaData, statePersistence, requestExecutor, timestampExtractor); + TreeNodeProcessor treeNodeProcessor = new TreeNodeProcessor(ldesMetaData, statePersistence, requestExecutor, + timestampExtractor, clientStatusConsumer()); keepState = stateKept(context); final MemberSupplierImpl baseMemberSupplier = new MemberSupplierImpl(treeNodeProcessor, keepState); @@ -231,4 +230,8 @@ public static String convertModelToString(Model model, Lang dataDestinationForma return RDFWriter.source(model).lang(dataDestinationFormat).asString(); } + private Consumer clientStatusConsumer() { + return status -> LOGGER.info("LDES Client is now {}", status); + } + } diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientConnectorAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientConnectorAutoConfig.java index a1e3cdd96..61616728a 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientConnectorAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientConnectorAutoConfig.java @@ -12,6 +12,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientConnectorApi; import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; import be.vlaanderen.informatievlaanderen.ldes.ldio.event.LdesClientConnectorApiCreatedEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusConsumer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusService; import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; @@ -32,8 +34,9 @@ public class LdioLdesClientConnectorAutoConfig { @Bean(NAME) public LdioInputConfigurator ldioConfigurator(ApplicationEventPublisher eventPublisher, + ClientStatusService clientStatusService, ObservationRegistry observationRegistry) { - return new LdioClientConnectorConfigurator(eventPublisher, observationRegistry); + return new LdioClientConnectorConfigurator(eventPublisher, clientStatusService, observationRegistry); } public static class LdioClientConnectorConfigurator implements LdioInputConfigurator { @@ -42,12 +45,15 @@ public static class LdioClientConnectorConfigurator implements LdioInputConfigur public static final String PROXY_URL_TO_REPLACE = "proxy-url-to-replace"; public static final String PROXY_URL_REPLACEMENT = "proxy-url-replacement"; private final ApplicationEventPublisher eventPublisher; + private final ClientStatusService clientStatusService; private final ObservationRegistry observationRegistry; private final RequestExecutorFactory requestExecutorFactory = new RequestExecutorFactory(false); private final RequestExecutor baseRequestExecutor = requestExecutorFactory.createNoAuthExecutor(); - public LdioClientConnectorConfigurator(ApplicationEventPublisher eventPublisher, ObservationRegistry observationRegistry) { + public LdioClientConnectorConfigurator(ApplicationEventPublisher eventPublisher, ClientStatusService clientStatusService, + ObservationRegistry observationRegistry) { this.eventPublisher = eventPublisher; + this.clientStatusService = clientStatusService; this.observationRegistry = observationRegistry; } @@ -62,11 +68,13 @@ public LdioInput configure(LdiAdapter adapter, ComponentExecutor executor, Appli final var urlProxy = getEdcUrlProxy(properties); final var edcRequestExecutor = requestExecutorFactory.createEdcExecutor(baseRequestExecutor, tokenService, urlProxy); - final MemberSupplier memberSupplier = new MemberSupplierFactory(properties, edcRequestExecutor).getMemberSupplier(); + final var clientStatusConsumer = new ClientStatusConsumer(pipelineName, clientStatusService); + final MemberSupplier memberSupplier = new MemberSupplierFactory(properties, edcRequestExecutor, + clientStatusConsumer).getMemberSupplier(); final boolean keepState = properties.getOptionalBoolean(KEEP_STATE).orElse(false); final LdioObserver ldioObserver = LdioObserver.register(NAME, pipelineName, observationRegistry); final var ldesClient = new LdioLdesClient(executor, ldioObserver, memberSupplier, - applicationEventPublisher, keepState); + applicationEventPublisher, keepState, clientStatusConsumer); eventPublisher.publishEvent(new LdesClientConnectorApiCreatedEvent(pipelineName, new LdioLdesClientConnectorApi(transferService, tokenService, ldesClient))); ldesClient.start(); diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml index a8ee4b17d..0ff742168 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/pom.xml @@ -68,5 +68,10 @@ ldi-infra-sql ${project.version} + + org.springdoc + springdoc-openapi-starter-webmvc-ui + ${springdoc-openapi.version} + \ No newline at end of file diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClient.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClient.java index fb0bf0d79..a6aee3214 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClient.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClient.java @@ -2,9 +2,11 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineShutdownEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusConsumer; import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatusTrigger; +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; import ldes.client.treenodesupplier.domain.valueobject.EndOfLdesException; import ldes.client.treenodesupplier.membersuppliers.MemberSupplier; import org.slf4j.Logger; @@ -26,16 +28,18 @@ public class LdioLdesClient extends LdioInput { private boolean paused = false; private final boolean keepState; private final String pipelineName; + private final ClientStatusConsumer clientStatusConsumer; public LdioLdesClient(ComponentExecutor componentExecutor, - LdioObserver ldioObserver, - MemberSupplier memberSupplier, - ApplicationEventPublisher applicationEventPublisher, - boolean keepState) { + LdioObserver ldioObserver, + MemberSupplier memberSupplier, + ApplicationEventPublisher applicationEventPublisher, + boolean keepState, ClientStatusConsumer clientStatusConsumer) { super(componentExecutor, null, ldioObserver, applicationEventPublisher); this.pipelineName = ldioObserver.getPipelineName(); this.memberSupplier = memberSupplier; this.keepState = keepState; + this.clientStatusConsumer = clientStatusConsumer; } @Override @@ -64,6 +68,7 @@ private synchronized void run() { } catch (EndOfLdesException e) { shutdownPipeline(); } catch (Exception e) { + clientStatusConsumer.accept(ClientStatus.ERROR); log.error("LdesClientRunner FAILURE: {}", e.getMessage()); } } diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientAutoConfig.java index 6dc7728cd..5d7ae7853 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientAutoConfig.java @@ -5,6 +5,8 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiAdapter; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClient; import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioInputConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusConsumer; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusService; import be.vlaanderen.informatievlaanderen.ldes.ldio.requestexecutor.LdioRequestExecutorSupplier; import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioInput; import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; @@ -21,15 +23,17 @@ public class LdioLdesClientAutoConfig { @SuppressWarnings("java:S6830") @Bean(LdioLdesClient.NAME) - public LdioInputConfigurator ldioConfigurator(ObservationRegistry observationRegistry) { - return new LdioLdesClientConfigurator(observationRegistry); + public LdioInputConfigurator ldioConfigurator(ClientStatusService clientStatusService, ObservationRegistry observationRegistry) { + return new LdioLdesClientConfigurator(clientStatusService, observationRegistry); } public static class LdioLdesClientConfigurator implements LdioInputConfigurator { + private final ClientStatusService clientStatusService; private final ObservationRegistry observationRegistry; - public LdioLdesClientConfigurator(ObservationRegistry observationRegistry) { + public LdioLdesClientConfigurator(ClientStatusService clientStatusService, ObservationRegistry observationRegistry) { + this.clientStatusService = clientStatusService; this.observationRegistry = observationRegistry; } @@ -40,10 +44,11 @@ public LdioInput configure(LdiAdapter adapter, ComponentExecutor componentExecut String pipelineName = properties.getPipelineName(); final var requestExecutorFactory = new RequestExecutorFactory(false); final var requestExecutor = new LdioRequestExecutorSupplier(requestExecutorFactory).getRequestExecutor(properties); - final MemberSupplier memberSupplier = new MemberSupplierFactory(properties, requestExecutor).getMemberSupplier(); + final var clientStatusConsumer = new ClientStatusConsumer(pipelineName, clientStatusService); + final MemberSupplier memberSupplier = new MemberSupplierFactory(properties, requestExecutor, clientStatusConsumer).getMemberSupplier(); final boolean keepState = properties.getOptionalBoolean(KEEP_STATE).orElse(false); final LdioObserver ldioObserver = LdioObserver.register(LdioLdesClient.NAME, pipelineName, observationRegistry); - final var ldesClient = new LdioLdesClient(componentExecutor, ldioObserver, memberSupplier, applicationEventPublisher, keepState); + final var ldesClient = new LdioLdesClient(componentExecutor, ldioObserver, memberSupplier, applicationEventPublisher, keepState, clientStatusConsumer); ldesClient.start(); return ldesClient; } diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java index 258b1cd6b..93d5867a0 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactory.java @@ -9,6 +9,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.InvalidConfigException; import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; import ldes.client.treenodesupplier.TreeNodeProcessor; +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; import ldes.client.treenodesupplier.domain.valueobject.LdesMetaData; import ldes.client.treenodesupplier.domain.valueobject.StatePersistence; import ldes.client.treenodesupplier.filters.ExactlyOnceFilter; @@ -26,6 +27,7 @@ import java.util.List; import java.util.Optional; +import java.util.function.Consumer; import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientProperties.*; import static be.vlaanderen.informatievlaanderen.ldes.ldio.persistence.PersistenceProperties.KEEP_STATE; @@ -40,10 +42,13 @@ public class MemberSupplierFactory { private final ComponentProperties properties; private final RequestExecutor requestExecutor; + private final Consumer clientStatusConsumer; - public MemberSupplierFactory(ComponentProperties properties, RequestExecutor requestExecutor) { + public MemberSupplierFactory(ComponentProperties properties, RequestExecutor requestExecutor, + Consumer clientStatusConsumer) { this.properties = properties; this.requestExecutor = requestExecutor; + this.clientStatusConsumer = clientStatusConsumer; } public MemberSupplier getMemberSupplier() { @@ -86,7 +91,7 @@ private TreeNodeProcessor getTreeNodeProcessor() { .map(timestampPath -> (TimestampExtractor) new TimestampFromPathExtractor(createProperty(timestampPath))) .orElseGet(TimestampFromCurrentTimeExtractor::new); - return new TreeNodeProcessor(ldesMetaData, getStatePersistence(), requestExecutor, timestampExtractor); + return new TreeNodeProcessor(ldesMetaData, getStatePersistence(), requestExecutor, timestampExtractor, clientStatusConsumer); } private StatePersistence getStatePersistence() { diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusConsumer.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusConsumer.java new file mode 100644 index 000000000..036160b93 --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusConsumer.java @@ -0,0 +1,28 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.management.status; + +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.function.Consumer; + +public class ClientStatusConsumer implements Consumer { + private final Logger log = LoggerFactory.getLogger(ClientStatusConsumer.class); + private final String pipelineId; + private final ClientStatusService statusService; + private ClientStatus previousState; + + public ClientStatusConsumer(String pipelineId, ClientStatusService statusService) { + this.pipelineId = pipelineId; + this.statusService = statusService; + } + + @Override + public void accept(ClientStatus clientStatus) { + if (clientStatus != previousState) { + log.info("LDES Client pipeline '{}' has status {}", pipelineId, clientStatus); + statusService.updateStatus(pipelineId, clientStatus); + previousState = clientStatus; + } + } +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusController.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusController.java new file mode 100644 index 000000000..0269d9261 --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusController.java @@ -0,0 +1,51 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.management.status; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@Tag(name = "LDES Client Status") +@RequestMapping("/admin/api/v1/pipeline/ldes-client") +public class ClientStatusController { + private final ClientStatusService clientStatusService; + + public ClientStatusController(ClientStatusService clientStatusService) { + this.clientStatusService = clientStatusService; + } + + @GetMapping() + @ApiResponse(responseCode = "200", description = "A list statuses of all active LDES Client pipelines.", content = { + @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, array = @ArraySchema(schema = @Schema(implementation = ClientStatusTo.class))), + }) + @Operation(summary = "Get a list of all LDES Client statuses pipelines.") + public List getStatusses() { + return clientStatusService.getClientStatuses(); + } + + @GetMapping(path = "{pipeline}", produces = "application/json") + @ApiResponse(responseCode = "200", description = "Status of a requested pipeline", content = { + @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ClientStatus.class)), + }) + @ApiResponse(responseCode = "404", description = "No LDES Client pipeline exists by that name", content = { + @Content(schema = @Schema()), + }) + @Operation(summary = "Get the status of a requested LDES Client pipeline.") + public ResponseEntity getPipelineStatus(@PathVariable("pipeline") String pipeline) { + return clientStatusService.getClientStatus(pipeline) + .map(ResponseEntity::ok) + .orElse(ResponseEntity.notFound().build()); + } +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusService.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusService.java new file mode 100644 index 000000000..0dc31f4cb --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusService.java @@ -0,0 +1,40 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.management.status; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +@Component +public class ClientStatusService { + private final Map clientStatuses; + + public ClientStatusService() { + this.clientStatuses = new HashMap<>(); + } + + public void updateStatus(String pipelineId, ClientStatus status) { + clientStatuses.put(pipelineId, status); + } + + public List getClientStatuses() { + return clientStatuses.entrySet() + .stream() + .map(entry -> new ClientStatusTo(entry.getKey(), entry.getValue())) + .toList(); + } + + public Optional getClientStatus(String pipelineId) { + return Optional.ofNullable(clientStatuses.get(pipelineId)); + } + + @EventListener + public void pipelineDeletedEventHandler(PipelineDeletedEvent event) { + clientStatuses.remove(event.pipelineId()); + } +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusTo.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusTo.java new file mode 100644 index 000000000..966c133df --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusTo.java @@ -0,0 +1,6 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.management.status; + +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; + +public record ClientStatusTo(String pipeline, ClientStatus status) { +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientTest.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientTest.java index 52d5dad91..1639ea962 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientTest.java @@ -3,6 +3,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineShutdownEvent; import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineStatusEvent; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusConsumer; import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioObserver; import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.PipelineStatus; import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.StatusChangeSource; @@ -36,6 +37,9 @@ class LdioLdesClientTest { @Mock private ApplicationEventPublisher eventPublisher; + @Mock + private ClientStatusConsumer clientStatusConsumer; + private LdioLdesClient client; private final String pipelineName = "pipeline"; @@ -47,8 +51,8 @@ void setUp() { observer, supplier, eventPublisher, - false - ); + false, + clientStatusConsumer); } @AfterEach diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientITSteps.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientITSteps.java index 0d216a8a7..9d713360a 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientITSteps.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioLdesClientITSteps.java @@ -2,6 +2,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.services.ComponentExecutor; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientProperties; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusService; import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; import com.github.tomakehurst.wiremock.WireMockServer; import io.cucumber.java.BeforeAll; @@ -9,6 +10,7 @@ import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; +import ldes.client.treenodesupplier.domain.valueobject.ClientStatus; import org.apache.jena.rdf.model.Model; import org.springframework.context.ApplicationEventPublisher; @@ -23,14 +25,15 @@ import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientProperties.URLS; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; import static org.awaitility.Awaitility.await; +import static org.mockito.Mockito.*; public class LdioLdesClientITSteps extends LdesClientInIT { private final static WireMockServer wireMockServer = new WireMockServer(options().port(10101)); - + private final String pipelineName = "pipelineName"; private final ApplicationEventPublisher applicationEventPublisher = applicationEventPublisher(); private final Map componentPropsMap = new HashMap<>(); private final List members = new ArrayList<>(); - + private final ClientStatusService statusService = mock(ClientStatusService.class); @BeforeAll public static void before_all() { @@ -57,8 +60,8 @@ public void iStartAnLdesLdioInComponentWithUrl() { members.clear(); ComponentExecutor componentExecutor = members::add; - var props = new ComponentProperties("pipelineName", NAME, componentPropsMap); - var ldioInputConfigurator = new LdioLdesClientAutoConfig().ldioConfigurator(null); + var props = new ComponentProperties(pipelineName, NAME, componentPropsMap); + var ldioInputConfigurator = new LdioLdesClientAutoConfig().ldioConfigurator(statusService, null); ldioInputConfigurator.configure(null, componentExecutor, applicationEventPublisher, props); } @@ -74,4 +77,11 @@ public void allMembersFromTheStreamArePassedToThePipeline(int memberCount) { public void iWantToConfigureTheFollowingProperties(Map properties) { this.componentPropsMap.putAll(properties); } + + @And("I expect {int} REPLICATING, {int} SYNCHRONISING and {int} COMPLETED updates") + public void iExpectREPLICATINGSYNCHRONISINGAndCOMPLETEDUpdates(int replicatingTimes, int synchronisingTimes, int completedTimes) { + verify(statusService, times(replicatingTimes)).updateStatus(pipelineName, ClientStatus.REPLICATING); + verify(statusService, times(synchronisingTimes)).updateStatus(pipelineName, ClientStatus.SYNCHRONISING); + verify(statusService, times(completedTimes)).updateStatus(pipelineName, ClientStatus.COMPLETED); + } } diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java index ea8af4fc0..31293a7dd 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/MemberSupplierFactoryTest.java @@ -1,6 +1,7 @@ package be.vlaanderen.informatievlaanderen.ldes.ldio.config; import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.ConfigPropertyMissingException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.management.status.ClientStatusConsumer; import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; import ldes.client.treenodesupplier.filters.LatestStateFilter; import ldes.client.treenodesupplier.membersuppliers.FilteredMemberSupplier; @@ -16,10 +17,12 @@ import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientProperties.*; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Mockito.mock; class MemberSupplierFactoryTest { private Map defaultInputConfig; + private final ClientStatusConsumer statusConsumer = mock(ClientStatusConsumer.class); @BeforeEach void setUp() { @@ -32,7 +35,7 @@ void when_VersionMaterialisationIsEnabled_then_VersionMaterialisedMemberSupplier defaultInputConfig.put(USE_VERSION_MATERIALISATION, "true"); final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier).isInstanceOf(VersionMaterialisedMemberSupplier.class); } @@ -42,7 +45,7 @@ void when_VersionMaterialisationAndOnlyOnceFilterAreNotEnabled_then_MemberSuppli defaultInputConfig.put(USE_EXACTLY_ONCE_FILTER, "false"); final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier).isInstanceOf(MemberSupplierImpl.class); } @@ -50,7 +53,7 @@ void when_VersionMaterialisationAndOnlyOnceFilterAreNotEnabled_then_MemberSuppli void when_VersionMaterialisationIsNotEnabled_then_OnlyOnceMemberSupplierIsReturned() { final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier).isInstanceOf(FilteredMemberSupplier.class); } @@ -61,7 +64,7 @@ void when_LatestStateFilterIsEnabled_then_returnVersionMaterialisedMemberSupplie defaultInputConfig.put(USE_LATEST_STATE_FILTER, "true"); final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier) .isInstanceOf(VersionMaterialisedMemberSupplier.class) @@ -75,7 +78,7 @@ void when_LatestStateFilterIsDisabled_then_returnVersionMaterialisedMemberSuppli defaultInputConfig.put(USE_LATEST_STATE_FILTER, "false"); final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier) .isInstanceOf(VersionMaterialisedMemberSupplier.class) @@ -89,7 +92,7 @@ void when_LatestStateFilterIsEnabledWithoutMaterialisation_then_returnMemberSupp defaultInputConfig.put(USE_LATEST_STATE_FILTER, "true"); final var componentProperties = new ComponentProperties("pipelineName", "cName", defaultInputConfig); - MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null).getMemberSupplier(); + MemberSupplier memberSupplier = new MemberSupplierFactory(componentProperties, null, statusConsumer).getMemberSupplier(); assertThat(memberSupplier).isInstanceOf(MemberSupplierImpl.class); } @@ -98,7 +101,7 @@ void when_LatestStateFilterIsEnabledWithoutMaterialisation_then_returnMemberSupp void when_NoUrlsAreConfigured_then_ThrowException() { final String expectedErrorMessage = "Pipeline \"pipelineName\": \"cName\" : Missing value for property \"urls\" ."; final var componentProperties = new ComponentProperties("pipelineName", "cName", Map.of("url", "http://localhost:8080/ldes")); - final MemberSupplierFactory memberSupplierFactory = new MemberSupplierFactory(componentProperties, null); + final MemberSupplierFactory memberSupplierFactory = new MemberSupplierFactory(componentProperties, null, statusConsumer); assertThatThrownBy(memberSupplierFactory::getMemberSupplier) .isInstanceOf(ConfigPropertyMissingException.class) .hasMessage(expectedErrorMessage); diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusServiceTest.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusServiceTest.java new file mode 100644 index 000000000..09d4b239f --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/management/status/ClientStatusServiceTest.java @@ -0,0 +1,37 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.management.status; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.events.PipelineDeletedEvent; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationEventPublisher; + +import static ldes.client.treenodesupplier.domain.valueobject.ClientStatus.REPLICATING; +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest(classes = ClientStatusService.class) +class ClientStatusServiceTest { + @Autowired + private ClientStatusService clientStatusService; + + @Autowired + private ApplicationEventPublisher eventPublisher; + + @Test + void test_baseFlow() { + String pipelineId = "1"; + + var status = clientStatusService.getClientStatus(pipelineId); + + assertThat(status).isEmpty(); + + clientStatusService.updateStatus(pipelineId, REPLICATING); + + assertThat(clientStatusService.getClientStatuses()).contains(new ClientStatusTo(pipelineId, REPLICATING)); + assertThat(clientStatusService.getClientStatus(pipelineId)).isNotEmpty(); + + eventPublisher.publishEvent(new PipelineDeletedEvent(pipelineId)); + + assertThat(clientStatusService.getClientStatus(pipelineId)).isEmpty(); + } +} diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/features/ldes-client-in.feature b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/features/ldes-client-in.feature index 623703306..6a3617e39 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/features/ldes-client-in.feature +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/features/ldes-client-in.feature @@ -8,6 +8,15 @@ Feature: LdesClientIntegrationTest And I configure this to be of RDF format "application/ld+json" When I start an ldes-ldio-in component Then All 6 members from the stream are passed to the pipeline + And I expect 1 REPLICATING, 0 SYNCHRONISING and 1 COMPLETED updates + + Scenario: Reading an Open LDES Stream + Given I want to follow the following LDES + | /page-without-relations | + And I configure this to be of RDF format "application/ld+json" + When I start an ldes-ldio-in component + Then All 2 members from the stream are passed to the pipeline + And I expect 1 REPLICATING, 1 SYNCHRONISING and 0 COMPLETED updates Scenario: Reading multiple LDES Streams Given I want to follow the following LDES @@ -15,6 +24,7 @@ Feature: LdesClientIntegrationTest | /items/grouped?group=2 | When I start an ldes-ldio-in component Then All 8 members from the stream are passed to the pipeline + And I expect 1 REPLICATING, 0 SYNCHRONISING and 1 COMPLETED updates Scenario Outline: Reading an LDES Stream with latest state filter enabled Given I want to follow the following LDES @@ -46,4 +56,4 @@ Feature: LdesClientIntegrationTest Examples: | isExactlyOnceFilterEnabled | expectedMemberSize | | true | 4 | - | false | 8 | + | false | 8 | \ No newline at end of file diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/mappings/page-without-relations.json b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/mappings/page-without-relations.json new file mode 100644 index 000000000..1c34f0584 --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client/src/test/resources/mappings/page-without-relations.json @@ -0,0 +1,314 @@ +{ + "mappings": [ + { + "scenarioName": "Mutable Fragment", + "newScenarioState": "Mutable Fragment was fetched once", + "request": { + "method": "GET", + "url": "/page-without-relations", + "headers": { + "Accept": { + "contains": "application/ld+json" + } + } + }, + "response": { + "status": 200, + "jsonBody": { + "@context": [ + "https://private-api.gipod.beta-vlaanderen.be/api/v1/context/gipod.jsonld" + ], + "@id": "http://localhost:10101/page-without-relations", + "@type": "Node", + "viewOf": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "collectionInfo": { + "@id": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "@type": "EventStream", + "shape": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances/shape", + "timestampPath": "prov:generatedAtTime", + "versionOfPath": "dct:isVersionOf" + }, + "items": [ + { + "@id": "https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/1", + "@type": "MobilityHindrance", + "gipodId": 10228787, + "identifier": [ + { + "@type": "Identifier", + "Identifier.identifier": { + "value": "10228787", + "type": "gipodId" + }, + "assignedByName": "https://gipod.vlaanderen.be" + } + ], + "isConsequenceOf": [ + { + "@id": "/api/v1/events/3773285", + "@type": "Event", + "gipodId": 3773285 + } + ], + "description": "Eetwagen", + "owner": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + }, + "contactOrganisation": [], + "zone": [ + { + "@id": "/api/v1/mobility-hindrances/10228787/zones/6dd8d314-9415-4103-bb06-c7c9fbf3dc19", + "@type": "Zone", + "consequence": [ + { + "@id": "/api/v1/taxonomies/mobility-hindrance/consequencetypes/c53813ab-814f-4ff4-8a87-6934c72e175f", + "prefLabel": "Geen doorgang voor gemotoriseerd verkeer" + } + ], + "geometry": { + "@type": "Geometry", + "wkt": " POLYGON ((109802.90525490482 189774.7184551563, 109801.10560758458 189779.91360264365, 109803.47330090578 189780.72935110983, 109805.27295029224 189775.5342052644, 109807.07260330272 189770.33905491605, 109804.70490584878 189769.52330316138, 109802.90525490482 189774.7184551563))" + }, + "zoneType": { + "@id": "/api/v1/taxonomies/zonetypes/0fb72ef7-6ac9-4a70-b295-a30ea215d250", + "prefLabel": "HinderZone" + } + } + ], + "period": [ + { + "@type": "Period", + "start": "2021-01-31T23:00:00Z", + "end": "2021-02-03T22:30:00Z" + } + ], + "timeSchedule": null, + "permittedBy": [], + "status": { + "@id": "/api/v1/taxonomies/statuses/a411c53e-db33-436a-9bb9-d62d535b661d", + "prefLabel": "Onbekend" + }, + "generatedAtTime": "2020-12-28T09:37:18.577Z", + "eventName": "MobilityHindranceWasImportedFromLegacy", + "isVersionOf": "/api/v1/mobility-hindrances/10228787", + "memberOf": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "lastModifiedOn": "2020-12-07T15:10:22.18Z", + "lastModifiedBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + }, + "createdOn": "2020-12-07T15:10:22.18Z", + "createdBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + } + } + ] + }, + "headers": { + "Content-Type": "application/ld+json;charset=UTF-8", + "Cache-Control": "public, max-age=1, mutable" + } + } + }, + { + "scenarioName": "Mutable Fragment", + "requiredScenarioState": "Mutable Fragment was fetched once", + "newScenarioState": "Mutable Fragment was fetched twice", + "request": { + "method": "GET", + "url": "/page-without-relations", + "headers": { + "Accept": { + "contains": "application/ld+json" + } + } + }, + "response": { + "status": 200, + "jsonBody": { + "@context": [ + "https://private-api.gipod.beta-vlaanderen.be/api/v1/context/gipod.jsonld" + ], + "@id": "http://localhost:10101/page-without-relations", + "@type": "Node", + "viewOf": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "collectionInfo": { + "@id": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "@type": "EventStream", + "shape": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances/shape", + "timestampPath": "prov:generatedAtTime", + "versionOfPath": "dct:isVersionOf" + }, + "items": [ + { + "@id": "https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/1", + "@type": "MobilityHindrance", + "gipodId": 10228787, + "identifier": [ + { + "@type": "Identifier", + "Identifier.identifier": { + "value": "10228787", + "type": "gipodId" + }, + "assignedByName": "https://gipod.vlaanderen.be" + } + ], + "isConsequenceOf": [ + { + "@id": "/api/v1/events/3773285", + "@type": "Event", + "gipodId": 3773285 + } + ], + "description": "Eetwagen", + "owner": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + }, + "contactOrganisation": [], + "zone": [ + { + "@id": "/api/v1/mobility-hindrances/10228787/zones/6dd8d314-9415-4103-bb06-c7c9fbf3dc19", + "@type": "Zone", + "consequence": [ + { + "@id": "/api/v1/taxonomies/mobility-hindrance/consequencetypes/c53813ab-814f-4ff4-8a87-6934c72e175f", + "prefLabel": "Geen doorgang voor gemotoriseerd verkeer" + } + ], + "geometry": { + "@type": "Geometry", + "wkt": " POLYGON ((109802.90525490482 189774.7184551563, 109801.10560758458 189779.91360264365, 109803.47330090578 189780.72935110983, 109805.27295029224 189775.5342052644, 109807.07260330272 189770.33905491605, 109804.70490584878 189769.52330316138, 109802.90525490482 189774.7184551563))" + }, + "zoneType": { + "@id": "/api/v1/taxonomies/zonetypes/0fb72ef7-6ac9-4a70-b295-a30ea215d250", + "prefLabel": "HinderZone" + } + } + ], + "period": [ + { + "@type": "Period", + "start": "2021-01-31T23:00:00Z", + "end": "2021-02-03T22:30:00Z" + } + ], + "timeSchedule": null, + "permittedBy": [], + "status": { + "@id": "/api/v1/taxonomies/statuses/a411c53e-db33-436a-9bb9-d62d535b661d", + "prefLabel": "Onbekend" + }, + "generatedAtTime": "2020-12-28T09:37:18.577Z", + "eventName": "MobilityHindranceWasImportedFromLegacy", + "isVersionOf": "/api/v1/mobility-hindrances/10228787", + "memberOf": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "lastModifiedOn": "2020-12-07T15:10:22.18Z", + "lastModifiedBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + }, + "createdOn": "2020-12-07T15:10:22.18Z", + "createdBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + } + }, + { + "@id": "https://private-api.gipod.beta-vlaanderen.be/api/v1/mobility-hindrances/2", + "@type": "MobilityHindrance", + "gipodId": 10228787, + "identifier": [ + { + "@type": "Identifier", + "Identifier.identifier": { + "value": "10228787", + "type": "gipodId" + }, + "assignedByName": "https://gipod.vlaanderen.be" + } + ], + "isConsequenceOf": [ + { + "@id": "/api/v1/events/3773285", + "@type": "Event", + "gipodId": 3773285 + } + ], + "description": "Eetwagen", + "owner": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + }, + "contactOrganisation": [], + "zone": [ + { + "@id": "/api/v1/mobility-hindrances/10228787/zones/6dd8d314-9415-4103-bb06-c7c9fbf3dc19", + "@type": "Zone", + "consequence": [ + { + "@id": "/api/v1/taxonomies/mobility-hindrance/consequencetypes/c53813ab-814f-4ff4-8a87-6934c72e175f", + "prefLabel": "Geen doorgang voor gemotoriseerd verkeer" + } + ], + "geometry": { + "@type": "Geometry", + "wkt": " POLYGON ((109802.90525490482 189774.7184551563, 109801.10560758458 189779.91360264365, 109803.47330090578 189780.72935110983, 109805.27295029224 189775.5342052644, 109807.07260330272 189770.33905491605, 109804.70490584878 189769.52330316138, 109802.90525490482 189774.7184551563))" + }, + "zoneType": { + "@id": "/api/v1/taxonomies/zonetypes/0fb72ef7-6ac9-4a70-b295-a30ea215d250", + "prefLabel": "HinderZone" + } + } + ], + "period": [ + { + "@type": "Period", + "start": "2021-01-31T23:00:00Z", + "end": "2021-02-03T22:30:00Z" + } + ], + "timeSchedule": null, + "permittedBy": [], + "status": { + "@id": "/api/v1/taxonomies/statuses/a411c53e-db33-436a-9bb9-d62d535b661d", + "prefLabel": "Onbekend" + }, + "generatedAtTime": "2020-12-29T09:37:18.578Z", + "eventName": "MobilityHindranceWasImportedFromLegacy", + "isVersionOf": "/api/v1/mobility-hindrances/10228787", + "memberOf": "https://private-api.gipod.beta-vlaanderen.be/api/v1/ldes/mobility-hindrances", + "lastModifiedOn": "2020-12-07T15:10:22.18Z", + "lastModifiedBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc", + "generatedAtTime": "2020-12-27T09:37:18.578Z" + }, + "createdOn": "2020-12-07T15:10:22.18Z", + "createdBy": { + "isVersionOf": "/api/v1/organisations/0201f2a2-39e6-0a88-b5a3-c912f52a9a93", + "@type": "Organisation", + "preferredName": "Geosparc" + } + } + ] + }, + "headers": { + "Content-Type": "application/ld+json;charset=UTF-8", + "Cache-Control": "public, max-age=1, mutable" + } + } + } + ] +} \ No newline at end of file From 365bb13d962151ad3285afff717d796ea129abb6 Mon Sep 17 00:00:00 2001 From: pj-cegeka <119848850+pj-cegeka@users.noreply.github.com> Date: Mon, 1 Jul 2024 09:14:04 +0200 Subject: [PATCH 4/5] Feat: create version object processor accepts list of member types (#656) --- .../ldio-version-object-creator.md | 8 ++-- .../ldes/ldi/VersionObjectCreator.java | 13 ++++--- .../ldes/ldi/VersionObjectCreatorTest.java | 39 +++++++++++++++---- .../CreateVersionObjectProcessor.java | 4 +- ...ionObjectProcessorPropertyDescriptors.java | 14 +++++-- .../ldes/ldio/LdioVersionObjectCreator.java | 6 ++- .../LdioVersionObjectCreatorAutoConfig.java | 25 ++++++++---- 7 files changed, 77 insertions(+), 32 deletions(-) diff --git a/docs/_ldio/ldio-transformers/ldio-version-object-creator.md b/docs/_ldio/ldio-transformers/ldio-version-object-creator.md index 78837b9ed..83e5810bc 100644 --- a/docs/_ldio/ldio-transformers/ldio-version-object-creator.md +++ b/docs/_ldio/ldio-transformers/ldio-version-object-creator.md @@ -15,9 +15,9 @@ The Version Object Creator will transform a State Object to a Version Object. | Property | Description | Required | Default | Example | Supported values | |:-------------------------|:-------------------------------------------------------------------------------------------------------------------------------|:---------|:------------------------------------------|:------------------------------------------|:-----------------| | _date-observed-property_ | Property path (IRI format '<>') that points to a literal which should be used as timestampPath. Defaults to current timestamp. | No | Current Timestamp | \ | String | -| _member-type_ | Defines the RDF type of the version object | No | N/A | https://example.org/Person | String | +| _member-type_ | Defines the RDF type of the object to be transformed to a version object. | Yes | N/A | https://example.org/Person | String | | _delimiter_ | Defines how the version object id will be constructed. (versionOf + delimiter + dateObserved) | No | / | / | String | -| _generatedAt-property_ | A statement will be added to the model with the observedAt value and the given property. | No | http://www.w3.org/ns/prov#generatedAtTime | http://www.w3.org/ns/prov#generatedAtTime | String | +| _generatedAt-property_ | A statement will be added to the model with the generatedAt value and the given property. | No | http://www.w3.org/ns/prov#generatedAtTime | http://www.w3.org/ns/prov#generatedAtTime | String | | _versionOf-property_ | A statement will be added to the model with the versionOf value and the given property. | No | http://purl.org/dc/terms/isVersionOf | http://purl.org/dc/terms/isVersionOf | String | ## Example @@ -82,7 +82,9 @@ The YAML configuration of this example would be as follows: transformers: - name: Ldio:VersionObjectCreator config: - member-type: http://example.org/Something + member-type: + - http://example.org/Something + - http://example.org/SomethingElse delimiter: "#" date-observed-property: / generatedAt-property: http://www.w3.org/ns/prov#generatedAtTime diff --git a/ldi-core/version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreator.java b/ldi-core/version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreator.java index 9acfe85f5..549e02423 100644 --- a/ldi-core/version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreator.java +++ b/ldi-core/version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreator.java @@ -41,7 +41,7 @@ public class VersionObjectCreator implements LdiOneToOneTransformer { /** * Representation of the member type resource that the state object represents */ - private final Resource memberTypeResource; + private final List memberTypeResources; /** * Represents that needs to be used to expand the named subject of the member to a version object member id */ @@ -55,11 +55,11 @@ public class VersionObjectCreator implements LdiOneToOneTransformer { */ private final Property versionOfProperty; - public VersionObjectCreator(PropertyExtractor dateObservedPropertyExtractor, Resource memberTypeResource, - String delimiter, - Property generatedAtTimeProperty, Property versionOfProperty) { + public VersionObjectCreator(PropertyExtractor dateObservedPropertyExtractor, List memberTypeResources, + String delimiter, + Property generatedAtTimeProperty, Property versionOfProperty) { this.dateObservedPropertyExtractor = dateObservedPropertyExtractor; - this.memberTypeResource = memberTypeResource; + this.memberTypeResources = memberTypeResources; this.delimiter = delimiter; this.generatedAtTimeProperty = generatedAtTimeProperty; this.versionOfProperty = versionOfProperty; @@ -83,7 +83,8 @@ public Model transform(Model linkedDataModel) { } private Optional extractMemberInfo(Model linkedDataModel) { - return linkedDataModel.listStatements(null, SYNTAX_TYPE, memberTypeResource) + return linkedDataModel.listStatements(null, SYNTAX_TYPE, (RDFNode) null) + .filterKeep(statement -> memberTypeResources.contains(statement.getResource())) .nextOptional() .map(Statement::getSubject) .map(Resource::asNode) diff --git a/ldi-core/version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreatorTest.java b/ldi-core/version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreatorTest.java index b69595439..6d5f89052 100644 --- a/ldi-core/version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreatorTest.java +++ b/ldi-core/version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/VersionObjectCreatorTest.java @@ -131,13 +131,13 @@ void when_dateObservedPropertyIsNested_thenAPropertyPathCanBeProvided() { @ParameterizedTest @ArgumentsSource(JsonLDFileArgumentsProvider.class) - void shouldMatchCountOfObjects(String fileName, String expectedId, LocalDateTime startTestTime, String memberType) + void shouldMatchCountOfObjects(String fileName, String expectedId, LocalDateTime startTestTime, List memberTypes) throws IOException, URISyntaxException { Model model = RDFParserBuilder.create().fromString(getJsonString(fileName)).lang(Lang.JSONLD).toModel(); VersionObjectCreator versionObjectCreator = new VersionObjectCreator(new EmptyPropertyExtractor(), - model.createResource(memberType), + memberTypes.stream().map(model::createResource).toList(), DEFAULT_DELIMITER, null, null); Model versionObject = versionObjectCreator.transform(model); @@ -151,6 +151,25 @@ void shouldMatchCountOfObjects(String fileName, String expectedId, LocalDateTime stmt.getSubject().toString().contains(expectedId + minuteAfterTheTestStarted))); } + @Test + void when_EmptyList_Then_ShouldNotMatch() throws URISyntaxException, IOException { + final LocalDateTime now = LocalDateTime.now(); + Model model = RDFParserBuilder.create().fromString(getJsonString("example-waterqualityobserved.json")).lang(Lang.JSONLD).toModel(); + VersionObjectCreator versionObjectCreator = new VersionObjectCreator(new EmptyPropertyExtractor(), + List.of(), + DEFAULT_DELIMITER, null, null); + + Model versionObject = versionObjectCreator.transform(model); + + final String minuteTheTestStarted = getPartOfLocalDateTime(now); + final String minuteAfterTheTestStarted = getPartOfLocalDateTime(now.plusMinutes(1)); + assertTrue(versionObject.listStatements() + .toList() + .stream() + .noneMatch(stmt -> stmt.getSubject().toString().contains(minuteTheTestStarted) || + stmt.getSubject().toString().contains(minuteAfterTheTestStarted))); + } + @Test void when_memberInfoExtractionFails_warningMessageIsLogged() { ListAppender listAppender = createListAppender(); @@ -229,14 +248,14 @@ private String getJsonString(String resource) throws URISyntaxException, IOExcep } private VersionObjectCreator createVersionObjectCreator(Model inputModel, String dateObservedPath) { - Resource memberType = inputModel.createResource("http://example.org/Something"); + List memberTypes = List.of(inputModel.createResource("http://example.org/Something")); PropertyExtractor dateObservedPropertyExtractor = PropertyPathExtractor.from(dateObservedPath); Property generatedAtTimeProperty = inputModel.createProperty("http://www.w3.org/ns/prov#generatedAtTime"); Property versionOfProperty = inputModel.createProperty("http://purl.org/dc/terms/isVersionOf"); return new VersionObjectCreator( dateObservedPropertyExtractor, - memberType, + memberTypes, DEFAULT_DELIMITER, generatedAtTimeProperty, versionOfProperty @@ -260,15 +279,21 @@ public Stream provideArguments(ExtensionContext context) { Arguments.of("example-waterqualityobserved.json", "urn:ngsi-v2:cot-imec-be:WaterQualityObserved:imec-iow-3orY3reQDK5n3TMpPnLVYR/", now, - "https://uri.etsi.org/ngsi-ld/default-context/WaterQualityObserved"), + List.of("https://uri.etsi.org/ngsi-ld/default-context/WaterQualityObserved")), Arguments.of("example-device.json", "urn:ngsi-v2:cot-imec-be:Device:imec-iow-UR5gEycRuaafxnhvjd9jnU/", now, - "https://uri.etsi.org/ngsi-ld/default-context/Device"), + List.of("https://uri.etsi.org/ngsi-ld/default-context/Device")), + Arguments.of("example-device-model.json", + "urn:ngsi-v2:cot-imec-be:devicemodel:imec-iow-sensor-v0005/", + now, + List.of("https://uri.etsi.org/ngsi-ld/default-context/DeviceModel")), Arguments.of("example-device-model.json", "urn:ngsi-v2:cot-imec-be:devicemodel:imec-iow-sensor-v0005/", now, - "https://uri.etsi.org/ngsi-ld/default-context/DeviceModel")); + List.of("https://www.test.org", + "https://uri.etsi.org/ngsi-ld/default-context/DeviceModel", + "https://www.something.org"))); } } diff --git a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/CreateVersionObjectProcessor.java b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/CreateVersionObjectProcessor.java index d85672284..7112fddf8 100644 --- a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/CreateVersionObjectProcessor.java +++ b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/CreateVersionObjectProcessor.java @@ -80,13 +80,13 @@ public void onScheduled(final ProcessContext context) { PropertyExtractor dateObservedPropertyExtractor = dateObservedProperty != null ? PropertyPathExtractor.from(dateObservedProperty) : new EmptyPropertyExtractor(); - Resource memberType = getMemberRdfSyntaxType(context); + List memberTypes = getMemberRdfSyntaxTypes(context); String delimiter = getDelimiter(context); Property versionOfKey = getVersionOfKey(context); Property generatedAtTimeProperty = getGeneratedAtTimeProperty(context); dataDestinationFormat = getDataDestinationFormat(context); - versionObjectCreator = new VersionObjectCreator(dateObservedPropertyExtractor, memberType, delimiter, + versionObjectCreator = new VersionObjectCreator(dateObservedPropertyExtractor, memberTypes, delimiter, generatedAtTimeProperty, versionOfKey); } diff --git a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java index 2fa5b31de..ab1e96111 100644 --- a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java +++ b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java @@ -9,6 +9,9 @@ import org.apache.nifi.processor.ProcessContext; import org.apache.nifi.processor.util.StandardValidators; +import java.util.Arrays; +import java.util.List; + public final class CreateVersionObjectProcessorPropertyDescriptors { private static final String DEFAULT_DATE_OBSERVED_VALUE_RDF_PROPERTY = "https://uri.etsi.org/ngsi-ld/observedAt"; private static final String DEFAULT_DELIMITER = "/"; @@ -21,8 +24,8 @@ private CreateVersionObjectProcessorPropertyDescriptors() { public static final PropertyDescriptor MEMBER_RDF_SYNTAX_TYPE = new PropertyDescriptor.Builder() .name("MEMBER_RDF_SYNTAX_TYPE") - .displayName("IRI to member RDF syntax type") - .description("IRI that declares a http://www.w3.org/1999/02/22-rdf-syntax-ns#type") + .displayName("IRIs to member RDF syntax type") + .description("Comma separated list of IRIs that declare a http://www.w3.org/1999/02/22-rdf-syntax-ns#type of all possible members") .required(true) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .build(); @@ -78,8 +81,11 @@ public static String getDateObservedValue(ProcessContext context) { return context.getProperty(DATE_OBSERVED_VALUE_RDF_PROPERTY).getValue(); } - public static Resource getMemberRdfSyntaxType(ProcessContext context) { - return ResourceFactory.createResource(context.getProperty(MEMBER_RDF_SYNTAX_TYPE).getValue()); + public static List getMemberRdfSyntaxTypes(ProcessContext context) { + return Arrays.stream(context.getProperty(MEMBER_RDF_SYNTAX_TYPE).getValue().split(",")) + .map(String::trim) + .map(ResourceFactory::createResource) + .toList(); } public static String getDelimiter(ProcessContext context) { diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionObjectCreator.java b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionObjectCreator.java index 72e7de1b0..ffc775d23 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionObjectCreator.java +++ b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioVersionObjectCreator.java @@ -7,13 +7,15 @@ import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.Resource; +import java.util.List; + public class LdioVersionObjectCreator extends LdioTransformer { public static final String NAME = "Ldio:VersionObjectCreator"; private final VersionObjectCreator versionObjectCreator; - public LdioVersionObjectCreator(PropertyExtractor dateObservedPropertyExtractor, Resource memberType, + public LdioVersionObjectCreator(PropertyExtractor dateObservedPropertyExtractor, List memberTypes, String delimiter, Property generatedAtProperty, Property versionOfProperty) { - this.versionObjectCreator = new VersionObjectCreator(dateObservedPropertyExtractor, memberType, delimiter, + this.versionObjectCreator = new VersionObjectCreator(dateObservedPropertyExtractor, memberTypes, delimiter, generatedAtProperty, versionOfProperty); } diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java index 1b6785784..4059741fd 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java @@ -5,6 +5,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.extractor.PropertyPathExtractor; import be.vlaanderen.informatievlaanderen.ldes.ldio.LdioVersionObjectCreator; import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioTransformerConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.ConfigPropertyMissingException; import be.vlaanderen.informatievlaanderen.ldes.ldio.types.LdioTransformer; import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; import org.apache.jena.rdf.model.Model; @@ -14,7 +15,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import java.util.Optional; +import java.util.List; import static be.vlaanderen.informatievlaanderen.ldes.ldio.LdioVersionObjectCreator.NAME; @@ -27,6 +28,11 @@ public LdioTransformerConfigurator ldioConfigurator() { public static class LdioVersionObjectCreatorTransformerConfigurator implements LdioTransformerConfigurator { + public static final String DATE_OBSERVED = "date-observed-property"; + public static final String MEMBER_TYPE = "member-type"; + public static final String DELIMITER = "delimiter"; + public static final String GENERATED_AT = "generatedAt-property"; + public static final String VERSION_OF = "versionOf-property"; public static final String DEFAULT_PROV_GENERATED_AT_TIME = "http://www.w3.org/ns/prov#generatedAtTime"; public static final String DEFAULT_VERSION_OF_KEY = "http://purl.org/dc/terms/isVersionOf"; @@ -34,25 +40,28 @@ public static class LdioVersionObjectCreatorTransformerConfigurator implements L public LdioTransformer configure(ComponentProperties properties) { Model initModel = ModelFactory.createDefaultModel(); - PropertyExtractor dateObservedPropertyExtractor = properties.getOptionalProperty("date-observed-property") + PropertyExtractor dateObservedPropertyExtractor = properties.getOptionalProperty(DATE_OBSERVED) .map(PropertyPathExtractor::from) .map(PropertyExtractor.class::cast) .orElseGet(EmptyPropertyExtractor::new); - Resource memberType = Optional.of(properties.getProperty("member-type")) - .map(initModel::createResource).orElse(null); + List memberTypes = properties.getPropertyList(MEMBER_TYPE).stream() + .map(initModel::createResource).toList(); + if (memberTypes.isEmpty()) { + throw new ConfigPropertyMissingException(properties.getPipelineName(), properties.getComponentName(), MEMBER_TYPE); + } - String delimiter = properties.getOptionalProperty("delimiter").orElse("/"); + String delimiter = properties.getOptionalProperty(DELIMITER).orElse("/"); - Property generatedAtProperty = properties.getOptionalProperty("generatedAt-property") + Property generatedAtProperty = properties.getOptionalProperty(GENERATED_AT) .map(initModel::createProperty) .orElseGet(() -> initModel.createProperty(DEFAULT_PROV_GENERATED_AT_TIME)); - Property versionOfProperty = properties.getOptionalProperty("versionOf-property") + Property versionOfProperty = properties.getOptionalProperty(VERSION_OF) .map(initModel::createProperty) .orElseGet(() -> initModel.createProperty(DEFAULT_VERSION_OF_KEY)); - return new LdioVersionObjectCreator(dateObservedPropertyExtractor, memberType, delimiter, + return new LdioVersionObjectCreator(dateObservedPropertyExtractor, memberTypes, delimiter, generatedAtProperty, versionOfProperty); } From c063b430ed6f88ba4c3ba0a66e2618b84d1fa02e Mon Sep 17 00:00:00 2001 From: pj-cegeka <119848850+pj-cegeka@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:52:37 +0200 Subject: [PATCH 5/5] Fix: expand empty check on member types (#657) --- ...ionObjectProcessorPropertyDescriptors.java | 2 +- .../LdioVersionObjectCreatorAutoConfig.java | 9 +++-- ...dioVersionObjectCreatorAutoConfigTest.java | 40 +++++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfigTest.java diff --git a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java index ab1e96111..6052224be 100644 --- a/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java +++ b/ldi-nifi/ldi-nifi-processors/create-version-object-processor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/processors/config/CreateVersionObjectProcessorPropertyDescriptors.java @@ -27,7 +27,7 @@ private CreateVersionObjectProcessorPropertyDescriptors() { .displayName("IRIs to member RDF syntax type") .description("Comma separated list of IRIs that declare a http://www.w3.org/1999/02/22-rdf-syntax-ns#type of all possible members") .required(true) - .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) + .addValidator(StandardValidators.NON_BLANK_VALIDATOR) .build(); public static final PropertyDescriptor DELIMITER = new PropertyDescriptor.Builder() diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java index 4059741fd..4a5eeddad 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java +++ b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfig.java @@ -45,12 +45,15 @@ public LdioTransformer configure(ComponentProperties properties) { .map(PropertyExtractor.class::cast) .orElseGet(EmptyPropertyExtractor::new); - List memberTypes = properties.getPropertyList(MEMBER_TYPE).stream() - .map(initModel::createResource).toList(); - if (memberTypes.isEmpty()) { + List memberTypesPropertyList = properties.getPropertyList(MEMBER_TYPE); + + if (memberTypesPropertyList.isEmpty() || memberTypesPropertyList.stream().allMatch(String::isEmpty)) { throw new ConfigPropertyMissingException(properties.getPipelineName(), properties.getComponentName(), MEMBER_TYPE); } + List memberTypes = memberTypesPropertyList.stream() + .map(initModel::createResource).toList(); + String delimiter = properties.getOptionalProperty(DELIMITER).orElse("/"); Property generatedAtProperty = properties.getOptionalProperty(GENERATED_AT) diff --git a/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfigTest.java b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfigTest.java new file mode 100644 index 000000000..6226b743d --- /dev/null +++ b/ldi-orchestrator/ldio-connectors/ldio-version-object-creator/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/config/LdioVersionObjectCreatorAutoConfigTest.java @@ -0,0 +1,40 @@ +package be.vlaanderen.informatievlaanderen.ldes.ldio.config; + +import be.vlaanderen.informatievlaanderen.ldes.ldio.configurator.LdioConfigurator; +import be.vlaanderen.informatievlaanderen.ldes.ldio.exception.ConfigPropertyMissingException; +import be.vlaanderen.informatievlaanderen.ldes.ldio.valueobjects.ComponentProperties; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.ArgumentsProvider; +import org.junit.jupiter.params.provider.ArgumentsSource; + +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Stream; + +import static be.vlaanderen.informatievlaanderen.ldes.ldio.config.LdioVersionObjectCreatorAutoConfig.LdioVersionObjectCreatorTransformerConfigurator.MEMBER_TYPE; +import static org.junit.jupiter.api.Assertions.assertThrows; + +class LdioVersionObjectCreatorAutoConfigTest { + private final LdioConfigurator configurator = new LdioVersionObjectCreatorAutoConfig().ldioConfigurator(); + @ParameterizedTest + @ArgumentsSource(configProvider.class) + void when_NoMemberTypes_Then_exceptionIsThrown(Map config) { + ComponentProperties componentProperties = new ComponentProperties("pipelineName", "cName", config); + + assertThrows(ConfigPropertyMissingException.class,() -> configurator.configure(componentProperties)) ; + } + + static class configProvider implements ArgumentsProvider { + @Override + public Stream provideArguments(ExtensionContext extensionContext) { + Map empty = new HashMap<>(); + empty.put(MEMBER_TYPE, ""); + return Stream.of( + Arguments.of(new HashMap()), + Arguments.of(empty) + ); + } + } +} \ No newline at end of file