Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing detail in transfer-01 #191

Merged
merged 1 commit into from
Jan 15, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"protocol": "dataspace-protocol-http",
"policy": {
"@context": "http://www.w3.org/ns/odrl.jsonld",
"@id": "{{contract-negotiation-id}}",
"@id": "{{contract-offer-id}}",
"@type": "Set",
"permission": [],
"prohibition": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class NegotiationCommon {
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 = "contractAgreementId";
private static final String CONTRACT_NEGOTIATION_ID_KEY = "\\{\\{contract-negotiation-id\\}\\}";
private static final String CONTRACT_OFFER_ID_KEY = "{{contract-offer-id}}";

public static void createAsset() {
post(PrerequisitesCommon.PROVIDER_MANAGEMENT_URL + V3_ASSETS_PATH, getFileContentFromRelativePath(CREATE_ASSET_FILE_PATH));
Expand All @@ -67,7 +67,7 @@ public static String fetchDatasetFromCatalog(String fetchDatasetFromCatalogFileP

public static String negotiateContract(String negotiateContractFilePath, String catalogDatasetId) {
var requestBody = getFileContentFromRelativePath(negotiateContractFilePath)
.replaceAll(CONTRACT_NEGOTIATION_ID_KEY, catalogDatasetId);
.replace(CONTRACT_OFFER_ID_KEY, catalogDatasetId);
var contractNegotiationId = post(
PrerequisitesCommon.CONSUMER_MANAGEMENT_URL + V2_CONTRACT_NEGOTIATIONS_PATH,
requestBody,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import static io.restassured.RestAssured.given;
import static org.awaitility.Awaitility.await;
import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID;
import static org.eclipse.edc.samples.common.PrerequisitesCommon.API_KEY_HEADER_KEY;
import static org.eclipse.edc.samples.common.PrerequisitesCommon.API_KEY_HEADER_VALUE;
import static org.eclipse.edc.samples.common.PrerequisitesCommon.CONSUMER_MANAGEMENT_URL;
Expand All @@ -35,8 +36,7 @@ public class TransferUtil {
public static final Duration POLL_DELAY = Duration.ofMillis(1000);
public static final Duration POLL_INTERVAL = Duration.ofMillis(500);

private static final String TRANSFER_PROCESS_ID = "@id";
private static final String CONTRACT_AGREEMENT_ID_KEY = "\\{\\{contract-agreement-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 = "state";

Expand Down Expand Up @@ -95,8 +95,8 @@ public static String post(String url, String requestBody, String jsonPath) {
}

public static String startTransfer(String requestBody, String contractAgreementId) {
requestBody = requestBody.replaceAll(CONTRACT_AGREEMENT_ID_KEY, contractAgreementId);
return post(CONSUMER_MANAGEMENT_URL + V2_TRANSFER_PROCESSES_PATH, requestBody, TRANSFER_PROCESS_ID);
requestBody = requestBody.replace(CONTRACT_AGREEMENT_ID_KEY, contractAgreementId);
return post(CONSUMER_MANAGEMENT_URL + V2_TRANSFER_PROCESSES_PATH, requestBody, ID);
}

public static void checkTransferStatus(String transferProcessId, TransferProcessStates status) {
Expand Down
5 changes: 4 additions & 1 deletion transfer/transfer-01-negotiation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ looks as follows:
Of course, this is the simplest possible negotiation sequence. Later on, both connectors can also
send counteroffers in addition to just confirming or declining an offer.

Please replace the `{{contract-offer-id}}` placeholder in the [`negotiate-contract.json`](resources/negotiate-contract.json)
file with the contract offer id you found in the catalog at the path `dcat:dataset.odrl:hasPolicy.@id`.

```bash
curl -d @transfer/transfer-01-negotiation/resources/negotiate-contract.json \
-X POST -H 'content-type: application/json' http://localhost:29193/management/v2/contractnegotiations \
Expand Down Expand Up @@ -217,7 +220,7 @@ Sample output:

```json
{
"@type": "ContractNegotiationDto",
"@type": "ContractNegotiation",
"@id": "5ca21b82-075b-4682-add8-c26c9a2ced67",
"type": "CONSUMER",
"protocol": "dataspace-protocol-http",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"protocol": "dataspace-protocol-http",
"policy": {
"@context": "http://www.w3.org/ns/odrl.jsonld",
"@id": "{{contract-negotiation-id}}",
"@id": "{{contract-offer-id}}",
"@type": "Set",
"permission": [],
"prohibition": [],
Expand Down
Loading