From a6d66c10cfbf710c3b70ed6202cd02d8f454d392 Mon Sep 17 00:00:00 2001 From: Enrico Risa Date: Mon, 10 Jul 2023 17:18:39 +0200 Subject: [PATCH] fix after reviews --- .../control-plane-adapter-api/README.md | 6 +++--- .../api/cp/adapter/AdapterEdrController.java | 2 +- .../cp/adapter/AdapterEdrControllerTest.java | 2 +- .../gateway/ProviderGatewayController.java | 4 ++-- .../tractusx/edc/lifecycle/Participant.java | 8 +++---- .../yaml/control-plane-adapter-api.yaml | 21 +++---------------- 6 files changed, 14 insertions(+), 29 deletions(-) diff --git a/edc-extensions/control-plane-adapter-api/README.md b/edc-extensions/control-plane-adapter-api/README.md index 9fe30aea4..5d6b09e2a 100644 --- a/edc-extensions/control-plane-adapter-api/README.md +++ b/edc-extensions/control-plane-adapter-api/README.md @@ -1,10 +1,10 @@ # Control Plane Adapter API (EDR management) -This module provide a new APIs on top of the EDC management APIs for dealing with EDRs token. +This module provides extensions to the EDC management API for dealing with EDR tokens. -The APIs are mounted in the same context of the `management` APIs. So no additional configuration is required. +The extensions are added to the same context as the management APIs, so no additional configuration is required. -The base path of the API will be `/adapter/edrs` +The base path of the API will be `/edrs` This module for now provides three APIs: diff --git a/edc-extensions/control-plane-adapter-api/src/main/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrController.java b/edc-extensions/control-plane-adapter-api/src/main/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrController.java index 550a2cb81..557fa3a95 100644 --- a/edc-extensions/control-plane-adapter-api/src/main/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrController.java +++ b/edc-extensions/control-plane-adapter-api/src/main/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrController.java @@ -44,7 +44,7 @@ @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) -@Path("/adapter/edrs") +@Path("/edrs") public class AdapterEdrController implements AdapterEdrApi { private final AdapterTransferProcessService adapterTransferProcessService; diff --git a/edc-extensions/control-plane-adapter-api/src/test/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrControllerTest.java b/edc-extensions/control-plane-adapter-api/src/test/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrControllerTest.java index a598bf089..cfeee755d 100644 --- a/edc-extensions/control-plane-adapter-api/src/test/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrControllerTest.java +++ b/edc-extensions/control-plane-adapter-api/src/test/java/org/eclipse/tractusx/edc/api/cp/adapter/AdapterEdrControllerTest.java @@ -60,7 +60,7 @@ @ApiTest public class AdapterEdrControllerTest extends RestControllerTestBase { - public static final String ADAPTER_EDR_PATH = "/adapter/edrs"; + public static final String ADAPTER_EDR_PATH = "/edrs"; private final JsonLd jsonLdService = new TitaniumJsonLd(monitor); AdapterTransferProcessService adapterTransferProcessService = mock(AdapterTransferProcessService.class); TypeTransformerRegistry transformerRegistry = mock(TypeTransformerRegistry.class); diff --git a/edc-extensions/dataplane-proxy/edc-dataplane-proxy-provider-api/src/main/java/org/eclipse/tractusx/edc/dataplane/proxy/provider/api/gateway/ProviderGatewayController.java b/edc-extensions/dataplane-proxy/edc-dataplane-proxy-provider-api/src/main/java/org/eclipse/tractusx/edc/dataplane/proxy/provider/api/gateway/ProviderGatewayController.java index 1838908ae..f68dcfbb3 100644 --- a/edc-extensions/dataplane-proxy/edc-dataplane-proxy-provider-api/src/main/java/org/eclipse/tractusx/edc/dataplane/proxy/provider/api/gateway/ProviderGatewayController.java +++ b/edc-extensions/dataplane-proxy/edc-dataplane-proxy-provider-api/src/main/java/org/eclipse/tractusx/edc/dataplane/proxy/provider/api/gateway/ProviderGatewayController.java @@ -120,12 +120,12 @@ public void requestAsset(@Context ContainerRequestContext context, @Suspended As } var httpDataAddressResult = extractSourceDataAddress(token, configuration); - HttpDataAddress httpDataAddress = null; + HttpDataAddress httpDataAddress; if (httpDataAddressResult.succeeded()) { httpDataAddress = httpDataAddressResult.getContent(); } else { - monitor.debug(join(", ", httpDataAddressResult.getFailureMessages())); + monitor.debug("Request to token validation endpoint failed with errors: " + join(", ", httpDataAddressResult.getFailureMessages())); response.resume(createMessageResponse(UNAUTHORIZED, "Failed to decode data address", context.getMediaType())); return; } diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java index 5767bc2dc..eb8ba1906 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/Participant.java @@ -171,7 +171,7 @@ public String negotiateEdr(Participant other, String assetId, JsonArray callback var response = baseRequest() .when() .body(requestBody) - .post("/adapter/edrs") + .post("/edrs") .then(); var body = response.extract().body().asString(); @@ -200,7 +200,7 @@ public String getContractNegotiationError(String negotiationId) { public JsonObject getEdr(String transferProcessId) { return baseRequest() .when() - .get("/adapter/edrs/{id}", transferProcessId) + .get("/edrs/{id}", transferProcessId) .then() .statusCode(200) .extract() @@ -211,7 +211,7 @@ public JsonObject getEdr(String transferProcessId) { public JsonArray getEdrEntriesByAssetId(String assetId) { return baseRequest() .when() - .get("/adapter/edrs?assetId={assetId}", assetId) + .get("/edrs?assetId={assetId}", assetId) .then() .statusCode(200) .extract() @@ -222,7 +222,7 @@ public JsonArray getEdrEntriesByAssetId(String assetId) { public JsonArray getEdrEntriesByAgreementId(String agreementId) { return baseRequest() .when() - .get("/adapter/edrs?agreementId={agreementId}", agreementId) + .get("/edrs?agreementId={agreementId}", agreementId) .then() .statusCode(200) .extract() diff --git a/resources/openapi/yaml/control-plane-adapter-api.yaml b/resources/openapi/yaml/control-plane-adapter-api.yaml index 2e35d60e0..75eec75a5 100644 --- a/resources/openapi/yaml/control-plane-adapter-api.yaml +++ b/resources/openapi/yaml/control-plane-adapter-api.yaml @@ -1,6 +1,6 @@ openapi: 3.0.1 paths: - /adapter/edrs: + /edrs: get: description: Returns all EndpointDataReference entry according to a query operationId: queryEdrs @@ -82,7 +82,7 @@ paths: description: Request body was malformed tags: - Control Plane Adapter EDR Api - /adapter/edrs/{id}: + /edrs/{id}: get: description: Gets an EDR with the given transfer process ID) operationId: getEdr @@ -139,7 +139,7 @@ components: example: null properties: invalidValue: - type: string + type: object example: null message: type: string @@ -196,14 +196,6 @@ components: example: null policy: $ref: '#/components/schemas/Policy' - validity: - type: integer - format: int64 - example: null - required: - - assetId - - offerId - - policy DataAddressDto: type: object example: null @@ -220,8 +212,6 @@ components: type: string example: null example: null - required: - - properties Duty: type: object example: null @@ -334,11 +324,6 @@ components: providerId: type: string example: null - required: - - connectorAddress - - connectorId - - offer - - protocol Permission: type: object example: null