diff --git a/docs/api/sovity-edc-api-wrapper.yaml b/docs/api/sovity-edc-api-wrapper.yaml index 85919fa45..c794ad87c 100644 --- a/docs/api/sovity-edc-api-wrapper.yaml +++ b/docs/api/sovity-edc-api-wrapper.yaml @@ -275,6 +275,10 @@ paths: description: Fetch a connector's data offers operationId: getCatalogPageDataOffers parameters: + - name: participantId + in: query + schema: + type: string - name: connectorEndpoint in: query schema: @@ -623,11 +627,11 @@ components: DataSourceType: type: string description: Supported Data Source Types by UiDataSource - default: CUSTOM enum: - HTTP_DATA - ON_REQUEST - CUSTOM + default: CUSTOM SecretValue: type: object properties: @@ -835,7 +839,6 @@ components: UiDataSourceHttpDataMethod: type: string description: Supported HTTP Methods by UiDataSource - default: GET enum: - GET - POST @@ -843,6 +846,7 @@ components: - PATCH - DELETE - OPTIONS + default: GET UiDataSourceOnRequest: required: - contactEmail diff --git a/extensions/contract-termination/src/main/java/de/sovity/edc/extension/contacttermination/ContractTerminationExtension.java b/extensions/contract-termination/src/main/java/de/sovity/edc/extension/contacttermination/ContractTerminationExtension.java index bd51bc29c..b932a6e71 100644 --- a/extensions/contract-termination/src/main/java/de/sovity/edc/extension/contacttermination/ContractTerminationExtension.java +++ b/extensions/contract-termination/src/main/java/de/sovity/edc/extension/contacttermination/ContractTerminationExtension.java @@ -22,7 +22,7 @@ import de.sovity.edc.extension.messenger.SovityMessengerRegistry; import de.sovity.edc.utils.config.ConfigProps; import lombok.val; -import org.eclipse.edc.connector.transfer.spi.observe.TransferProcessObservable; +import org.eclipse.edc.connector.controlplane.transfer.spi.observe.TransferProcessObservable; import org.eclipse.edc.runtime.metamodel.annotation.Inject; import org.eclipse.edc.runtime.metamodel.annotation.Provides; import org.eclipse.edc.spi.agent.ParticipantAgentService; diff --git a/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResource.java b/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResource.java index 71895a4b0..cc2dffe6d 100644 --- a/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResource.java +++ b/extensions/wrapper/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResource.java @@ -148,7 +148,8 @@ interface UiResource { @Path("pages/catalog-page/data-offers") @Produces(MediaType.APPLICATION_JSON) @Operation(description = "Fetch a connector's data offers") - List getCatalogPageDataOffers(@QueryParam("connectorEndpoint") String connectorEndpoint); + // TODO: request it from the UI or add a workaround here? + List getCatalogPageDataOffers(@QueryParam("participantId") String participantId, @QueryParam("connectorEndpoint") String connectorEndpoint); @POST @Path("pages/catalog-page/contract-negotiations") diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/WrapperExtension.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/WrapperExtension.java index 8fe4cd330..cf7001881 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/WrapperExtension.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/WrapperExtension.java @@ -19,8 +19,6 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import de.sovity.edc.extension.contacttermination.ContractAgreementTerminationService; import de.sovity.edc.extension.db.directaccess.DslContextFactory; -import org.eclipse.edc.connector.api.management.configuration.ManagementApiConfiguration; -import org.eclipse.edc.connector.api.management.configuration.transform.ManagementApiTypeTransformerRegistry; import org.eclipse.edc.connector.controlplane.contract.spi.negotiation.store.ContractNegotiationStore; import org.eclipse.edc.connector.controlplane.contract.spi.offer.store.ContractDefinitionStore; import org.eclipse.edc.connector.controlplane.policy.spi.store.PolicyDefinitionStore; @@ -34,14 +32,14 @@ import org.eclipse.edc.connector.controlplane.transfer.spi.store.TransferProcessStore; import org.eclipse.edc.jsonld.spi.JsonLd; import org.eclipse.edc.policy.engine.spi.PolicyEngine; -import org.eclipse.edc.protocol.dsp.api.configuration.DspApiConfiguration; import org.eclipse.edc.runtime.metamodel.annotation.Inject; -import org.eclipse.edc.spi.CoreConstants; +import org.eclipse.edc.spi.constants.CoreConstants; import org.eclipse.edc.connector.controlplane.asset.spi.index.AssetIndex; import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.types.TypeManager; import org.eclipse.edc.web.spi.WebService; +import org.eclipse.edc.web.spi.configuration.ApiContext; public class WrapperExtension implements ServiceExtension { @@ -66,10 +64,6 @@ public class WrapperExtension implements ServiceExtension { @Inject private DslContextFactory dslContextFactory; @Inject - private DspApiConfiguration dspApiConfiguration; - @Inject - private ManagementApiConfiguration dataManagementApiConfiguration; - @Inject private PolicyDefinitionStore policyDefinitionStore; @Inject private PolicyEngine policyEngine; @@ -79,8 +73,9 @@ public class WrapperExtension implements ServiceExtension { private TransferProcessStore transferProcessStore; @Inject private TypeManager typeManager; - @Inject - private ManagementApiTypeTransformerRegistry typeTransformerRegistry; + // TODO: was revomed, maybe replaced with ManagementApiTypeTransformerRegistryImpl between v0.5.1..v0.6.0 +// @Inject +// private ManagementApiTypeTransformerRegistry typeTransformerRegistry; @Inject private WebService webService; @Inject @@ -120,14 +115,15 @@ public void initialize(ServiceExtensionContext context) { policyEngine, transferProcessService, transferProcessStore, - typeTransformerRegistry + // TODO: what is the new value? is it necessary? + null ); wrapperExtensionContext.managementApiResources().forEach(resource -> - webService.registerResource(dataManagementApiConfiguration.getContextAlias(), resource)); + webService.registerResource(ApiContext.MANAGEMENT, resource)); wrapperExtensionContext.dspApiResources().forEach(resource -> - webService.registerResource(dspApiConfiguration.getContextAlias(), resource)); + webService.registerResource(ApiContext.PROTOCOL, resource)); } private void fixObjectMapperDateSerialization(ObjectMapper objectMapper) { diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ServiceException.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ServiceException.java index 3a4af30d5..dde8bddbc 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ServiceException.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ServiceException.java @@ -15,16 +15,8 @@ package de.sovity.edc.ext.wrapper.api; import jakarta.ws.rs.WebApplicationException; -import org.eclipse.edc.service.spi.result.ServiceResult; import org.eclipse.edc.spi.result.Failure; -import java.util.function.Function; - -/** - * Exception for handling {@link ServiceResult} {@link Failure}s. - * - * @see ServiceResult#orElseThrow(Function) - */ public class ServiceException extends WebApplicationException { public ServiceException(Failure failure) { super(failure.getFailureDetail(), 500); diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResourceImpl.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResourceImpl.java index 4bd6ee056..c6c234a8b 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResourceImpl.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/UiResourceImpl.java @@ -142,8 +142,8 @@ public IdResponseDto createDataOffer(DataOfferCreationRequest dataOfferCreationR } @Override - public List getCatalogPageDataOffers(String connectorEndpoint) { - return catalogApiService.fetchDataOffers(connectorEndpoint); + public List getCatalogPageDataOffers(String participantId, String connectorEndpoint) { + return catalogApiService.fetchDataOffers(participantId, connectorEndpoint); } @Override diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/asset/AssetApiService.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/asset/AssetApiService.java index c83fc7919..01dc35f8f 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/asset/AssetApiService.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/asset/AssetApiService.java @@ -64,7 +64,7 @@ public IdResponseDto editAsset(String assetId, UiAssetEditRequest request) { Objects.requireNonNull(foundAsset, "Asset with ID %s not found".formatted(assetId)); val editedAsset = assetMapper.editAsset(foundAsset, request); val updatedAsset = assetService.update(editedAsset).orElseThrow(ServiceException::new); - assetService.update(editedAsset.getId(), editedAsset.getDataAddress()); + assetService.update(editedAsset); return new IdResponseDto(updatedAsset.getId()); } diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/catalog/CatalogApiService.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/catalog/CatalogApiService.java index 05fc378b2..f2d23543d 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/catalog/CatalogApiService.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/catalog/CatalogApiService.java @@ -25,8 +25,8 @@ public class CatalogApiService { private final UiDataOfferBuilder uiDataOfferBuilder; private final DspCatalogService dspCatalogService; - public List fetchDataOffers(String connectorEndpoint) { - var dspCatalog = dspCatalogService.fetchDataOffers(connectorEndpoint); + public List fetchDataOffers(String participantId, String connectorEndpoint) { + var dspCatalog = dspCatalogService.fetchDataOffers(participantId, connectorEndpoint); return uiDataOfferBuilder.buildUiDataOffers(dspCatalog); } } diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contract_agreements/services/ParameterizationCompatibilityUtils.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contract_agreements/services/ParameterizationCompatibilityUtils.java index 0a3dd04d8..51d57f56f 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contract_agreements/services/ParameterizationCompatibilityUtils.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contract_agreements/services/ParameterizationCompatibilityUtils.java @@ -21,7 +21,7 @@ import java.util.HashMap; import java.util.Map; -import static org.eclipse.edc.spi.CoreConstants.EDC_NAMESPACE; +import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE; public class ParameterizationCompatibilityUtils { private static final String WORKAROUND = "https://sovity.de/workaround/proxy/param/"; diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contract_negotiations/ContractNegotiationBuilder.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contract_negotiations/ContractNegotiationBuilder.java index f58a225e5..9bea99a24 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contract_negotiations/ContractNegotiationBuilder.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/ui/pages/contract_negotiations/ContractNegotiationBuilder.java @@ -31,7 +31,9 @@ public ContractRequest buildContractNegotiation(ContractNegotiationRequest reque return ContractRequest.Builder.newInstance() .counterPartyAddress(counterPartyAddress) - .providerId(request.getCounterPartyParticipantId()) + // TODO: deprecated and moved into the contractOffer.policy.assigner, set by `.contractOffer()` below + // git diff v0.5.1..v0.6.0 -- spi/control-plane/contract-spi/src/main/java/org/eclipse/edc/connector/contract/spi/types/negotiation/ContractRequest.java +// .providerId(request.getCounterPartyParticipantId()) .protocol(HttpMessageProtocol.DATASPACE_PROTOCOL_HTTP) .contractOffer(contractOfferMapper.buildContractOffer(request)) .build(); diff --git a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/usecase/pages/catalog/UseCaseCatalogApiService.java b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/usecase/pages/catalog/UseCaseCatalogApiService.java index b149481dc..4d6fe6a41 100644 --- a/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/usecase/pages/catalog/UseCaseCatalogApiService.java +++ b/extensions/wrapper/wrapper/src/main/java/de/sovity/edc/ext/wrapper/api/usecase/pages/catalog/UseCaseCatalogApiService.java @@ -32,7 +32,10 @@ public class UseCaseCatalogApiService { public List fetchDataOffers(CatalogQuery catalogQuery) { var querySpec = buildQuerySpec(catalogQuery); - var dspCatalog = dspCatalogService.fetchDataOffersWithFilters(catalogQuery.getConnectorEndpoint(), "TODO", querySpec); + var dspCatalog = dspCatalogService.fetchDataOffersWithFilters( + catalogQuery.getParticipantId(), + catalogQuery.getConnectorEndpoint(), + querySpec); return uiDataOfferBuilder.buildUiDataOffers(dspCatalog); } 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 9c14b532d..0b184e0dd 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 @@ -38,13 +38,20 @@ class DspCatalogServiceTest { String endpoint = "http://localhost:11003/api/v1/dsp"; + String participantId = "someParticipantId"; private DspCatalogService newDspCatalogService(String resultJsonFilename) { var catalogJson = readFile(resultJsonFilename); var catalogService = mock(CatalogService.class); var result = CompletableFuture.completedFuture(StatusResult.success(catalogJson.getBytes(StandardCharsets.UTF_8))); - when(catalogService.requestCatalog(eq(endpoint), eq("dataspace-protocol-http"), eq(QuerySpec.max()))).thenReturn(result); + when(catalogService.requestCatalog( + eq(participantId), + eq(endpoint), + eq("dataspace-protocol-http"), + eq(QuerySpec.max())) + ).thenReturn(result); + var monitor = mock(Monitor.class); var dataOfferBuilder = new DspDataOfferBuilder(new TitaniumJsonLd(monitor)); @@ -57,7 +64,7 @@ void testCatalogMapping() { var dspCatalogService = newDspCatalogService("catalogResponse.json"); // act - var actual = dspCatalogService.fetchDataOffers(endpoint); + var actual = dspCatalogService.fetchDataOffers(participantId, endpoint); // assert var offers = actual.getDataOffers(); @@ -66,7 +73,7 @@ void testCatalogMapping() { assertThat(actual.getEndpoint()).isEqualTo(endpoint); assertThat(actual.getParticipantId()).isEqualTo("provider"); assertThat(JsonLdUtils.id(offer.getAssetPropertiesJsonLd())) - .isEqualTo("test-1.0"); + .isEqualTo("test-1.0"); assertThat(offer.getAssetPropertiesJsonLd().get(Prop.TYPE)).isNull(); assertThat(JsonLdUtils.string(offer.getAssetPropertiesJsonLd(), Prop.Dcat.VERSION)).isEqualTo("1.0"); diff --git a/utils/test-utils/src/main/java/de/sovity/edc/extension/e2e/connector/remotes/api_wrapper/E2eTestScenario.java b/utils/test-utils/src/main/java/de/sovity/edc/extension/e2e/connector/remotes/api_wrapper/E2eTestScenario.java index 5545b02a6..698cf8e14 100644 --- a/utils/test-utils/src/main/java/de/sovity/edc/extension/e2e/connector/remotes/api_wrapper/E2eTestScenario.java +++ b/utils/test-utils/src/main/java/de/sovity/edc/extension/e2e/connector/remotes/api_wrapper/E2eTestScenario.java @@ -164,7 +164,7 @@ public IdResponseDto createContractDefinition(String policyId, String assetId) { public UiContractNegotiation negotiateAssetAndAwait(String assetId) { val connectorEndpoint = config.getProviderProtocolApiUrl(); val participantId = config.getProviderParticipantId(); - val offers = consumerClient.uiApi().getCatalogPageDataOffers(connectorEndpoint); + val offers = consumerClient.uiApi().getCatalogPageDataOffers(participantId, connectorEndpoint); val offersContainingContract = offers.stream() .filter(offer -> offer.getAsset().getAssetId().equals(assetId))