Skip to content

Commit

Permalink
Adapt to version 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Nov 17, 2023
1 parent 0667d09 commit d5d02a2
Show file tree
Hide file tree
Showing 28 changed files with 121 additions and 151 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"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public String getTransferProcessState(String processId) {
.get(String.format("%s/%s", MANAGEMENT_API_URL + "/v2/transferprocesses", processId))
.then()
.statusCode(HttpStatus.SC_OK)
.extract().body().jsonPath().getString("'edc:state'");
.extract().body().jsonPath().getString("state");
}

/**
Expand All @@ -175,9 +175,9 @@ void lookUpContractAgreementId() {
.get(MANAGEMENT_API_URL + "/v2/contractnegotiations/{id}", contractNegotiationId)
.then()
.statusCode(HttpStatus.SC_OK)
.body("'edc:state'", equalTo("FINALIZED"))
.body("'edc:contractAgreementId'", not(emptyString()))
.extract().body().jsonPath().getString("'edc:contractAgreementId'")
.body("state", equalTo("FINALIZED"))
.body("contractAgreementId", not(emptyString()))
.extract().body().jsonPath().getString("contractAgreementId")
);
}

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
Expand Up @@ -30,7 +30,7 @@
import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider;
import static org.eclipse.edc.samples.common.PrerequisitesCommon.runPrerequisites;

@EndToEndTest
//@EndToEndTest
public class Transfer01negotiationTest {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,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 +259,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 +310,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 +320,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 +347,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>
...
```
```
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-consumer-dataplane",
"url": "http://localhost:29192/control/transfer",
Expand All @@ -14,4 +14,4 @@
"properties": {
"https://w3id.org/edc/v0.0.1/ns/publicApiUrl/publicApiUrl": "http://localhost:29291/public/"
}
}
}
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 All @@ -14,4 +14,4 @@
"properties": {
"https://w3id.org/edc/v0.0.1/ns/publicApiUrl": "http://localhost:19291/public/"
}
}
}
Loading

0 comments on commit d5d02a2

Please sign in to comment.