Skip to content

Commit

Permalink
Disable stable ID for contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
ununhexium committed Mar 13, 2024
1 parent e8db340 commit df6dfc5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit df6dfc5

Please sign in to comment.