Skip to content

Commit

Permalink
Adapt to version 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Nov 21, 2023
1 parent 230759f commit 1fc3a5a
Show file tree
Hide file tree
Showing 30 changed files with 141 additions and 154 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
{
"@context": {
"edc": "https://w3id.org/edc/v0.0.1/ns/",
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
"odrl": "http://www.w3.org/ns/odrl/2/"
},
"@type": "NegotiationInitiateRequestDto",
"connectorId": "provider",
"connectorAddress": "http://provider:19194/protocol",
"counterPartyAddress": "http://provider:19194/protocol",
"consumerId": "consumer",
"providerId": "provider",
"protocol": "dataspace-protocol-http",
"offer": {
"offerId": "MQ==:YXNzZXRJZA==:YTc4OGEwYjMtODRlZi00NWYwLTgwOWQtMGZjZTMwMGM3Y2Ey",
"assetId": "assetId",
"policy": {
"@id": "MQ==:YXNzZXRJZA==:YTc4OGEwYjMtODRlZi00NWYwLTgwOWQtMGZjZTMwMGM3Y2Ey",
"@type": "Set",
"odrl:permission": [],
"odrl:prohibition": [],
"odrl:obligation": [],
"odrl:target": "assetId"
}
"policy": {
"@id": "MQ==:YXNzZXRJZA==:YTc4OGEwYjMtODRlZi00NWYwLTgwOWQtMGZjZTMwMGM3Y2Ey",
"@type": "Set",
"odrl:permission": [],
"odrl:prohibition": [],
"odrl:obligation": [],
"odrl:target": "assetId"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"@context": {
"edc": "https://w3id.org/edc/v0.0.1/ns/"
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
},
"@type": "TransferRequestDto",
"connectorId": "provider",
"connectorAddress": "http://provider:19194/protocol",
"counterPartyAddress": "http://provider:19194/protocol",
"contractId": "<contract agreement id>",
"assetId": "assetId",
"protocol": "dataspace-protocol-http",
"dataDestination": {
"type": "HttpProxy"
}
}
}
1 change: 0 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ edc-transfer-data-plane = { module = "org.eclipse.edc:transfer-data-plane", vers
edc-transfer-process-api = { module = "org.eclipse.edc:transfer-process-api", version.ref = "edc" }
edc-transfer-pull-http-receiver = { module = "org.eclipse.edc:transfer-pull-http-receiver", version.ref = "edc" }
edc-transfer-pull-http-dynamic-receiver = { module = "org.eclipse.edc:transfer-pull-http-dynamic-receiver", version.ref = "edc" }
edc-transfer-spi = { module = "org.eclipse.edc:transfer-spi", version.ref = "edc" }
edc-util = { module = "org.eclipse.edc:util", version.ref = "edc" }
edc-vault-azure = { module = "org.eclipse.edc:vault-azure", version.ref = "edc" }
edc-vault-filesystem = { module = "org.eclipse.edc:vault-filesystem", version.ref = "edc" }
Expand Down
3 changes: 1 addition & 2 deletions system-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ plugins {
}

dependencies {
implementation(libs.edc.transfer.spi)

testImplementation(libs.edc.junit)
testImplementation(libs.edc.json.ld)
testImplementation(libs.edc.control.plane.spi)
testImplementation(libs.awaitility)
testImplementation(libs.okhttp.mockwebserver)
testImplementation(libs.restAssured)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class NegotiationCommon {

private static final String CREATE_ASSET_FILE_PATH = "transfer/transfer-01-negotiation/resources/create-asset.json";
private static final String V2_ASSETS_PATH = "/v2/assets";
private static final String V3_ASSETS_PATH = "/v3/assets";
private static final String CREATE_POLICY_FILE_PATH = "transfer/transfer-01-negotiation/resources/create-policy.json";
private static final String V2_POLICY_DEFINITIONS_PATH = "/v2/policydefinitions";
private static final String CREATE_CONTRACT_DEFINITION_FILE_PATH = "transfer/transfer-01-negotiation/resources/create-contract-definition.json";
Expand All @@ -38,10 +38,10 @@ public class NegotiationCommon {
private static final String NEGOTIATE_CONTRACT_FILE_PATH = "transfer/transfer-01-negotiation/resources/negotiate-contract.json";
private static final String V2_CONTRACT_NEGOTIATIONS_PATH = "/v2/contractnegotiations/";
private static final String CONTRACT_NEGOTIATION_ID = "@id";
private static final String CONTRACT_AGREEMENT_ID = "'edc:contractAgreementId'";
private static final String CONTRACT_AGREEMENT_ID = "contractAgreementId";

public static void createAsset() {
post(PrerequisitesCommon.PROVIDER_MANAGEMENT_URL + V2_ASSETS_PATH, getFileContentFromRelativePath(CREATE_ASSET_FILE_PATH));
post(PrerequisitesCommon.PROVIDER_MANAGEMENT_URL + V3_ASSETS_PATH, getFileContentFromRelativePath(CREATE_ASSET_FILE_PATH));
}

public static void createPolicy() {
Expand All @@ -67,10 +67,11 @@ public static String negotiateContract() {
}

public static String getContractAgreementId(String contractNegotiationId) {
String url = PrerequisitesCommon.CONSUMER_MANAGEMENT_URL + V2_CONTRACT_NEGOTIATIONS_PATH + contractNegotiationId;
return await()
.atMost(TIMEOUT)
.pollInterval(POLL_INTERVAL)
.until(() -> get(PrerequisitesCommon.CONSUMER_MANAGEMENT_URL + V2_CONTRACT_NEGOTIATIONS_PATH + contractNegotiationId, CONTRACT_AGREEMENT_ID), Objects::nonNull);
.until(() -> get(url, CONTRACT_AGREEMENT_ID), Objects::nonNull);
}

public static String runNegotiation() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
*
*/

package org.eclipse.edc.samples.transfer.streaming;

import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import static io.restassured.http.ContentType.JSON;
import static jakarta.json.Json.createArrayBuilder;
import static jakarta.json.Json.createObjectBuilder;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
import static org.eclipse.edc.connector.contract.spi.types.negotiation.ContractNegotiationStates.FINALIZED;
Expand Down Expand Up @@ -218,13 +217,9 @@ public String negotiateContract(Participant provider, String offerId, String ass
.add(CONTEXT, createObjectBuilder().add(EDC_PREFIX, EDC_NAMESPACE))
.add(TYPE, "ContractRequestDto")
.add("providerId", provider.id)
.add("connectorAddress", provider.protocolEndpoint.url.toString())
.add("counterPartyAddress", provider.protocolEndpoint.url.toString())
.add("protocol", DSP_PROTOCOL)
.add("offer", createObjectBuilder()
.add("offerId", offerId)
.add("assetId", assetId)
.add("policy", jsonLd.compact(policy).getContent())
)
.add("policy", jsonLd.compact(policy).getContent())
.build();

var negotiationId = managementEndpoint.baseRequest()
Expand Down Expand Up @@ -263,7 +258,7 @@ public String initiateTransfer(Participant provider, String contractAgreementId,
.add("assetId", assetId)
.add("contractId", contractAgreementId)
.add("connectorId", provider.id)
.add("connectorAddress", provider.protocolEndpoint.url.toString())
.add("counterPartyAddress", provider.protocolEndpoint.url.toString())
.add("privateProperties", privateProperties)
.build();

Expand Down Expand Up @@ -314,7 +309,7 @@ public String getTransferProcessState(String id) {
.get("/v2/transferprocesses/{id}/state", id)
.then()
.statusCode(200)
.extract().body().jsonPath().getString("'edc:state'");
.extract().body().jsonPath().getString("state");
}

private String getContractNegotiationState(String id) {
Expand All @@ -324,7 +319,7 @@ private String getContractNegotiationState(String id) {
.get("/v2/contractnegotiations/{id}/state", id)
.then()
.statusCode(200)
.extract().body().jsonPath().getString("'edc:state'");
.extract().body().jsonPath().getString("state");
}


Expand All @@ -351,7 +346,7 @@ private String getContractNegotiationField(String negotiationId, String fieldNam
.then()
.statusCode(200)
.extract().body().jsonPath()
.getString(format("'edc:%s'", fieldName));
.getString(fieldName);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class TransferUtil {
private static final String TRANSFER_PROCESS_ID = "@id";
private static final String CONTRACT_AGREEMENT_ID_KEY = "<contract agreement id>";
private static final String V2_TRANSFER_PROCESSES_PATH = "/v2/transferprocesses/";
private static final String EDC_STATE = "'edc:state'";
private static final String EDC_STATE = "state";

public static void get(String url) {
given()
Expand All @@ -46,8 +46,7 @@ public static void get(String url) {
.when()
.get(url)
.then()
.log()
.ifError()
.log().ifError()
.statusCode(HttpStatus.SC_OK);
}

Expand All @@ -58,8 +57,7 @@ public static String get(String url, String jsonPath) {
.when()
.get(url)
.then()
.log()
.ifError()
.log().ifError()
.statusCode(HttpStatus.SC_OK)
.body(jsonPath, not(emptyString()))
.extract()
Expand All @@ -75,8 +73,7 @@ public static void post(String url, String requestBody) {
.when()
.post(url)
.then()
.log()
.ifError()
.log().ifError()
.statusCode(HttpStatus.SC_OK);
}

Expand All @@ -88,8 +85,7 @@ public static String post(String url, String requestBody, String jsonPath) {
.when()
.post(url)
.then()
.log()
.ifError()
.log().ifError()
.statusCode(HttpStatus.SC_OK)
.body(jsonPath, not(emptyString()))
.extract()
Expand Down
4 changes: 2 additions & 2 deletions transfer/streaming/streaming-01-http-to-http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ The output will be something like:
},
"dcat:accessService": "b24dfdbc-d17f-4d6e-9b5c-8fa71dacecfc"
},
"edc:id": "stream-asset",
"id": "stream-asset",
"@context": {
"dct": "https://purl.org/dc/terms/",
"edc": "https://w3id.org/edc/v0.0.1/ns/",
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
"dcat": "https://www.w3.org/ns/dcat/",
"odrl": "http://www.w3.org/ns/odrl/2/",
"dspace": "https://w3id.org/dspace/v0.8/"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@context": {
"edc": "https://w3id.org/edc/v0.0.1/ns/"
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
},
"@id": "http-pull-provider-dataplane",
"url": "http://localhost:19192/control/transfer",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{
"@context": {
"edc": "https://w3id.org/edc/v0.0.1/ns/",
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
"odrl": "http://www.w3.org/ns/odrl/2/"
},
"@type": "NegotiationInitiateRequestDto",
"connectorAddress": "http://localhost:18182/protocol",
"counterPartyAddress": "http://localhost:18182/protocol",
"providerId": "provider",
"protocol": "dataspace-protocol-http",
"offer": {
"offerId": "{{offerId}}",
"assetId": "stream-asset",
"policy": {
"@id": "{{offerId}}",
"@type": "use",
"odrl:permission": [],
"odrl:prohibition": [],
"odrl:obligation": [],
"odrl:target": "stream-asset"
}
}
"policy": {
"@id": "{{offerId}}",
"@type": "use",
"odrl:permission": [],
"odrl:prohibition": [],
"odrl:obligation": [],
"odrl:target": "stream-asset"
}
}
4 changes: 2 additions & 2 deletions transfer/streaming/streaming-01-http-to-http/transfer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@context": {
"edc": "https://w3id.org/edc/v0.0.1/ns/"
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
},
"@type": "TransferRequest",
"dataDestination": {
Expand All @@ -11,5 +11,5 @@
"assetId": "stream-asset",
"contractId": "{{contract-agreement-id}}",
"connectorId": "provider",
"connectorAddress": "http://localhost:18182/protocol"
"counterPartyAddress": "http://localhost:18182/protocol"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@context": {
"edc": "https://w3id.org/edc/v0.0.1/ns/"
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
},
"@id": "http-pull-provider-dataplane",
"url": "http://localhost:19192/control/transfer",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
{
"@context": {
"edc": "https://w3id.org/edc/v0.0.1/ns/",
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
"odrl": "http://www.w3.org/ns/odrl/2/"
},
"@type": "NegotiationInitiateRequestDto",
"connectorAddress": "http://localhost:18182/protocol",
"counterPartyAddress": "http://localhost:18182/protocol",
"providerId": "provider",
"protocol": "dataspace-protocol-http",
"offer": {
"offerId": "{{offerId}}",
"assetId": "kafka-stream-asset",
"policy": {
"@id": "{{offerId}}",
"@type": "use",
"odrl:permission": [],
"odrl:prohibition": [],
"odrl:obligation": [],
"odrl:target": "kafka-stream-asset"
}
"policy": {
"@id": "{{offerId}}",
"@type": "use",
"odrl:permission": [],
"odrl:prohibition": [],
"odrl:obligation": [],
"odrl:target": "kafka-stream-asset"
}
}
4 changes: 2 additions & 2 deletions transfer/streaming/streaming-02-kafka-to-http/6-transfer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@context": {
"edc": "https://w3id.org/edc/v0.0.1/ns/"
"@vocab": "https://w3id.org/edc/v0.0.1/ns/"
},
"@type": "TransferRequest",
"dataDestination": {
Expand All @@ -11,5 +11,5 @@
"assetId": "stream-asset",
"contractId": "{{contract-agreement-id}}",
"connectorId": "provider",
"connectorAddress": "http://localhost:18182/protocol"
"counterPartyAddress": "http://localhost:18182/protocol"
}
6 changes: 3 additions & 3 deletions transfer/streaming/streaming-02-kafka-to-http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ The output will be something like:
},
"dcat:accessService": "b24dfdbc-d17f-4d6e-9b5c-8fa71dacecfc"
},
"edc:id": "kafka-stream-asset",
"id": "kafka-stream-asset",
"@context": {
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
"dct": "https://purl.org/dc/terms/",
"edc": "https://w3id.org/edc/v0.0.1/ns/",
"dcat": "https://www.w3.org/ns/dcat/",
"odrl": "http://www.w3.org/ns/odrl/2/",
"dspace": "https://w3id.org/dspace/v0.8/"
Expand Down Expand Up @@ -151,4 +151,4 @@ Path: /
Body:
<message-sent>
...
```
```
Loading

0 comments on commit 1fc3a5a

Please sign in to comment.