diff --git a/docs/_ldio/ldio-core/ldio-http-requester.md b/docs/_ldio/ldio-core/ldio-http-requester.md
index 64e9d9012..97acb7ebf 100644
--- a/docs/_ldio/ldio-core/ldio-http-requester.md
+++ b/docs/_ldio/ldio-core/ldio-http-requester.md
@@ -38,3 +38,8 @@ This requester supports the below config:
enabled: true
max-requests-per-minute: 500
```
+
+## Retry
+When retries are enabled, the following statuses are always retried, regardless of the configured statuses-to-retry:
+- 5xx (500 and above)
+- 429
\ No newline at end of file
diff --git a/docs/_ldio/ldio-inputs/art/ldes-client-connector.svg b/docs/_ldio/ldio-inputs/art/ldes-client-connector.svg
new file mode 100644
index 000000000..f1c1d5e92
--- /dev/null
+++ b/docs/_ldio/ldio-inputs/art/ldes-client-connector.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/docs/_ldio/ldio-inputs/ldio-ldes-client-connector.md b/docs/_ldio/ldio-inputs/ldio-ldes-client-connector.md
new file mode 100644
index 000000000..b86dfbcbd
--- /dev/null
+++ b/docs/_ldio/ldio-inputs/ldio-ldes-client-connector.md
@@ -0,0 +1,49 @@
+---
+ layout: default
+ parent: LDIO Inputs
+ title: LDES Client
+---
+
+# LDIO Ldes Client Connector
+
+***be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientConnector***
+
+An EDC (Eclipse dataspace Connector) LDIO wrapper component for the [LDI LDES Client building block](../../core/ldi-inputs/ldes-client)
+
+This component adds EDC support to [the ldio ldes client](./ldio-ldes-client.md). If you'd like to know how to configure the LDES Client,
+we refer to [the ldio ldes client](./ldio-ldes-client.md).
+The additional functionality provided by this component makes it possible to use the Ldes Client to consume an LDES through an EDC connector.
+This component exposes two endpoints:
+
+1. http://://transfer
+ The Ldio component will start the data transfer with the connector. You have to send the transfer request to
+ the LdioLdesClientConnector instead of the EDC consumer connector. The LDIO Ldes Client Connector will start the transfer
+ with the connector and also keep the transfer alive while consuming the LDES (e.g. request a new token when it expires).
+3. http://://token
+ This endpoint should never be called directly. This is the callback to be provided in the transfer request.
+ The EDC connector will use this callback endpoint to provide the LDES Client with a token.
+
+![img](./art/ldes-client-connector.svg)
+
+## Config
+
+| Property | Description | Required | Default | Example | Supported values |
+|:-----------------------|:----------------------------------------------------------------------------------------------------------------|:---------|:-------------|:----------------------------------------------------------------|:--------------------|
+| connector-transfer-url | The transfer url of the EDC connector which has to be called to start a transfer | Yes | N/A | http://consumer-connector:29193/management/v2/transferprocesses | HTTP and HTTPS urls |
+| proxy-url-to-replace | Makes it possible to proxy a part of the url of the LDES**. Indicates which part of the url should be replaced. | No | empty string | http://ldes-behind-connectors.dev | string |
+| proxy-url-replacement | Makes it possible to proxy a part of the url of the LDES**. Indicates the replacement url part. | No | memory | http://consumer-connector:29193 | string |
+** The url mentioned here are the actual url's used by the LDES Server (hostname). These are included in the results bodies to indicate relations, etc. This is a temporary solution until the client and server support relative urls.
+
+
+## Examples
+
+```yaml
+input:
+ name: be.vlaanderen.informatievlaanderen.ldes.ldio.LdioLdesClientConnector
+ config:
+ url: http://consumer-connector:29291/public
+ connector-transfer-url: http://consumer-connector:29193/management/v2/transferprocesses
+ proxy-url-to-replace: http://localhost:8081/devices
+ proxy-url-replacement: http://consumer-connector:29291/public
+ source-format: application/n-quads
+```
diff --git a/docs/assets/images/vlaanderen_header.png b/docs/assets/images/vlaanderen_header.png
deleted file mode 100644
index 54aa995a4..000000000
Binary files a/docs/assets/images/vlaanderen_header.png and /dev/null differ
diff --git a/ldi-api/pom.xml b/ldi-api/pom.xml
index 121f2c7ab..c26e5381d 100644
--- a/ldi-api/pom.xml
+++ b/ldi-api/pom.xml
@@ -3,7 +3,7 @@
be.vlaanderen.informatievlaanderen.ldeslinked-data-interactions
- 1.9.0
+ 1.10.0-SNAPSHOT4.0.0
diff --git a/ldi-api/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/types/LdiOneToManyTransformer.java b/ldi-api/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/types/LdiOneToManyTransformer.java
new file mode 100644
index 000000000..abbc04c32
--- /dev/null
+++ b/ldi-api/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/types/LdiOneToManyTransformer.java
@@ -0,0 +1,9 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.types;
+
+import org.apache.jena.rdf.model.Model;
+
+import java.util.List;
+
+public interface LdiOneToManyTransformer extends LdiComponent {
+ List transform(Model model);
+}
diff --git a/ldi-api/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/types/LdiTransformer.java b/ldi-api/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/types/LdiOneToOneTransformer.java
similarity index 69%
rename from ldi-api/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/types/LdiTransformer.java
rename to ldi-api/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/types/LdiOneToOneTransformer.java
index 460fdcbc6..5d8f5cb8e 100644
--- a/ldi-api/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/types/LdiTransformer.java
+++ b/ldi-api/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/types/LdiOneToOneTransformer.java
@@ -2,14 +2,12 @@
import org.apache.jena.rdf.model.Model;
-import java.util.Collection;
-import java.util.function.Function;
-
/**
* The LDI Transformer provides a user to take a linked data model (RDF) from
* the pipeline and perform transformations
* onto it. Afterwards, this model will be put back onto the pipeline towards a
* next transformer or an LDI Output.
*/
-public interface LdiTransformer extends LdiComponent, Function> {
+public interface LdiOneToOneTransformer extends LdiComponent {
+ Model transform(Model model);
}
diff --git a/ldi-core/file-archiving/pom.xml b/ldi-core/file-archiving/pom.xml
index 21d612043..5a5dcb8ee 100644
--- a/ldi-core/file-archiving/pom.xml
+++ b/ldi-core/file-archiving/pom.xml
@@ -6,7 +6,7 @@
be.vlaanderen.informatievlaanderen.ldes.ldildi-core
- 1.9.0
+ 1.10.0-SNAPSHOTfile-archiving
diff --git a/ldi-core/file-archiving/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/TimestampFromCurrentTimeExtractorTest.java b/ldi-core/file-archiving/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/TimestampFromCurrentTimeExtractorTest.java
index 8cf14c63c..7edafec00 100644
--- a/ldi-core/file-archiving/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/TimestampFromCurrentTimeExtractorTest.java
+++ b/ldi-core/file-archiving/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldio/TimestampFromCurrentTimeExtractorTest.java
@@ -23,4 +23,4 @@ void extractTimestamp() {
assertTrue(result.isAfter(LocalDateTime.now().minusMinutes(5)));
}
-}
\ No newline at end of file
+}
diff --git a/ldi-core/geojson-to-wkt/pom.xml b/ldi-core/geojson-to-wkt/pom.xml
index c8e2d9268..a2fbca61a 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.ldildi-core
- 1.9.0
+ 1.10.0-SNAPSHOTgeojson-to-wkt
diff --git a/ldi-core/geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/GeoJsonToWktTransformer.java b/ldi-core/geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/GeoJsonToWktTransformer.java
index 1b5bf63ed..90c27b9c2 100644
--- a/ldi-core/geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/GeoJsonToWktTransformer.java
+++ b/ldi-core/geojson-to-wkt/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/GeoJsonToWktTransformer.java
@@ -1,6 +1,6 @@
package be.vlaanderen.informatievlaanderen.ldes.ldi;
-import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiTransformer;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOneToOneTransformer;
import org.apache.jena.datatypes.RDFDatatype;
import org.apache.jena.datatypes.TypeMapper;
import org.apache.jena.rdf.model.*;
@@ -11,7 +11,7 @@
import static be.vlaanderen.informatievlaanderen.ldes.ldi.WktConverter.GEOJSON_GEOMETRY;
-public class GeoJsonToWktTransformer implements LdiTransformer {
+public class GeoJsonToWktTransformer implements LdiOneToOneTransformer {
private final WktConverter wktConverter = new WktConverter();
@@ -20,7 +20,7 @@ public class GeoJsonToWktTransformer implements LdiTransformer {
* containing geosparql#wktLiteral
*/
@Override
- public List apply(Model model) {
+ public Model transform(Model model) {
final List geometryStatements = model.listStatements(null, GEOJSON_GEOMETRY, (RDFNode) null)
.toList();
geometryStatements.forEach(oldGeometryStatement -> {
@@ -29,7 +29,7 @@ public List apply(Model model) {
model.remove(createModelWithChildStatements(model, oldGeometryStatement));
model.add(newGeometryStatement);
});
- return List.of(model);
+ return model;
}
private Statement createNewGeometryStatement(Statement oldStatement, Model geometryModel) {
@@ -60,5 +60,4 @@ private void addChildStatements(Model model, Resource subject, Set st
statements.add(statement);
});
}
-
}
diff --git a/ldi-core/geojson-to-wkt/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/GeoJsonToWktTransformerTest.java b/ldi-core/geojson-to-wkt/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/GeoJsonToWktTransformerTest.java
index b31a68401..eb7185363 100644
--- a/ldi-core/geojson-to-wkt/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/GeoJsonToWktTransformerTest.java
+++ b/ldi-core/geojson-to-wkt/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/GeoJsonToWktTransformerTest.java
@@ -1,6 +1,8 @@
package be.vlaanderen.informatievlaanderen.ldes.ldi;
-import org.apache.jena.rdf.model.*;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.Property;
+import org.apache.jena.rdf.model.Resource;
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFParser;
import org.apache.jena.vocabulary.RDF;
@@ -8,9 +10,7 @@
import static org.apache.jena.rdf.model.ResourceFactory.createProperty;
import static org.apache.jena.rdf.model.ResourceFactory.createStatement;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
class GeoJsonToWktTransformerTest {
@@ -18,8 +18,8 @@ class GeoJsonToWktTransformerTest {
@Test
void testApply() {
- Model result = transformer.apply(
- RDFParser.source("geojson-all-types.json").lang(Lang.JSONLD).build().toModel()).get(0);
+ Model result = transformer.transform(
+ RDFParser.source("geojson-all-types.json").lang(Lang.JSONLD).build().toModel());
Model expectedResult = RDFParser.source("result-all-types.json").lang(Lang.JSONLD).build().toModel();
@@ -34,7 +34,7 @@ void shouldThrowException_whenGeometryContainsMultipleTypes() {
Property lineStringProperty = createProperty("https://purl.org/geojson/vocab#LineString");
model.add(createStatement(subject, RDF.type, lineStringProperty));
- var exception = assertThrows(IllegalArgumentException.class, () -> transformer.apply(model));
+ var exception = assertThrows(IllegalArgumentException.class, () -> transformer.transform(model));
assertEquals("Could not determine http://www.w3.org/1999/02/22-rdf-syntax-ns#type of " +
"https://purl.org/geojson/vocab#geometry", exception.getMessage());
diff --git a/ldi-core/json-to-ld-adapter/pom.xml b/ldi-core/json-to-ld-adapter/pom.xml
index 56e3d7b17..bf7babb86 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.ldildi-core
- 1.9.0
+ 1.10.0-SNAPSHOTjson-to-ld-adapter
diff --git a/ldi-core/ldes-client/pom.xml b/ldi-core/ldes-client/pom.xml
index 1e136c42f..7af35d8bc 100644
--- a/ldi-core/ldes-client/pom.xml
+++ b/ldi-core/ldes-client/pom.xml
@@ -5,7 +5,7 @@
be.vlaanderen.informatievlaanderen.ldes.ldildi-core
- 1.9.0
+ 1.10.0-SNAPSHOT4.0.0
diff --git a/ldi-core/ldes-client/starting-node/pom.xml b/ldi-core/ldes-client/starting-node/pom.xml
index 0fc9d713b..acd7113cb 100644
--- a/ldi-core/ldes-client/starting-node/pom.xml
+++ b/ldi-core/ldes-client/starting-node/pom.xml
@@ -5,7 +5,7 @@
ldes-clientbe.vlaanderen.informatievlaanderen.ldes.client
- 1.9.0
+ 1.10.0-SNAPSHOT4.0.0starting-node
diff --git a/ldi-core/ldes-client/tree-node-fetcher/pom.xml b/ldi-core/ldes-client/tree-node-fetcher/pom.xml
index 30b0ba24e..72e800f13 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-clientbe.vlaanderen.informatievlaanderen.ldes.client
- 1.9.0
+ 1.10.0-SNAPSHOT4.0.0tree-node-fetcher
diff --git a/ldi-core/ldes-client/tree-node-fetcher/src/main/java/ldes/client/treenodefetcher/domain/valueobjects/TreeNodeRequest.java b/ldi-core/ldes-client/tree-node-fetcher/src/main/java/ldes/client/treenodefetcher/domain/valueobjects/TreeNodeRequest.java
index d5c390d3c..bf2765ebe 100644
--- a/ldi-core/ldes-client/tree-node-fetcher/src/main/java/ldes/client/treenodefetcher/domain/valueobjects/TreeNodeRequest.java
+++ b/ldi-core/ldes-client/tree-node-fetcher/src/main/java/ldes/client/treenodefetcher/domain/valueobjects/TreeNodeRequest.java
@@ -25,7 +25,7 @@ public Request createRequest() {
RequestHeaders requestHeaders = new RequestHeaders(
List.of(new RequestHeader(HttpHeaders.ACCEPT, lang.getHeaderString())));
if (etag != null) {
- requestHeaders = requestHeaders.addRequestHeader(new RequestHeader(HttpHeaders.IF_NONE_MATCH, etag));
+ requestHeaders = requestHeaders.withRequestHeader(new RequestHeader(HttpHeaders.IF_NONE_MATCH, etag));
}
return new GetRequest(treeNodeUrl, requestHeaders);
}
diff --git a/ldi-core/ldes-client/tree-node-supplier/pom.xml b/ldi-core/ldes-client/tree-node-supplier/pom.xml
index 94f292bd4..377c2a376 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-clientbe.vlaanderen.informatievlaanderen.ldes.client
- 1.9.0
+ 1.10.0-SNAPSHOT4.0.0tree-node-supplier
diff --git a/ldi-core/ldi-common/pom.xml b/ldi-core/ldi-common/pom.xml
index 185acd92b..b457f83ce 100644
--- a/ldi-core/ldi-common/pom.xml
+++ b/ldi-core/ldi-common/pom.xml
@@ -6,7 +6,7 @@
be.vlaanderen.informatievlaanderen.ldes.ldildi-core
- 1.9.0
+ 1.10.0-SNAPSHOTldi-common
diff --git a/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/JsonLdWriter.java b/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/JsonLdFrameWriter.java
similarity index 91%
rename from ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/JsonLdWriter.java
rename to ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/JsonLdFrameWriter.java
index 45049648e..2f9e23ff7 100644
--- a/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/JsonLdWriter.java
+++ b/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/JsonLdFrameWriter.java
@@ -13,10 +13,10 @@
import static be.vlaanderen.informatievlaanderen.ldes.ldi.rdf.formatter.PrefixAdder.addPrefixesToModel;
-public class JsonLdWriter implements LdiRdfWriter {
+public class JsonLdFrameWriter implements LdiRdfWriter {
private final String frame;
- public JsonLdWriter(LdiRdfWriterProperties properties) {
+ public JsonLdFrameWriter(LdiRdfWriterProperties properties) {
this.frame = properties.getJsonLdFrame();
}
diff --git a/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/JsonLdPrettyWriter.java b/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/JsonLdPrettyWriter.java
new file mode 100644
index 000000000..d4673a156
--- /dev/null
+++ b/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/JsonLdPrettyWriter.java
@@ -0,0 +1,18 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.rdf.formatter;
+
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.riot.RDFFormat;
+import org.apache.jena.riot.RDFWriter;
+
+import static be.vlaanderen.informatievlaanderen.ldes.ldi.rdf.formatter.PrefixAdder.addPrefixesToModel;
+
+public class JsonLdPrettyWriter implements LdiRdfWriter {
+
+ @Override
+ public String write(Model model) {
+ return RDFWriter.source(addPrefixesToModel(model))
+ .format(RDFFormat.JSONLD10_PRETTY)
+ .asString();
+ }
+
+}
diff --git a/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/LdiRdfWriter.java b/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/LdiRdfWriter.java
index 12d730125..9ddc78f6a 100644
--- a/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/LdiRdfWriter.java
+++ b/ldi-core/ldi-common/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/LdiRdfWriter.java
@@ -3,12 +3,16 @@
import org.apache.jena.rdf.model.Model;
import org.apache.jena.riot.Lang;
+import static org.apache.commons.lang3.StringUtils.isBlank;
+
public interface LdiRdfWriter {
String write(Model model);
static LdiRdfWriter getRdfWriter(LdiRdfWriterProperties properties) {
if (Lang.JSONLD.equals(properties.getLang())) {
- return new JsonLdWriter(properties);
+ return isBlank(properties.getJsonLdFrame())
+ ? new JsonLdPrettyWriter()
+ : new JsonLdFrameWriter(properties);
} else {
return new GenericRdfWriter(properties);
}
diff --git a/ldi-core/ldi-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/LdiRdfWriterTest.java b/ldi-core/ldi-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/LdiRdfWriterTest.java
index 1b131b227..0ceeeef6e 100644
--- a/ldi-core/ldi-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/LdiRdfWriterTest.java
+++ b/ldi-core/ldi-common/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/rdf/formatter/LdiRdfWriterTest.java
@@ -22,6 +22,7 @@
import static org.junit.jupiter.api.Assertions.*;
public class LdiRdfWriterTest {
+
@Test
void formatModel_jsonLD() throws IOException, URISyntaxException {
String input = getFileContentString("rdf/formatter/product.jsonld");
@@ -31,16 +32,35 @@ void formatModel_jsonLD() throws IOException, URISyntaxException {
.toModel();
String frame = getFileContentString("rdf/formatter/product.frame.jsonld");
- JsonObject expected = JSON.parse(getFileContentString("rdf/formatter/expected/product.jsonld"));
+ Model expected = RDFParser.fromString(getFileContentString("rdf/formatter/expected/product.jsonld"))
+ .lang(Lang.JSONLD).toModel();
LdiRdfWriterProperties writerProperties = new LdiRdfWriterProperties(Map.of(FRAME, frame));
String output = LdiRdfWriter.getRdfWriter(writerProperties.withLang(Lang.JSONLD)).write(model);
JsonObject outputJson = JSON.parse(output);
+ Model outputModel = RDFParser.fromString(output).lang(Lang.JSONLD).toModel();
assertFalse(outputJson.hasKey("@graph"));
- assertEquals(expected, outputJson);
+ assertTrue(outputModel.isIsomorphicWith(expected));
+ }
+
+ @Test
+ void formatModel_jsonLD_withoutFrame() throws IOException, URISyntaxException {
+ String input = getFileContentString("rdf/formatter/product.jsonld");
+
+ Model model = RDFParser.fromString(input)
+ .lang(Lang.JSONLD)
+ .toModel();
+
+ LdiRdfWriterProperties writerProperties = new LdiRdfWriterProperties();
+
+ String output = LdiRdfWriter.getRdfWriter(writerProperties.withLang(Lang.JSONLD)).write(model);
+
+ JsonObject outputJson = JSON.parse(output);
+
+ assertNotNull(outputJson);
}
@Test
@@ -86,7 +106,7 @@ void getFramedContext() {
}
""";
- JsonLDWriteContext context = (JsonLDWriteContext) JsonLdWriter.getFramedContext(frame);
+ JsonLDWriteContext context = (JsonLDWriteContext) JsonLdFrameWriter.getFramedContext(frame);
JsonObject frameObject = JSON.parse((String) context.get(JsonLD10Writer.JSONLD_FRAME));
assertTrue(frameObject.hasKey("@type"));
diff --git a/ldi-core/model-splitter/pom.xml b/ldi-core/model-splitter/pom.xml
index 74dcc2c27..564491979 100644
--- a/ldi-core/model-splitter/pom.xml
+++ b/ldi-core/model-splitter/pom.xml
@@ -6,7 +6,7 @@
be.vlaanderen.informatievlaanderen.ldes.ldildi-core
- 1.9.0
+ 1.10.0-SNAPSHOTbe.vlaanderen.informatievlaanderen.ldes.ldi
diff --git a/ldi-core/model-splitter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitTransformer.java b/ldi-core/model-splitter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitTransformer.java
index d60dfd4c2..8c4b455fc 100644
--- a/ldi-core/model-splitter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitTransformer.java
+++ b/ldi-core/model-splitter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitTransformer.java
@@ -1,23 +1,22 @@
package be.vlaanderen.informatievlaanderen.ldes.ldi;
-import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiTransformer;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiOneToManyTransformer;
import org.apache.jena.rdf.model.Model;
-import java.util.Collection;
+import java.util.List;
-public class ModelSplitTransformer implements LdiTransformer {
+public class ModelSplitTransformer implements LdiOneToManyTransformer {
private final String subjectType;
private final ModelSplitter modelSplitter;
- public ModelSplitTransformer(String subjectType, ModelSplitter modelSplitter) {
+ public ModelSplitTransformer(String subjectType) {
this.subjectType = subjectType;
- this.modelSplitter = modelSplitter;
+ this.modelSplitter = new ModelSplitter();
}
@Override
- public Collection apply(Model model) {
+ public List transform(Model model) {
return modelSplitter.split(model, subjectType);
}
-
}
diff --git a/ldi-core/model-splitter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitter.java b/ldi-core/model-splitter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitter.java
index 96bcd3421..81a140690 100644
--- a/ldi-core/model-splitter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitter.java
+++ b/ldi-core/model-splitter/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitter.java
@@ -8,18 +8,18 @@
import java.util.ArrayDeque;
import java.util.Deque;
-import java.util.Set;
+import java.util.List;
import static org.apache.commons.lang3.ObjectUtils.isNotEmpty;
import static org.apache.jena.rdf.model.ResourceFactory.createProperty;
public class ModelSplitter {
- public Set split(Model inputModel, String subjectType) {
+ public List split(Model inputModel, String subjectType) {
return inputModel
.listSubjectsWithProperty(RDF.type, createProperty(subjectType))
.mapWith(subject -> extractModelForSubject(inputModel, subject))
- .toSet();
+ .toList();
}
private Model extractModelForSubject(Model inputModel, Resource subject) {
diff --git a/ldi-core/model-splitter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitTransformerTest.java b/ldi-core/model-splitter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitTransformerTest.java
index 18dd47a51..d52c532c7 100644
--- a/ldi-core/model-splitter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitTransformerTest.java
+++ b/ldi-core/model-splitter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitTransformerTest.java
@@ -1,39 +1,28 @@
package be.vlaanderen.informatievlaanderen.ldes.ldi;
import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
+import org.apache.jena.riot.RDFParser;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.util.List;
-import java.util.Set;
-import static org.junit.jupiter.api.Assertions.*;
-import static org.mockito.Mockito.when;
+import static org.junit.jupiter.api.Assertions.assertEquals;
@ExtendWith(MockitoExtension.class)
class ModelSplitTransformerTest {
- @Mock
- private ModelSplitter modelSplitter;
-
@Test
void testApply() {
- String subjectType = "subjectType";
- ModelSplitTransformer modelSplitTransformer = new ModelSplitTransformer(subjectType, modelSplitter);
- Model modelA = ModelFactory.createDefaultModel();
- Model modelB = ModelFactory.createDefaultModel();
- Model modelC = ModelFactory.createDefaultModel();
- when(modelSplitter.split(modelA, subjectType)).thenReturn(Set.of(modelB, modelC));
+ String subjectType = "http://schema.org/Movie";
+ ModelSplitTransformer modelSplitTransformer = new ModelSplitTransformer(subjectType);
+
+ Model inputModel = RDFParser.source("generic/input.ttl").toModel();
- List result = modelSplitTransformer.apply(modelA).stream().toList();
+ List result = modelSplitTransformer.transform(inputModel).stream().toList();
assertEquals(2, result.size());
- assertFalse(result.contains(modelA));
- assertTrue(result.contains(modelB));
- assertTrue(result.contains(modelC));
}
}
diff --git a/ldi-core/model-splitter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitterTest.java b/ldi-core/model-splitter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitterTest.java
index 4d5840d79..1db7591a4 100644
--- a/ldi-core/model-splitter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitterTest.java
+++ b/ldi-core/model-splitter/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/ModelSplitterTest.java
@@ -17,7 +17,7 @@ class ModelSplitterTest {
@Test
void test_generic() {
Model inputModel = RDFParser.source("generic/input.ttl").toModel();
- Set result = new ModelSplitter().split(inputModel, "http://schema.org/Movie");
+ List result = new ModelSplitter().split(inputModel, "http://schema.org/Movie");
assertEquals(2, result.size());
assertModels(List.of("generic/member1.ttl", "generic/member2.ttl"), result);
@@ -26,7 +26,7 @@ void test_generic() {
@Test
void test_crowdscan() {
Model inputModel = RDFParser.source("crowdscan/input.ttl").toModel();
- Set result = new ModelSplitter().split(inputModel,
+ List result = new ModelSplitter().split(inputModel,
"http://def.isotc211.org/iso19156/2011/Observation#OM_Observation");
assertEquals(3, result.size());
@@ -37,7 +37,7 @@ void test_crowdscan() {
@Test
void test_traffic() {
Model inputModel = RDFParser.source("traffic/input.ttl").toModel();
- Set result = new ModelSplitter().split(inputModel,
+ List result = new ModelSplitter().split(inputModel,
"https://data.vlaanderen.be/ns/verkeersmetingen#Verkeersmeting");
assertEquals(10, result.size());
@@ -54,7 +54,7 @@ void test_traffic() {
"traffic/measure10.ttl"), result);
}
- private void assertModels(List expectedModelPaths, Set result) {
+ private void assertModels(List expectedModelPaths, List result) {
Set expectedModels = expectedModelPaths
.stream()
.map(RDFParser::source)
diff --git a/ldi-core/ngsiv2-to-ld-adapter/pom.xml b/ldi-core/ngsiv2-to-ld-adapter/pom.xml
index 93284e458..8f6917d16 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.ldildi-core
- 1.9.0
+ 1.10.0-SNAPSHOTngsiv2-to-ld-adapter
diff --git a/ldi-core/pom.xml b/ldi-core/pom.xml
index 0b4f2e94c..0dbcfa6dc 100644
--- a/ldi-core/pom.xml
+++ b/ldi-core/pom.xml
@@ -3,7 +3,7 @@
linked-data-interactionsbe.vlaanderen.informatievlaanderen.ldes
- 1.9.0
+ 1.10.0-SNAPSHOT4.0.0
diff --git a/ldi-core/rdf-adapter/pom.xml b/ldi-core/rdf-adapter/pom.xml
index ade730b4d..2048bb884 100644
--- a/ldi-core/rdf-adapter/pom.xml
+++ b/ldi-core/rdf-adapter/pom.xml
@@ -5,7 +5,7 @@
ldi-corebe.vlaanderen.informatievlaanderen.ldes.ldi
- 1.9.0
+ 1.10.0-SNAPSHOT4.0.0
diff --git a/ldi-core/repository-materialiser/pom.xml b/ldi-core/repository-materialiser/pom.xml
index 26b5e807c..66f811df5 100644
--- a/ldi-core/repository-materialiser/pom.xml
+++ b/ldi-core/repository-materialiser/pom.xml
@@ -6,7 +6,7 @@
be.vlaanderen.informatievlaanderen.ldes.ldildi-core
- 1.9.0
+ 1.10.0-SNAPSHOT
@@ -14,8 +14,6 @@
UTF-84.3.6
-
- ../..repository-materialiser
diff --git a/ldi-core/request-executor/pom.xml b/ldi-core/request-executor/pom.xml
index c70e1e0c0..bb63faa04 100644
--- a/ldi-core/request-executor/pom.xml
+++ b/ldi-core/request-executor/pom.xml
@@ -5,7 +5,7 @@
ldi-corebe.vlaanderen.informatievlaanderen.ldes.ldi
- 1.9.0
+ 1.10.0-SNAPSHOT4.0.0request-executor
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/EdcRequestExecutor.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/EdcRequestExecutor.java
new file mode 100644
index 000000000..ca8ca7587
--- /dev/null
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/EdcRequestExecutor.java
@@ -0,0 +1,41 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc;
+
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.RequestExecutor;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services.TokenService;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.valueobjects.EdcUrlProxy;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.*;
+
+import java.util.List;
+
+public class EdcRequestExecutor implements RequestExecutor {
+
+ private final RequestExecutor requestExecutor;
+ private final TokenService tokenService;
+ private final EdcUrlProxy urlProxy;
+
+ public EdcRequestExecutor(RequestExecutor requestExecutor, TokenService tokenService, EdcUrlProxy urlProxy) {
+ this.requestExecutor = requestExecutor;
+ this.tokenService = tokenService;
+ this.urlProxy = urlProxy;
+ }
+
+ @Override
+ public Response execute(Request request) {
+ final Request edcRequest = createEdcRequest(request);
+ var response = requestExecutor.execute(edcRequest);
+ if (response.isFobidden()) {
+ tokenService.invalidateToken();
+ return execute(request);
+ } else {
+ return response;
+ }
+ }
+
+ private Request createEdcRequest(Request request) {
+ final var tokenHeader = tokenService.waitForTokenHeader();
+ final var requestHeaders = new RequestHeaders(List.of(tokenHeader));
+ final var url = urlProxy.proxy(request.getUrl());
+ return request.with(url).with(requestHeaders);
+ }
+
+}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/README.md b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/README.md
new file mode 100644
index 000000000..e5bd40cce
--- /dev/null
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/README.md
@@ -0,0 +1,3 @@
+# Eclipse Dataspace Components (EDC) Request executor
+
+This implementation of the requestExecutor makes it possible to use the LDES Client within [edc](https://github.com/eclipse-edc).
\ No newline at end of file
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTokenService.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTokenService.java
new file mode 100644
index 000000000..bdf52ad22
--- /dev/null
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTokenService.java
@@ -0,0 +1,48 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services;
+
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.valueobjects.EdcToken;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.time.Duration;
+
+import static org.apache.commons.lang3.ThreadUtils.sleep;
+
+public class MemoryTokenService implements TokenService {
+
+ private final TransferService transferService;
+ private final Logger log = LoggerFactory.getLogger(MemoryTokenService.class);
+
+ private EdcToken token;
+
+ public MemoryTokenService(TransferService transferService) {
+ this.transferService = transferService;
+ }
+
+ public RequestHeader waitForTokenHeader() {
+ if (token != null) {
+ return token.getTokenHeader();
+ }
+
+ try {
+ log.info("waiting for token..");
+ sleep(Duration.ofSeconds(5));
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+
+ return waitForTokenHeader();
+ }
+
+ public void invalidateToken() {
+ token = null;
+ transferService.refreshTransfer();
+ }
+
+ @Override
+ public void updateToken(String token) {
+ this.token = EdcToken.fromJsonString(token);
+ }
+
+}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTransferService.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTransferService.java
new file mode 100644
index 000000000..e0018b35f
--- /dev/null
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTransferService.java
@@ -0,0 +1,46 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services;
+
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.RequestExecutor;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.PostRequest;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeader;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeaders;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.Response;
+import org.apache.http.HttpHeaders;
+import org.apache.http.entity.ContentType;
+
+import java.util.List;
+
+public class MemoryTransferService implements TransferService {
+
+ private final RequestExecutor requestExecutor;
+ private final String consumerConnectorUrl;
+ private String transfer;
+
+ public MemoryTransferService(RequestExecutor requestExecutor, String consumerConnectorUrl) {
+ this.requestExecutor = requestExecutor;
+ this.consumerConnectorUrl = consumerConnectorUrl;
+ }
+
+ @Override
+ public Response startTransfer(String transfer) {
+ this.transfer = transfer;
+ return sendTransferRequest();
+ }
+
+ @Override
+ public void refreshTransfer() {
+ if (transfer == null) {
+ throw new IllegalStateException("A transfer needs to be started before it can be refreshed!");
+ }
+
+ sendTransferRequest();
+ }
+
+ private Response sendTransferRequest() {
+ var contentType = new RequestHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
+ var requestHeaders = new RequestHeaders(List.of(contentType));
+ var request = new PostRequest(consumerConnectorUrl, requestHeaders, transfer);
+ return requestExecutor.execute(request);
+ }
+
+}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/TokenService.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/TokenService.java
new file mode 100644
index 000000000..58db9d9b7
--- /dev/null
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/TokenService.java
@@ -0,0 +1,13 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services;
+
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeader;
+
+public interface TokenService {
+
+ RequestHeader waitForTokenHeader();
+
+ void invalidateToken();
+
+ void updateToken(String token);
+
+}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/TransferService.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/TransferService.java
new file mode 100644
index 000000000..af6e4984b
--- /dev/null
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/TransferService.java
@@ -0,0 +1,11 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services;
+
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.Response;
+
+public interface TransferService {
+
+ Response startTransfer(String transfer);
+
+ void refreshTransfer();
+
+}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcToken.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcToken.java
new file mode 100644
index 000000000..8ab4ab1d1
--- /dev/null
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcToken.java
@@ -0,0 +1,31 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.valueobjects;
+
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeader;
+import org.apache.jena.atlas.json.JSON;
+import org.apache.jena.atlas.json.JsonObject;
+
+public class EdcToken {
+
+ private final JsonObject token;
+
+ private EdcToken(JsonObject token) {
+ this.token = token;
+ }
+
+ public static EdcToken fromJsonString(String token) {
+ return new EdcToken(JSON.parse(token));
+ }
+
+ public RequestHeader getTokenHeader() {
+ final var authKey = token.get("authKey");
+ if (authKey == null) {
+ throw new IllegalArgumentException("Invalid token: authKey not found");
+ }
+ final var authCode = token.get("authCode");
+ if (authCode == null) {
+ throw new IllegalArgumentException("Invalid token: authCode not found");
+ }
+ return new RequestHeader(authKey.getAsString().value(), authCode.getAsString().value());
+ }
+
+}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcUrlProxy.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcUrlProxy.java
new file mode 100644
index 000000000..cbfe75b68
--- /dev/null
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcUrlProxy.java
@@ -0,0 +1,35 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.valueobjects;
+
+/**
+ *
+ * Makes it possible to proxy a part of the url.
+ * For example when you are following an LDES at "www.example.com"
+ * through a consumer connector "www.my-fictional-connector.com".
+ *
+ *
+ * When the original LDES has a relation to follow to
+ * "www.example.com/by-location", this proxy will translate this to
+ * "www.my-fictional-connector.com/by-location".
+ *
+ *
+ * In this case "urlToReplace" is "www.example.com" and "replacementUrl" is
+ * "www.my-fictional-connector.com".
+ * This component is required until the LDES Server and Client support relative
+ * urls.
+ *
+ */
+public class EdcUrlProxy {
+
+ private final String urlToReplace;
+ private final String replacementUrl;
+
+ public EdcUrlProxy(String urlToReplace, String replacementUrl) {
+ this.urlToReplace = urlToReplace;
+ this.replacementUrl = replacementUrl;
+ }
+
+ public String proxy(String url) {
+ return url.replace(urlToReplace, replacementUrl);
+ }
+
+}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/services/RequestExecutorFactory.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/services/RequestExecutorFactory.java
index e00607d97..967b76e96 100644
--- a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/services/RequestExecutorFactory.java
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/services/RequestExecutorFactory.java
@@ -2,6 +2,9 @@
import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.RequestExecutor;
import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.clientcredentials.ClientCredentialsConfig;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.EdcRequestExecutor;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services.TokenService;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.valueobjects.EdcUrlProxy;
import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.noauth.ApiKeyConfig;
import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.noauth.DefaultConfig;
@@ -21,4 +24,10 @@ public RequestExecutor createClientCredentialsExecutor(String clientId,
return new ClientCredentialsConfig(clientId, secret, tokenEndpoint).createRequestExecutor();
}
+ public RequestExecutor createEdcExecutor(RequestExecutor requestExecutor,
+ TokenService tokenService,
+ EdcUrlProxy edcUrlProxy) {
+ return new EdcRequestExecutor(requestExecutor, tokenService, edcUrlProxy);
+ }
+
}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/GetRequest.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/GetRequest.java
index 5ab5386e4..31f1e8d7a 100644
--- a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/GetRequest.java
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/GetRequest.java
@@ -8,8 +8,19 @@ public GetRequest(String url, RequestHeaders requestHeaders) {
super(url, requestHeaders);
}
+ @Override
public String getMethod() {
return METHOD_NAME;
}
+ @Override
+ public Request with(String url) {
+ return new GetRequest(url, requestHeaders);
+ }
+
+ @Override
+ public Request with(RequestHeaders requestHeaders) {
+ return new GetRequest(url, requestHeaders);
+ }
+
}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/PostRequest.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/PostRequest.java
index 1fe15028d..c0f428603 100644
--- a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/PostRequest.java
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/PostRequest.java
@@ -3,6 +3,8 @@
import org.apache.http.HttpHeaders;
import org.apache.http.entity.ContentType;
+import java.util.Objects;
+
public class PostRequest extends Request {
public static final String METHOD_NAME = "POST";
@@ -17,6 +19,16 @@ public String getMethod() {
return METHOD_NAME;
}
+ @Override
+ public Request with(String url) {
+ return new PostRequest(url, requestHeaders, body);
+ }
+
+ @Override
+ public Request with(RequestHeaders requestHeaders) {
+ return new PostRequest(url, requestHeaders, body);
+ }
+
public String getBody() {
return body;
}
@@ -28,4 +40,21 @@ public String getContentType() {
.orElse(ContentType.TEXT_PLAIN.getMimeType());
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ if (!super.equals(o))
+ return false;
+ PostRequest that = (PostRequest) o;
+ return Objects.equals(body, that.body);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), body);
+ }
+
}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/Request.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/Request.java
index faa1acbee..6398cd987 100644
--- a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/Request.java
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/Request.java
@@ -1,5 +1,7 @@
package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects;
+import java.util.Objects;
+
import static org.apache.commons.lang3.Validate.notNull;
/**
@@ -7,8 +9,8 @@
*/
public abstract class Request {
- private final String url;
- private final RequestHeaders requestHeaders;
+ final String url;
+ final RequestHeaders requestHeaders;
protected Request(String url, RequestHeaders requestHeaders) {
this.url = url;
@@ -25,4 +27,23 @@ public RequestHeaders getRequestHeaders() {
public abstract String getMethod();
+ public abstract Request with(String url);
+
+ public abstract Request with(RequestHeaders requestHeaders);
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ Request request = (Request) o;
+ return Objects.equals(url, request.url) && Objects.equals(requestHeaders, request.requestHeaders);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(url, requestHeaders);
+ }
+
}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/RequestHeader.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/RequestHeader.java
index 0e3ef5aeb..92fe9a6e7 100644
--- a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/RequestHeader.java
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/RequestHeader.java
@@ -1,5 +1,7 @@
package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects;
+import java.util.Objects;
+
import static org.apache.commons.lang3.Validate.notNull;
public class RequestHeader {
@@ -26,4 +28,20 @@ public String getKey() {
public String getValue() {
return value;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ RequestHeader that = (RequestHeader) o;
+ return Objects.equals(key, that.key) && Objects.equals(value, that.value);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(key, value);
+ }
+
}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/RequestHeaders.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/RequestHeaders.java
index a73d8d263..53a643b23 100644
--- a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/RequestHeaders.java
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/RequestHeaders.java
@@ -12,7 +12,7 @@ public RequestHeaders(List requestHeaders) {
this.headers = requestHeaders;
}
- public RequestHeaders addRequestHeader(RequestHeader requestHeader) {
+ public RequestHeaders withRequestHeader(RequestHeader requestHeader) {
ArrayList updatedRequestHeaders = new ArrayList<>(headers);
updatedRequestHeaders.add(requestHeader);
return new RequestHeaders(updatedRequestHeaders);
@@ -32,4 +32,21 @@ public Optional getFirst(String key) {
.filter(header -> Objects.equals(lowerCase(header.getKey()), lowerCase(key)))
.findFirst();
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ RequestHeaders that = (RequestHeaders) o;
+ return new HashSet<>(headers).containsAll(that.headers)
+ && new HashSet<>(that.headers).containsAll(headers);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(headers);
+ }
+
}
diff --git a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/Response.java b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/Response.java
index 74de9c0c6..fd66c47d8 100644
--- a/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/Response.java
+++ b/ldi-core/request-executor/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/Response.java
@@ -41,6 +41,10 @@ public boolean isOk() {
return hasStatus(List.of(HttpStatus.SC_OK));
}
+ public boolean isFobidden() {
+ return hasStatus(List.of(HttpStatus.SC_FORBIDDEN));
+ }
+
public boolean isRedirect() {
final int permanentRedirect = 308; // not yet included in apache library
return hasStatus(List.of(
diff --git a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/EdcRequestExecutorTest.java b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/EdcRequestExecutorTest.java
new file mode 100644
index 000000000..c0a18a74f
--- /dev/null
+++ b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/EdcRequestExecutorTest.java
@@ -0,0 +1,59 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc;
+
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.RequestExecutor;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services.TokenService;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.valueobjects.EdcUrlProxy;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.GetRequest;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeader;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeaders;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.Response;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@ExtendWith(MockitoExtension.class)
+class EdcRequestExecutorTest {
+
+ @InjectMocks
+ private EdcRequestExecutor edcRequestExecutor;
+
+ @Mock
+ private EdcUrlProxy urlProxy;
+
+ @Mock
+ private RequestExecutor requestExecutor;
+
+ @Mock
+ private TokenService tokenService;
+
+ @Test
+ void test_execute() {
+ final var url = "http://example.org";
+ when(urlProxy.proxy(url)).thenReturn(url);
+ final var requestHeader = new RequestHeader("Authorization", "1234");
+ when(tokenService.waitForTokenHeader()).thenReturn(requestHeader);
+
+ final var request = new GetRequest(url, RequestHeaders.empty());
+ final var edcRequest = new GetRequest(url, new RequestHeaders(List.of(requestHeader)));
+ when(requestExecutor.execute(edcRequest))
+ .thenReturn(new Response(request, List.of(), 403, null))
+ .thenReturn(new Response(request, List.of(), 200, "body"));
+
+ Response response = edcRequestExecutor.execute(request);
+
+ verify(tokenService).invalidateToken();
+ assertEquals(200, response.getHttpStatus());
+ assertTrue(response.getBody().isPresent());
+ assertEquals("body", response.getBody().get());
+ }
+
+}
\ No newline at end of file
diff --git a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTokenServiceTest.java b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTokenServiceTest.java
new file mode 100644
index 000000000..e2f192e9a
--- /dev/null
+++ b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTokenServiceTest.java
@@ -0,0 +1,42 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services;
+
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeader;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import java.time.Duration;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+@ExtendWith(MockitoExtension.class)
+class MemoryTokenServiceTest {
+
+ @Mock
+ private TransferService transferService;
+
+ @InjectMocks
+ private MemoryTokenService memoryTokenService;
+
+ @Test
+ void test_memoryTokenService() {
+ memoryTokenService.updateToken("{'authKey': 'auth-key', 'authCode': 'auth-code'}");
+ // token is found after update
+ RequestHeader requestHeader = memoryTokenService.waitForTokenHeader();
+ assertNotNull(requestHeader);
+
+ verify(transferService, times(0)).refreshTransfer();
+ memoryTokenService.invalidateToken();
+
+ // no token is found after invalidation
+ final var duration = Duration.ofSeconds(1);
+ assertThrows(Error.class,
+ () -> assertTimeoutPreemptively(duration, () -> memoryTokenService.waitForTokenHeader()));
+ verify(transferService, times(1)).refreshTransfer();
+ }
+
+}
\ No newline at end of file
diff --git a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTransferServiceTest.java b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTransferServiceTest.java
new file mode 100644
index 000000000..2df0206c5
--- /dev/null
+++ b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/services/MemoryTransferServiceTest.java
@@ -0,0 +1,55 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services;
+
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.RequestExecutor;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.PostRequest;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeader;
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeaders;
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.apache.http.HttpHeaders;
+import org.apache.http.entity.ContentType;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+@ExtendWith(MockitoExtension.class)
+class MemoryTransferServiceTest {
+
+ @InjectMocks
+ private MemoryTransferService memoryTransferService;
+
+ @Mock
+ private RequestExecutor requestExecutor;
+
+ private final String consumerConnectorUrl = "http://example.org";
+
+ @BeforeEach
+ public void setUp() throws IllegalAccessException {
+ FieldUtils.writeField(memoryTransferService, "consumerConnectorUrl", consumerConnectorUrl, true);
+ }
+
+ @Test
+ void refreshTransfer_ShouldThrowException_WhenNoTransferStarted() {
+ assertThrows(IllegalStateException.class, memoryTransferService::refreshTransfer);
+ }
+
+ @Test
+ void startTransfer_AndrefreshTransfer_ShouldSendTransfer_WhenTransferIsAvailable() {
+ var transfer = "my-transfer";
+ memoryTransferService.startTransfer(transfer);
+ memoryTransferService.refreshTransfer();
+
+ var contentType = new RequestHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
+ var requestHeaders = new RequestHeaders(List.of(contentType));
+ var request = new PostRequest(consumerConnectorUrl, requestHeaders, transfer);
+ verify(requestExecutor, times(2)).execute(request);
+ }
+}
\ No newline at end of file
diff --git a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcTokenTest.java b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcTokenTest.java
new file mode 100644
index 000000000..73aef59b3
--- /dev/null
+++ b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcTokenTest.java
@@ -0,0 +1,41 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.valueobjects;
+
+import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects.RequestHeader;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class EdcTokenTest {
+
+ @Nested
+ class GetTokenHeader {
+
+ @Test
+ void shouldThrowException_WhenAuthKeyIsMissing() {
+ EdcToken edcToken = EdcToken.fromJsonString("{'authCode': 'auth-code'}");
+
+ var illegalArgumentException = assertThrows(IllegalArgumentException.class, edcToken::getTokenHeader);
+ assertTrue(illegalArgumentException.getMessage().contains("authKey not found"));
+ }
+
+ @Test
+ void shouldThrowException_WhenAuthCodeIsMissing() {
+ EdcToken edcToken = EdcToken.fromJsonString("{'authKey': 'auth-key'}");
+
+ var illegalArgumentException = assertThrows(IllegalArgumentException.class, edcToken::getTokenHeader);
+ assertTrue(illegalArgumentException.getMessage().contains("authCode not found"));
+ }
+
+ @Test
+ void shouldReturnToken_WhenPresent() {
+ EdcToken edcToken = EdcToken.fromJsonString("{'authKey': 'auth-key', 'authCode': 'auth-code'}");
+
+ RequestHeader tokenHeader = edcToken.getTokenHeader();
+
+ assertEquals("auth-key", tokenHeader.getKey());
+ assertEquals("auth-code", tokenHeader.getValue());
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcUrlProxyTest.java b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcUrlProxyTest.java
new file mode 100644
index 000000000..923f1b4cb
--- /dev/null
+++ b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/executor/edc/valueobjects/EdcUrlProxyTest.java
@@ -0,0 +1,18 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.valueobjects;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class EdcUrlProxyTest {
+
+ @Test
+ void proxy() {
+ EdcUrlProxy urlProxy = new EdcUrlProxy("www.to-replace.com", "www.replacement.com");
+
+ String result = urlProxy.proxy("www.to-replace.com/by-page?pageNumber=22");
+
+ assertEquals("www.replacement.com/by-page?pageNumber=22", result);
+ }
+
+}
\ No newline at end of file
diff --git a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/GetRequestTest.java b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/GetRequestTest.java
new file mode 100644
index 000000000..5cef2a70c
--- /dev/null
+++ b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/GetRequestTest.java
@@ -0,0 +1,32 @@
+package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class GetRequestTest {
+
+ @Test
+ void test_WithUrl() {
+ var initialRequest = new GetRequest("url", new RequestHeaders(List.of(new RequestHeader("key", "val"))));
+
+ var requestWithOtherUrl = initialRequest.with("other-url");
+ assertEquals(initialRequest.getRequestHeaders(), requestWithOtherUrl.getRequestHeaders());
+ assertEquals(initialRequest.getMethod(), requestWithOtherUrl.getMethod());
+ assertNotEquals(initialRequest.getUrl(), requestWithOtherUrl.getUrl());
+ }
+
+ @Test
+ void test_WithRequestHeaders() {
+ var initialRequest = new GetRequest("url", new RequestHeaders(List.of(new RequestHeader("key", "val"))));
+
+ var requestWithOtherUrl = initialRequest
+ .with(new RequestHeaders(List.of(new RequestHeader("other-key", "val"))));
+ assertNotEquals(initialRequest.getRequestHeaders(), requestWithOtherUrl.getRequestHeaders());
+ assertEquals(initialRequest.getMethod(), requestWithOtherUrl.getMethod());
+ assertEquals(initialRequest.getUrl(), requestWithOtherUrl.getUrl());
+ }
+
+}
\ No newline at end of file
diff --git a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/PostRequestTest.java b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/PostRequestTest.java
index d0874aa09..a7e2bcdcd 100644
--- a/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/PostRequestTest.java
+++ b/ldi-core/request-executor/src/test/java/be/vlaanderen/informatievlaanderen/ldes/ldi/requestexecutor/valueobjects/PostRequestTest.java
@@ -1,8 +1,16 @@
package be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.valueobjects;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.ArgumentsProvider;
+import org.junit.jupiter.params.provider.ArgumentsSource;
import java.util.List;
+import java.util.function.BiConsumer;
+import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.*;
@@ -28,4 +36,79 @@ void getContentType() {
assertEquals(contentType, new PostRequest(URL, new RequestHeaders(requestHeaders), BODY).getContentType());
}
+ @ParameterizedTest
+ @ArgumentsSource(EqualityTestProvider.class)
+ void testEqualsAndHashCode(BiConsumer