diff --git a/pom.xml b/pom.xml index 375d94c..3473b93 100644 --- a/pom.xml +++ b/pom.xml @@ -184,7 +184,7 @@ - https://raw.githubusercontent.com/onecx/onecx-product-store-svc/feat/remote_components/src/main/openapi/onecx-product-store-internal.yaml + https://raw.githubusercontent.com/onecx/onecx-product-store-svc/main/src/main/openapi/onecx-product-store-internal.yaml target/tmp/openapi onecx-product-store-internal.yaml diff --git a/src/main/java/org/tkit/onecx/product/store/bff/rs/controllers/MicrofrontendsRestController.java b/src/main/java/org/tkit/onecx/product/store/bff/rs/controllers/MicrofrontendsRestController.java index c2482c3..5f3d9cf 100644 --- a/src/main/java/org/tkit/onecx/product/store/bff/rs/controllers/MicrofrontendsRestController.java +++ b/src/main/java/org/tkit/onecx/product/store/bff/rs/controllers/MicrofrontendsRestController.java @@ -77,14 +77,6 @@ public Response getMicrofrontend(String id) { } } - @Override - public Response getMicrofrontendByAppId(String appId) { - try (Response response = client.getMicrofrontendByAppId(appId)) { - MicrofrontendDTO result = mapper.mapMfe(response.readEntity(Microfrontend.class)); - return Response.status(response.getStatus()).entity(result).build(); - } - } - @Override public Response searchMicrofrontends(MfeAndMsSearchCriteriaDTO microfrontendSearchCriteriaDTO) { diff --git a/src/main/openapi/onecx-product-store-bff.yaml b/src/main/openapi/onecx-product-store-bff.yaml index 5d99769..c0205e8 100644 --- a/src/main/openapi/onecx-product-store-bff.yaml +++ b/src/main/openapi/onecx-product-store-bff.yaml @@ -12,7 +12,7 @@ info: servers: - url: "http://onecx-product-store-bff:8080" tags: - - name: OneCX Product Store + - name: Microfrontends paths: /microfrontends: post: @@ -78,31 +78,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ProblemDetailResponse' - /microfrontends/appId/{appId}: - get: - x-onecx: - permissions: - microfrontend: - - read - tags: - - Microfrontends - description: Return micro-frontend by its appId - operationId: getMicrofrontendByAppId - parameters: - - name: appId - in: path - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Microfrontend' - "404": - description: Not Found /microfrontends/{id}: get: x-onecx: @@ -750,6 +725,8 @@ components: uniqueItems: true items: type: string + undeployed: + type: boolean UpdateProductRequest: type: object required: @@ -776,6 +753,8 @@ components: uniqueItems: true items: type: string + undeployed: + type: boolean Product: type: object required: @@ -817,6 +796,8 @@ components: uniqueItems: true items: type: string + undeployed: + type: boolean ProductAndWorkspaces: type: object allOf: @@ -849,10 +830,12 @@ components: description: name of the product used for displaying to user. classifications: type: array - description: like tags for grouing and labeling. Used in frontend to enable filtering. + description: like tags for grouping and labeling. Used in frontend to enable filtering. uniqueItems: true items: type: string + undeployed: + type: boolean OffsetDateTime: format: date-time type: string @@ -945,6 +928,8 @@ components: type: string operator: type: boolean + deprecated: + type: boolean type: $ref: "#/components/schemas/MicrofrontendType" classifications: @@ -1024,6 +1009,8 @@ components: type: string exposedModule: type: string + deprecated: + type: boolean type: $ref: "#/components/schemas/MicrofrontendType" endpoints: @@ -1083,6 +1070,8 @@ components: type: string exposedModule: type: string + deprecated: + type: boolean type: $ref: "#/components/schemas/MicrofrontendType" endpoints: @@ -1157,6 +1146,8 @@ components: type: string exposedModule: type: string + deprecated: + type: boolean type: $ref: "#/components/schemas/MicrofrontendType" endpoints: @@ -1204,6 +1195,8 @@ components: type: string operator: type: boolean + undeployed: + type: boolean UpdateMicroserviceRequest: type: object properties: @@ -1219,6 +1212,8 @@ components: type: string type: type: string + undeployed: + type: boolean CreateMicroserviceRequest: required: - productName @@ -1237,6 +1232,8 @@ components: type: string type: type: string + undeployed: + type: boolean MicroservicePageResult: type: object properties: diff --git a/src/test/java/org/tkit/onecx/product/store/bff/rs/MicrofrontendsRestControllerTest.java b/src/test/java/org/tkit/onecx/product/store/bff/rs/MicrofrontendsRestControllerTest.java index 5a3517c..a728a4d 100644 --- a/src/test/java/org/tkit/onecx/product/store/bff/rs/MicrofrontendsRestControllerTest.java +++ b/src/test/java/org/tkit/onecx/product/store/bff/rs/MicrofrontendsRestControllerTest.java @@ -120,92 +120,6 @@ void getMicrofrontend_shouldReturnMicrofrontend() { } - /** - * Scenario: Receives microfrontend (mfe) by app-id successfully. - * Given - * When I query GET endpoint with an existing id - * Then I get a 'OK' response code back - * AND associated mfe is returned - */ - @Test - void getMicrofrontendByAppId_shouldReturnMicrofrontend() { - - OffsetDateTime offsetDateTime = OffsetDateTime.parse("2023-11-30T13:53:03.688710200+01:00"); - OffsetDateTimeMapper mapper = new OffsetDateTimeMapper(); - Set classificationSet = new HashSet<>(); - classificationSet.add("some"); - classificationSet.add("another"); - List uiEndpointSet = new ArrayList<>(); - UIEndpoint uiEndpointItem = new UIEndpoint(); - uiEndpointItem.setName("Search"); - uiEndpointItem.setPath("/search"); - uiEndpointSet.add(uiEndpointItem); - - Microfrontend data = createMicrofrontend("7a0ee705-8fd0-47b0-8205-b2a5f6540b9e", offsetDateTime, "csommer", - offsetDateTime, "csommer", 1, false, "App-ID", "1.0.0", - "AppName", "some description", "", "https://localhost/mfe/core/ah-mgmt/", - "https://localhost/mfe/core/ah-mgmt/remoteEntry.js", "ProductName", classificationSet, - "developers@1000kit.org", "sun", "some notes", "/AnnouncementManagementModule", uiEndpointSet); - - // create mock rest endpoint - mockServerClient - .when(request().withPath(PRODUCT_STORE_SVC_INTERNAL_API_BASE_PATH + "/appId/" + data.getAppId()) - .withMethod(HttpMethod.GET)) - .respond(httpRequest -> response().withStatusCode(Response.Status.OK.getStatusCode()) - .withContentType(MediaType.APPLICATION_JSON) - .withBody(JsonBody.json(data))); - - var response = given() - .when() - .auth().oauth2(keycloakClient.getAccessToken(ADMIN)) - .header(APM_HEADER_PARAM, ADMIN) - .contentType(APPLICATION_JSON) - .get("appId/" + data.getAppId()) - .then() - .statusCode(Response.Status.OK.getStatusCode()) - .contentType(APPLICATION_JSON) - .extract().as(MicrofrontendDTO.class); - - Assertions.assertEquals(data.getId(), response.getId()); - Assertions.assertEquals(data.getCreationUser(), response.getCreationUser()); - Assertions.assertEquals(mapper.map(data.getCreationDate()), mapper.map(response.getCreationDate())); - Assertions.assertEquals(mapper.map(data.getModificationDate()), mapper.map(response.getModificationDate())); - Assertions.assertEquals(data.getModificationUser(), response.getModificationUser()); - Assertions.assertEquals(data.getModificationCount(), response.getModificationCount()); - Assertions.assertEquals(data.getOperator(), response.getOperator()); - Assertions.assertEquals(data.getAppId(), response.getAppId()); - Assertions.assertEquals(data.getAppVersion(), response.getAppVersion()); - Assertions.assertEquals(data.getAppName(), response.getAppName()); - Assertions.assertEquals(data.getDescription(), response.getDescription()); - Assertions.assertEquals(data.getRemoteBaseUrl(), response.getRemoteBaseUrl()); - Assertions.assertEquals(data.getRemoteEntry(), response.getRemoteEntry()); - Assertions.assertEquals(data.getProductName(), response.getProductName()); - - Assertions.assertEquals(data.getContact(), response.getContact()); - Assertions.assertEquals(data.getIconName(), response.getIconName()); - Assertions.assertEquals(data.getNote(), response.getNote()); - Assertions.assertEquals(data.getExposedModule(), response.getExposedModule()); - Assertions.assertEquals(data.getEndpoints().size(), response.getEndpoints().size()); - Assertions.assertEquals(data.getEndpoints().get(0).getName(), response.getEndpoints().get(0).getName()); - Assertions.assertEquals(data.getEndpoints().get(0).getPath(), response.getEndpoints().get(0).getPath()); - - // create mock rest endpoint - mockServerClient - .when(request().withPath(PRODUCT_STORE_SVC_INTERNAL_API_BASE_PATH + "/appId/not-existing") - .withMethod(HttpMethod.GET)) - .respond(httpRequest -> response().withStatusCode(Response.Status.NOT_FOUND.getStatusCode())); - - //expect not found for non-existing appId - given() - .when() - .auth().oauth2(keycloakClient.getAccessToken(ADMIN)) - .header(APM_HEADER_PARAM, ADMIN) - .contentType(APPLICATION_JSON) - .get("/appId/not-existing") - .then() - .statusCode(Response.Status.NOT_FOUND.getStatusCode()); - } - /** * Scenario: Receive 404 Not Found when microfrontend (mfe) is not existing in backend service. * Given