Skip to content

Commit

Permalink
feat: remove get all products by workspace name (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras authored Apr 24, 2024
1 parent a2884cc commit 6442686
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ h| Version
| https://github.com/quarkiverse/quarkus-openapi-generator/blob/2.4.1/docs/modules/ROOT/pages/includes/quarkus-openapi-generator.adoc[Link]
| 2.4.1
| quarkus-rest-client-reactive-jackson
| quarkus-rest-client-jackson
| https://quarkus.io/guides/rest-client[Link]
|
Expand Down Expand Up @@ -98,12 +98,6 @@ h| Version
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-oidc.adoc[Link]
| 3.9.3
| quarkus-oidc-client-reactive-filter
| https://quarkus.io/guides/security-openid-connect-client-reference[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-oidc-client-reactive-filter.adoc[Link]
| 3.9.3
| onecx-core
| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-core.html[Link]
Expand All @@ -123,6 +117,20 @@ h| Version
| 3.9.3
| quarkus-rest-client-oidc-filter
|
|
| 3.9.3
|===ntainer-image-docker
| https://quarkus.io/guides/container-image[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-container-image-docker.adoc[Link]
| 3.9.3
|===us-container-image-docker.adoc[Link]
| 3.9.3
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-reactive-jackson</artifactId>
<artifactId>quarkus-rest-client-jackson</artifactId>
</dependency>

<dependency>
Expand Down Expand Up @@ -80,7 +80,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc-client-reactive-filter</artifactId>
<artifactId>quarkus-rest-client-oidc-filter</artifactId>
</dependency>
<!-- DEV -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ public class WorkspaceRestController implements WorkspaceApiService {
@Inject
ExceptionMapper exceptionMapper;

@Override
public Response getAllProductsByWorkspaceName(String workspaceName) {
try (Response response = workspaceClient.loadWorkspaceByName(workspaceName)) {
return Response.status(response.getStatus()).entity(mapper.map(response.readEntity(WorkspaceLoad.class))).build();
}
}

@Override
public Response searchWorkspaces(WorkspaceSearchCriteriaDTO criteriaDTO) {
try (Response response = workspaceClient.searchWorkspaces(mapper.map(criteriaDTO))) {
Expand Down
25 changes: 0 additions & 25 deletions src/main/openapi/openapi-bff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -534,31 +534,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/WorkspacePageResult'
/workspaces/{workspaceName}/products:
get:
x-onecx:
permissions:
workspace:
- read
tags:
- workspace
description: get all products by workspace name
operationId: getAllProductsByWorkspaceName
parameters:
- name: workspaceName
in: path
required: true
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Product'
/workspaces/{workspaceName}/details:
get:
x-onecx:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static org.mockserver.model.HttpResponse.response;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

Expand All @@ -27,7 +26,6 @@
import io.quarkiverse.mockserver.test.InjectMockServerClient;
import io.quarkus.test.common.http.TestHTTPEndpoint;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.common.mapper.TypeRef;

@QuarkusTest
@TestHTTPEndpoint(WorkspaceRestController.class)
Expand Down Expand Up @@ -110,43 +108,6 @@ void searchWorkspaces_Internal_Server_Error_Test() {
.statusCode(Response.Status.BAD_REQUEST.getStatusCode());
}

@Test
void getAllProductsByWorkspaceNameTest() {
String workspaceName = "workspace1";

Product product1 = new Product();
product1.productName("product1");
Product product2 = new Product();
product2.productName("product2");

ArrayList<Product> products = new ArrayList<>();
products.add(product1);
products.add(product2);
WorkspaceLoad load = new WorkspaceLoad();
load.setProducts(products);

// create mock rest endpoint
mockServerClient
.when(request().withPath("/v1/workspaces/" + workspaceName + "/load").withMethod(HttpMethod.GET))
.withId(MOCKID)
.respond(httpRequest -> response().withStatusCode(Response.Status.OK.getStatusCode())
.withBody(JsonBody.json(load)));

var output = given()
.when()
.auth().oauth2(keycloakClient.getAccessToken(ADMIN))
.header(APM_HEADER_PARAM, ADMIN)
.pathParam("workspaceName", workspaceName)
.get("/{workspaceName}/products")
.then()
.statusCode(Response.Status.OK.getStatusCode())
.extract().as(new TypeRef<ProductDTO[]>() {
});

Assertions.assertNotNull(output);
Assertions.assertEquals(2, Arrays.stream(output).toList().size());
}

@Test
void getDetailsByWorkspaceNameTest() {

Expand Down

0 comments on commit 6442686

Please sign in to comment.