From 3aeb06b21d6004f161b30614eac66af8963421de Mon Sep 17 00:00:00 2001 From: Christophe Loiseau Date: Wed, 13 Mar 2024 15:37:27 +0100 Subject: [PATCH] Disable stable ID for contracts --- .github/workflows/ci.yml | 2 +- .../edc/utils/catalog/mapper/DspDataOfferBuilder.java | 6 +----- .../de/sovity/edc/utils/catalog/DspCatalogServiceTest.java | 2 +- .../edc/utils/catalog/mapper/DspContractOfferUtilsTest.java | 2 ++ .../de/sovity/edc/utils/catalog/catalogResponse.json | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd4f3bb9f..90de3884c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: release: types: [ published ] pull_request: - branches: [ main ] + branches: [ main, version/v7.2.1 ] env: REGISTRY_URL: ghcr.io diff --git a/utils/catalog-parser/src/main/java/de/sovity/edc/utils/catalog/mapper/DspDataOfferBuilder.java b/utils/catalog-parser/src/main/java/de/sovity/edc/utils/catalog/mapper/DspDataOfferBuilder.java index f5ef31736..119d9d102 100644 --- a/utils/catalog-parser/src/main/java/de/sovity/edc/utils/catalog/mapper/DspDataOfferBuilder.java +++ b/utils/catalog-parser/src/main/java/de/sovity/edc/utils/catalog/mapper/DspDataOfferBuilder.java @@ -22,7 +22,6 @@ import jakarta.json.Json; import jakarta.json.JsonObject; import lombok.RequiredArgsConstructor; -import lombok.val; import org.eclipse.edc.jsonld.spi.JsonLd; import org.jetbrains.annotations.NotNull; @@ -67,9 +66,6 @@ private DspDataOffer buildDataOffer(JsonObject dataset) { @NotNull private DspContractOffer buildContractOffer(JsonObject json) { - val stableId = DspContractOfferUtils.buildStableId(json); - val withStableId = Json.createObjectBuilder(json).remove(Prop.ID).add(Prop.ID, stableId).build(); - - return new DspContractOffer(stableId, withStableId); + return new DspContractOffer(JsonLdUtils.id(json), json); } } diff --git a/utils/catalog-parser/src/test/java/de/sovity/edc/utils/catalog/DspCatalogServiceTest.java b/utils/catalog-parser/src/test/java/de/sovity/edc/utils/catalog/DspCatalogServiceTest.java index 4a34cb5a1..88fa35cb2 100644 --- a/utils/catalog-parser/src/test/java/de/sovity/edc/utils/catalog/DspCatalogServiceTest.java +++ b/utils/catalog-parser/src/test/java/de/sovity/edc/utils/catalog/DspCatalogServiceTest.java @@ -72,7 +72,7 @@ void testCatalogMapping() { assertThat(offer.getContractOffers()).hasSize(1); var co = offer.getContractOffers().get(0); - assertThat(co.getContractOfferId()).isEqualTo("contract-id:asset-id:ODJjMDNjMmM4YzQ5NmE0OTg4ZjVjOTY4OGU2MmMyN2UxYjIxZDAwZQ=="); + assertThat(co.getContractOfferId()).isEqualTo("policy-1"); assertThat(toJson(co.getPolicyJsonLd())).contains("ALWAYS_TRUE"); assertThat(offer.getDistributions()).hasSize(1); diff --git a/utils/catalog-parser/src/test/java/de/sovity/edc/utils/catalog/mapper/DspContractOfferUtilsTest.java b/utils/catalog-parser/src/test/java/de/sovity/edc/utils/catalog/mapper/DspContractOfferUtilsTest.java index 21ceeed8d..90304cf97 100644 --- a/utils/catalog-parser/src/test/java/de/sovity/edc/utils/catalog/mapper/DspContractOfferUtilsTest.java +++ b/utils/catalog-parser/src/test/java/de/sovity/edc/utils/catalog/mapper/DspContractOfferUtilsTest.java @@ -2,11 +2,13 @@ import jakarta.json.Json; import lombok.val; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; class DspContractOfferUtilsTest { + @Disabled("hotfix: the stable ID or the way the new ID is build prevents a contract negotiation.") @Test void testCanConvertTheRandomIdToStableId() { // arrange diff --git a/utils/catalog-parser/src/test/resources/de/sovity/edc/utils/catalog/catalogResponse.json b/utils/catalog-parser/src/test/resources/de/sovity/edc/utils/catalog/catalogResponse.json index 613b7ac49..d069f7302 100644 --- a/utils/catalog-parser/src/test/resources/de/sovity/edc/utils/catalog/catalogResponse.json +++ b/utils/catalog-parser/src/test/resources/de/sovity/edc/utils/catalog/catalogResponse.json @@ -5,7 +5,7 @@ "@id": "test-1.0", "@type": "dcat:Dataset", "odrl:hasPolicy": { - "@id": "contract-id:asset-id:policy-id", + "@id": "policy-1", "@type": "odrl:Set", "odrl:permission": { "odrl:target": "test-1.0",