Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions advanced/advanced-01-open-telemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ The output will be something like:
"@id": "cb701b36-48ee-4132-8436-dba7b83c606c",
"@type": "dcat:DataService",
"dcat:endpointDescription": "dspace:connector",
"dcat:endpointUrl": "http://provider:19194/protocol",
"dcat:endpointUrl": "http://provider:19194/protocol/2025-1",
"dct:terms": "dspace:connector",
"dct:endpointUrl": "http://provider:19194/protocol"
"dct:endpointUrl": "http://provider:19194/protocol/2025-1"
}
},
{
Expand All @@ -113,9 +113,9 @@ The output will be something like:
"@id": "cb701b36-48ee-4132-8436-dba7b83c606c",
"@type": "dcat:DataService",
"dcat:endpointDescription": "dspace:connector",
"dcat:endpointUrl": "http://provider:19194/protocol",
"dcat:endpointUrl": "http://provider:19194/protocol/2025-1",
"dct:terms": "dspace:connector",
"dct:endpointUrl": "http://provider:19194/protocol"
"dct:endpointUrl": "http://provider:19194/protocol/2025-1"
}
}
],
Expand All @@ -128,7 +128,7 @@ The output will be something like:
"dcat": "http://www.w3.org/ns/dcat#",
"dct": "http://purl.org/dc/terms/",
"odrl": "http://www.w3.org/ns/odrl/2/",
"dspace": "https://w3id.org/dspace/v0.8/"
"dspace": "https://w3id.org/dspace/2025/1/"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"@context": { "@vocab": "https://w3id.org/edc/v0.0.1/ns/" },
"@type": "DatasetRequest",
"@id": "assetId",
"counterPartyAddress": "http://provider:19194/protocol",
"protocol": "dataspace-protocol-http"
}
"counterPartyId": "provider",
"counterPartyAddress": "http://provider:19194/protocol/2025-1",
"protocol": "dataspace-protocol-http:2025-1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
},
"@type": "ContractRequest",
"counterPartyAddress": "http://provider:19194/protocol",
"protocol": "dataspace-protocol-http",
"counterPartyId": "provider",
"counterPartyAddress": "http://provider:19194/protocol/2025-1",
"protocol": "dataspace-protocol-http:2025-1",
"policy": {
"@context": "http://www.w3.org/ns/odrl.jsonld",
"@id": "{{contract-offer-id}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
},
"@type": "TransferRequestDto",
"connectorId": "provider",
"counterPartyAddress": "http://provider:19194/protocol",
"counterPartyAddress": "http://provider:19194/protocol/2025-1",
"contractId": "{{contract-agreement-id}}",
"protocol": "dataspace-protocol-http",
"protocol": "dataspace-protocol-http:2025-1",
"transferType": "HttpData-PULL"
}
4 changes: 2 additions & 2 deletions federated-catalog/fc-01-embedded/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ Sample output:

},
"dspace:participantId": "provider",
"originator": "http://localhost:19194/protocol",
"originator": "http://localhost:19194/protocol/2025-1",
"@context": {
}
}
]
```
```
4 changes: 2 additions & 2 deletions federated-catalog/fc-02-standalone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ Sample output:

},
"dspace:participantId": "provider",
"originator": "http://localhost:19194/protocol",
"originator": "http://localhost:19194/protocol/2025-1",
"@context": {

}
}
]
```
```
6 changes: 3 additions & 3 deletions federated-catalog/fc-03-static-node-directory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ In this case, the file contains the properties of the `participant-connector` fr
{
"name": "https://w3id.org/edc/v0.0.1/ns/",
"id": "provider",
"url": "http://localhost:19194/protocol",
"supportedProtocols": ["dataspace-protocol-http"]
"url": "http://localhost:19194/protocol/2025-1",
"supportedProtocols": ["dataspace-protocol-http:2025-1"]
}
```
However, this solution is intended for use only within the sample scope; in production, it must be managed in different way.
Expand Down Expand Up @@ -136,4 +136,4 @@ To get the combined set of catalogs, use the following request:
curl -d @federated-catalog/fc-01-embedded/resources/empty-query.json \
-H 'content-type: application/json' http://localhost:29195/api/catalog/v1alpha/catalog/query \
-s | jq
```
```
4 changes: 2 additions & 2 deletions policy/policy-01-policy-enforcement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ We'll receive the following catalog in the response, where we can see the offer
"@id": "fe9581ee-b4ec-473c-b0b7-96f30d957e87",
"@type": "dcat:DataService",
"dct:terms": "connector",
"dct:endpointUrl": "http://localhost:8282/protocol"
"dct:endpointUrl": "http://localhost:8282/protocol/2025-1"
},
"participantId": "provider",
"@context": {
Expand All @@ -281,7 +281,7 @@ We'll receive the following catalog in the response, where we can see the offer
"dcat": "https://www.w3.org/ns/dcat/",
"dct": "https://purl.org/dc/terms/",
"odrl": "http://www.w3.org/ns/odrl/2/",
"dspace": "https://w3id.org/dspace/v0.8/"
"dspace": "https://w3id.org/dspace/2025/1/"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"@context": {
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
},
"counterPartyAddress": "http://localhost:19194/protocol",
"protocol": "dataspace-protocol-http"
"counterPartyId": "provider",
"counterPartyAddress": "http://localhost:19194/protocol/2025-1",
"protocol": "dataspace-protocol-http:2025-1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
},
"@type": "ContractRequest",
"counterPartyAddress": "http://localhost:19194/protocol",
"protocol": "dataspace-protocol-http",
"counterPartyId": "provider",
"counterPartyAddress": "http://localhost:19194/protocol/2025-1",
"protocol": "dataspace-protocol-http:2025-1",
"policy": {
"@context": "http://www.w3.org/ns/odrl.jsonld",
"@id": "1:test-document:13dce0f1-52ed-4554-a194-e83e92733ee5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath;
import static org.eclipse.edc.samples.util.TransferUtil.POLL_INTERVAL;
import static org.eclipse.edc.samples.util.TransferUtil.TIMEOUT;
import static org.eclipse.edc.samples.util.TransferUtil.extractContractOfferId;
import static org.eclipse.edc.samples.util.TransferUtil.get;
import static org.eclipse.edc.samples.util.TransferUtil.post;

Expand All @@ -29,19 +30,18 @@ public class FileTransferCloudCommon {
private static final String CONSUMER_MANAGEMENT_URL = "http://localhost:29193/management";
private static final String V3_CATALOG_DATASET_REQUEST_PATH = "/v3/catalog/dataset/request";
private static final String FETCH_DATASET_FROM_CATALOG_FILE_PATH = "transfer/transfer-05-file-transfer-cloud/resources/get-dataset.json";
private static final String CATALOG_DATASET_ID = "\"odrl:hasPolicy\".'@id'";
private static final String NEGOTIATE_CONTRACT_FILE_PATH = "transfer/transfer-05-file-transfer-cloud/resources/negotiate-contract.json";
private static final String V3_CONTRACT_NEGOTIATIONS_PATH = "/v3/contractnegotiations/";
private static final String CONTRACT_NEGOTIATION_ID = "@id";
private static final String CONTRACT_AGREEMENT_ID = "contractAgreementId";
private static final String CONTRACT_OFFER_ID_KEY = "{{contract-offer-id}}";

public static String fetchDatasetFromCatalog(String fetchDatasetFromCatalogFilePath) {
var catalogDatasetId = post(
var response = post(
CONSUMER_MANAGEMENT_URL + V3_CATALOG_DATASET_REQUEST_PATH,
getFileContentFromRelativePath(fetchDatasetFromCatalogFilePath),
CATALOG_DATASET_ID
getFileContentFromRelativePath(fetchDatasetFromCatalogFilePath)
);
var catalogDatasetId = extractContractOfferId(response);
assertThat(catalogDatasetId).isNotEmpty();
return catalogDatasetId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.eclipse.edc.samples.common.FileTransferCommon.getFileContentFromRelativePath;
import static org.eclipse.edc.samples.util.TransferUtil.POLL_INTERVAL;
import static org.eclipse.edc.samples.util.TransferUtil.TIMEOUT;
import static org.eclipse.edc.samples.util.TransferUtil.extractContractOfferId;
import static org.eclipse.edc.samples.util.TransferUtil.get;
import static org.eclipse.edc.samples.util.TransferUtil.post;

Expand All @@ -36,7 +37,6 @@ public class NegotiationCommon {
private static final String V2_CONTRACT_DEFINITIONS_PATH = "/v3/contractdefinitions";
private static final String V2_CATALOG_DATASET_REQUEST_PATH = "/v3/catalog/dataset/request";
private static final String FETCH_DATASET_FROM_CATALOG_FILE_PATH = "transfer/transfer-01-negotiation/resources/get-dataset.json";
private static final String CATALOG_DATASET_ID = "\"odrl:hasPolicy\".'@id'";
private static final String NEGOTIATE_CONTRACT_FILE_PATH = "transfer/transfer-01-negotiation/resources/negotiate-contract.json";
private static final String V2_CONTRACT_NEGOTIATIONS_PATH = "/v3/contractnegotiations/";
private static final String CONTRACT_NEGOTIATION_ID = "@id";
Expand All @@ -56,11 +56,11 @@ public static void createContractDefinition() {
}

public static String fetchDatasetFromCatalog(String fetchDatasetFromCatalogFilePath) {
var catalogDatasetId = post(
var response = post(
PrerequisitesCommon.CONSUMER_MANAGEMENT_URL + V2_CATALOG_DATASET_REQUEST_PATH,
getFileContentFromRelativePath(fetchDatasetFromCatalogFilePath),
CATALOG_DATASET_ID
getFileContentFromRelativePath(fetchDatasetFromCatalogFilePath)
);
var catalogDatasetId = extractContractOfferId(response);
assertThat(catalogDatasetId).isNotEmpty();
return catalogDatasetId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.eclipse.edc.connector.controlplane.test.system.utils.Participant;
import org.eclipse.edc.junit.utils.LazySupplier;
import org.eclipse.edc.samples.util.TransferUtil;

import java.net.URI;

Expand Down Expand Up @@ -72,15 +73,14 @@ public String createContractDefinition(String requestBody) {
}

public String fetchDatasetFromCatalog(String requestBody) {
return baseManagementRequest()
return TransferUtil.extractContractOfferId(baseManagementRequest()
.contentType(JSON)
.body(requestBody)
.when()
.post("/v3/catalog/dataset/request")
.then()
.statusCode(200)
.contentType(JSON)
.extract().jsonPath().getString("'odrl:hasPolicy'.@id");
.contentType(JSON));
}

public String negotiateContract(String requestBody) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ public class Transfer06KafkaBrokerTest {
.name("provider")
.id("provider")
.controlPlaneManagement(new LazySupplier<>(() -> URI.create("http://localhost:18181/management")))
.controlPlaneProtocol(new LazySupplier<>(() -> URI.create("http://localhost:18182/protocol")))
.controlPlaneProtocol(new LazySupplier<>(() -> URI.create("http://localhost:18182/protocol/2025-1")))
.build();
private static final StreamingParticipant CONSUMER = StreamingParticipant.Builder.newStreamingInstance()
.name("consumer")
.id("consumer")
.controlPlaneManagement(new LazySupplier<>(() -> URI.create("http://localhost:28181/management")))
.controlPlaneProtocol(new LazySupplier<>(() -> URI.create("http://localhost:28182/protocol")))
.controlPlaneProtocol(new LazySupplier<>(() -> URI.create("http://localhost:28182/protocol/2025-1")))
.build();
private static final String GROUP_ID = "group_id";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

package org.eclipse.edc.samples.util;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.restassured.http.ContentType;
import io.restassured.response.ValidatableResponse;
import org.apache.http.HttpStatus;
Expand All @@ -37,6 +40,7 @@ public class TransferUtil {
public static final Duration TIMEOUT = Duration.ofSeconds(30);
public static final Duration POLL_DELAY = Duration.ofMillis(1000);
public static final Duration POLL_INTERVAL = Duration.ofMillis(500);
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

private static final String CONTRACT_AGREEMENT_ID_KEY = "{{contract-agreement-id}}";
private static final String V2_TRANSFER_PROCESSES_PATH = "/v3/transferprocesses/";
Expand Down Expand Up @@ -88,6 +92,36 @@ public static String post(String url, String requestBody, String jsonPath) {
.get(jsonPath);
}

public static String extractContractOfferId(ValidatableResponse response) {
try {
var body = response.extract().asString();
var root = OBJECT_MAPPER.readTree(body);
var offerId = readPolicyId(root, "odrl:hasPolicy");
if (offerId != null) {
return offerId;
}

offerId = readPolicyId(root, "hasPolicy");
if (offerId != null) {
return offerId;
}

offerId = readPolicyId(root, "dcat:dataset", "odrl:hasPolicy");
if (offerId != null) {
return offerId;
}

offerId = readPolicyId(root, "dcat:dataset", "hasPolicy");
if (offerId != null) {
return offerId;
}

throw new IllegalStateException("Cannot extract contract offer id from response: " + body);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}

public static String startTransfer(String requestBody, String contractAgreementId) {
requestBody = requestBody.replace(CONTRACT_AGREEMENT_ID_KEY, contractAgreementId);
return post(CONSUMER_MANAGEMENT_URL + V2_TRANSFER_PROCESSES_PATH, requestBody, ID);
Expand All @@ -103,4 +137,23 @@ public static void checkTransferStatus(String transferProcessId, TransferProcess
assertThat(state).isEqualTo(status.name());
});
}

private static String readText(JsonNode root, String... path) {
var node = root;
for (var key : path) {
node = node.path(key);
}
return node.isMissingNode() || node.isNull() ? null : node.asText();
}

private static String readPolicyId(JsonNode root, String... path) {
var node = root;
for (var key : path) {
node = node.path(key);
}
if (node.isArray()) {
node = node.isEmpty() ? null : node.get(0);
}
return node == null ? null : readText(node, ID);
}
}
10 changes: 5 additions & 5 deletions transfer/transfer-01-negotiation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ Sample output:
"@id": "2a5178c3-c937-4ac2-85be-c46dbc6c5642",
"@type": "dcat:DataService",
"dct:terms": "connector",
"dct:endpointUrl": "http://localhost:19194/protocol"
"dct:endpointUrl": "http://localhost:19194/protocol/2025-1"
},
"participantId": "anonymous",
"@context": {
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
"dct": "https://purl.org/dc/terms/",
"dcat": "https://www.w3.org/ns/dcat/",
"odrl": "http://www.w3.org/ns/odrl/2/",
"dspace": "https://w3id.org/dspace/v0.8/"
"dspace": "https://w3id.org/dspace/2025/1/"
}
}
```
Expand Down Expand Up @@ -216,17 +216,17 @@ Sample output:
"@type": "ContractNegotiation",
"@id": "5ca21b82-075b-4682-add8-c26c9a2ced67",
"type": "CONSUMER",
"protocol": "dataspace-protocol-http",
"protocol": "dataspace-protocol-http:2025-1",
"state": "FINALIZED",
"counterPartyAddress": "http://localhost:19194/protocol",
"counterPartyAddress": "http://localhost:19194/protocol/2025-1",
"callbackAddresses": [],
"contractAgreementId": "0b3150be-feaf-43bc-91e1-90f050de28bd", <---------
"@context": {
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
"dct": "https://purl.org/dc/terms/",
"dcat": "https://www.w3.org/ns/dcat/",
"odrl": "http://www.w3.org/ns/odrl/2/",
"dspace": "https://w3id.org/dspace/v0.8/"
"dspace": "https://w3id.org/dspace/2025/1/"
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"@context": {
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
},
"counterPartyAddress": "http://localhost:19194/protocol",
"protocol": "dataspace-protocol-http"
"counterPartyId": "provider",
"counterPartyAddress": "http://localhost:19194/protocol/2025-1",
"protocol": "dataspace-protocol-http:2025-1"
}
7 changes: 4 additions & 3 deletions transfer/transfer-01-negotiation/resources/get-dataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"@context": { "@vocab": "https://w3id.org/edc/v0.0.1/ns/" },
"@type": "DatasetRequest",
"@id": "assetId",
"counterPartyAddress": "http://localhost:19194/protocol",
"protocol": "dataspace-protocol-http"
}
"counterPartyId": "provider",
"counterPartyAddress": "http://localhost:19194/protocol/2025-1",
"protocol": "dataspace-protocol-http:2025-1"
}
Loading
Loading