Skip to content

Commit

Permalink
feat: catalog + contract negotiation endpoints with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
richardtreier committed Sep 13, 2023
1 parent 0cc386a commit c795e57
Show file tree
Hide file tree
Showing 42 changed files with 215 additions and 620 deletions.
1 change: 1 addition & 0 deletions extensions/wrapper/client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dependencies {

testImplementation("${edcGroup}:json-ld-spi:${edcVersion}")
testImplementation("${edcGroup}:dsp-http-spi:${edcVersion}")
testImplementation("${edcGroup}:dsp-api-configuration:${edcVersion}")
testImplementation(project(":extensions:wrapper:wrapper"))
testImplementation(project(":extensions:wrapper:wrapper-common-mappers"))
testImplementation("io.rest-assured:rest-assured:${restAssured}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import de.sovity.edc.client.gen.model.UiCriterionDto;
import de.sovity.edc.client.gen.model.UiCriterionLiteralDto;
import de.sovity.edc.ext.wrapper.api.common.mappers.OperatorMapper;
import de.sovity.edc.ext.wrapper.api.ui.pages.contracts.services.utils.CriterionMapper;
import de.sovity.edc.ext.wrapper.api.ui.pages.contract_definitions.CriterionMapper;
import org.eclipse.edc.connector.contract.spi.types.offer.ContractDefinition;
import org.eclipse.edc.connector.spi.contractdefinition.ContractDefinitionService;
import org.eclipse.edc.junit.annotations.ApiTest;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
package de.sovity.edc.client;


import de.sovity.edc.client.gen.model.ContractNegotiationRequest;
import de.sovity.edc.client.gen.model.PolicyDefinitionCreateRequest;
import de.sovity.edc.client.gen.model.PolicyDefinitionDto;
import de.sovity.edc.client.gen.model.UiPolicyConstraint;
import de.sovity.edc.client.gen.model.UiPolicyCreateRequest;
import de.sovity.edc.client.gen.model.UiPolicyLiteral;
import jakarta.json.Json;
import lombok.SneakyThrows;
import org.eclipse.edc.connector.spi.contractnegotiation.ContractNegotiationService;
import org.eclipse.edc.connector.spi.policydefinition.PolicyDefinitionService;
import org.eclipse.edc.junit.annotations.ApiTest;
import org.eclipse.edc.junit.extensions.EdcExtension;
Expand All @@ -35,10 +32,7 @@

import java.util.List;

import static jakarta.json.Json.createObjectBuilder;
import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.CONTEXT;
import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE;

@ApiTest
@ExtendWith(EdcExtension.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public class PolicyDefinitionDto {
private String policyDefinitionId;

@Schema(description = "Policy Contents", requiredMode = Schema.RequiredMode.REQUIRED)
private UiPolicyDto policy;
private UiPolicy policy;
}

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@Builder(toBuilder = true)
@RequiredArgsConstructor
@Schema(description = "Type-Safe OpenAPI generator friendly Policy DTO as needed by our UI")
public class UiPolicyDto {
public class UiPolicy {
@Schema(description = "EDC Policy JSON-LD. This is required because the EDC requires the " +
"full policy when initiating contract negotiations.", requiredMode = RequiredMode.REQUIRED)
private String policyJsonLd;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package de.sovity.edc.ext.wrapper.api.common.mappers;

import de.sovity.edc.ext.wrapper.api.common.model.UiAsset;
import de.sovity.edc.utils.jsonld.JsonLdUtils;
import de.sovity.edc.utils.jsonld.vocab.Prop;
import jakarta.json.Json;
import jakarta.json.JsonObject;
import lombok.RequiredArgsConstructor;
import org.eclipse.edc.spi.types.domain.asset.Asset;
Expand All @@ -22,16 +19,6 @@ public UiAsset buildUiAsset(Asset asset) {
}

public Asset buildAssetFromAssetPropertiesJsonLd(JsonObject json) {
var assetJson = buildAssetJsonLd(json);
return typeTransformerRegistry.transform(assetJson, Asset.class).getContent();
}

private JsonObject buildAssetJsonLd(JsonObject properties) {
var id = JsonLdUtils.string(properties, Prop.Edc.ID);

return Json.createObjectBuilder()
.add(Prop.ID, id)
.add("properties", properties)
.build();
return typeTransformerRegistry.transform(json, Asset.class).getContent();
}
}

This file was deleted.

Loading

0 comments on commit c795e57

Please sign in to comment.