From b2ea437b280096248ae5e8e03305cb4ffea83209 Mon Sep 17 00:00:00 2001
From: JordenReuter <149687553+JordenReuter@users.noreply.github.com>
Date: Mon, 14 Oct 2024 08:29:04 +0200
Subject: [PATCH] feat: extended api with appearance field (#50)
* feat: extended api with appearance field
* feat: removed announcement api
---
.../pages/onecx-welcome-bff-docs.adoc | 54 ++++++--
.../pages/onecx-welcome-bff-extensions.adoc | 62 ++++-----
pom.xml | 16 ---
src/main/helm/values.yaml | 2 -
.../AnnouncementsRestController.java | 49 --------
.../bff/rs/mappers/AnnouncementMapper.java | 18 ---
src/main/openapi/openapi-bff.yaml | 119 ------------------
src/main/resources/application.properties | 13 --
.../bff/rs/AnnouncementsRestControllerIT.java | 7 --
.../rs/AnnouncementsRestControllerTest.java | 108 ----------------
.../resources/mockserver/permissions.json | 2 -
11 files changed, 76 insertions(+), 374 deletions(-)
delete mode 100644 src/main/java/org/tkit/onecx/welcome/bff/rs/controllers/AnnouncementsRestController.java
delete mode 100644 src/main/java/org/tkit/onecx/welcome/bff/rs/mappers/AnnouncementMapper.java
delete mode 100644 src/test/java/org/tkit/onecx/welcome/bff/rs/AnnouncementsRestControllerIT.java
delete mode 100644 src/test/java/org/tkit/onecx/welcome/bff/rs/AnnouncementsRestControllerTest.java
diff --git a/docs/modules/onecx-welcome-bff/pages/onecx-welcome-bff-docs.adoc b/docs/modules/onecx-welcome-bff/pages/onecx-welcome-bff-docs.adoc
index 6d3a24f..c28e45f 100644
--- a/docs/modules/onecx-welcome-bff/pages/onecx-welcome-bff-docs.adoc
+++ b/docs/modules/onecx-welcome-bff/pages/onecx-welcome-bff-docs.adoc
@@ -22,7 +22,6 @@ quarkus.http.filter.imageInfo.order=11
quarkus.http.filter.imageInfo.header."Cache-Control"=none
quarkus.http.filter.imageInfo.matches=/info*
%prod.quarkus.rest-client.onecx_welcome_internal.url=http://onecx-welcome-svc:8080
-%prod.quarkus.rest-client.onecx_announcement_v1.url=http://onecx-announcement-svc:8080
quarkus.openapi-generator.codegen.spec.onecx_welcome_internal_yaml.config-key=onecx_welcome_internal
quarkus.openapi-generator.codegen.spec.onecx_welcome_internal_yaml.base-package=gen.org.tkit.onecx.welcome.client
quarkus.openapi-generator.codegen.spec.onecx_welcome_internal_yaml.return-response=true
@@ -30,15 +29,52 @@ quarkus.openapi-generator.codegen.spec.onecx_welcome_internal_yaml.additional-ap
quarkus.openapi-generator.codegen.spec.onecx_welcome_internal_yaml.type-mappings.File=byte[]
quarkus.openapi-generator.codegen.spec.onecx_welcome_internal_yaml.additional-model-type-annotations=@io.quarkus.runtime.annotations.RegisterForReflection;
quarkus.openapi-generator.codegen.spec.onecx_welcome_internal_yaml.enable-security-generation=false
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.config-key=onecx_announcement_v1
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.base-package=gen.org.tkit.onecx.announcement.client
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.return-response=true
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.additional-api-type-annotations=@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.additional-model-type-annotations=@io.quarkus.runtime.annotations.RegisterForReflection;
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.model-name-suffix=V1
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.enable-security-generation=false
-quarkus.openapi-generator.codegen.input-base-dir=target/tmp/openapi
%prod.quarkus.rest-client.onecx_welcome_internal.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
+%prod.quarkus.oidc-client.client-id=${quarkus.application.name}
+----
+====
+
+=== Extensions
+
+include::onecx-welcome-bff-extensions.adoc[opts=optional]
+
+=== Container
+
+{docker-registry}[Docker registry]
+
+
+=== Helm
+
+{helm-registry}[Helm registry]
+
+Default values
+
+.{helm-file}
+[source,yaml]
+----
+app:
+ name: bff
+ image:
+ repository: "onecx/onecx-welcome-bff"
+ operator:
+ # Permission
+ permission:
+ enabled: true
+ spec:
+ permissions:
+ image:
+ read: permission on all GET requests and POST search
+ write: permission on PUT, POST, PATCH requests, where objects are saved or updated
+ delete: permission on all DELETE requests
+ keycloak:
+ client:
+ enabled: true
+ spec:
+ kcConfig:
+ defaultClientScopes: [ ocx-wc:all, ocx-pm:read, ocx-an:read ]
+----
+
+.rest-client.onecx_welcome_internal.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
%prod.quarkus.rest-client.onecx_announcement_v1.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
%prod.quarkus.oidc-client.client-id=${quarkus.application.name}
----
diff --git a/docs/modules/onecx-welcome-bff/pages/onecx-welcome-bff-extensions.adoc b/docs/modules/onecx-welcome-bff/pages/onecx-welcome-bff-extensions.adoc
index 692eb4f..0a48710 100644
--- a/docs/modules/onecx-welcome-bff/pages/onecx-welcome-bff-extensions.adoc
+++ b/docs/modules/onecx-welcome-bff/pages/onecx-welcome-bff-extensions.adoc
@@ -12,133 +12,133 @@ h| Version
| https://quarkus.io/guides/rest[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-rest.adoc[Link]
-| 3.12.2
+| 3.15.1
| quarkus-smallrye-openapi
| https://quarkus.io/guides/openapi-swaggerui[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-smallrye-openapi.adoc[Link]
-| 3.12.2
+| 3.15.1
| quarkus-rest-jackson
| https://quarkus.io/guides/rest-json[Link]
|
-| 3.12.2
+| 3.15.1
| quarkus-smallrye-health
| https://quarkus.io/guides/smallrye-health[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-smallrye-health.adoc[Link]
-| 3.12.2
+| 3.15.1
| quarkus-opentelemetry
| https://quarkus.io/guides/opentelemetry[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-opentelemetry.adoc[Link]
-| 3.12.2
+| 3.15.1
| quarkus-micrometer-registry-prometheus
| https://quarkus.io/guides/telemetry-micrometer[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-micrometer-registry-prometheus.adoc[Link]
-| 3.12.2
+| 3.15.1
| quarkus-openapi-generator
| https://docs.quarkiverse.io/quarkus-openapi-generator/dev/index.html[Link]
-| https://github.com/quarkiverse/quarkus-openapi-generator/blob/2.4.2/docs/modules/ROOT/pages/includes/quarkus-openapi-generator.adoc[Link]
-| 2.4.2
+| https://github.com/quarkiverse/quarkus-openapi-generator/blob/2.4.7/docs/modules/ROOT/pages/includes/quarkus-openapi-generator.adoc[Link]
+| 2.4.7
| quarkus-rest-client-reactive-jackson
| https://quarkus.io/guides/rest-client[Link]
|
-| 3.12.2
+| 3.15.1
| tkit-quarkus-log-cdi
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-cdi.html[Link]
-| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
-| 2.28.0
+| https://github.com/1000kit/tkit-quarkus/blob/2.33.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
+| 2.33.0
| tkit-quarkus-log-rs
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-rs.html[Link]
-| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
-| 2.28.0
+| https://github.com/1000kit/tkit-quarkus/blob/2.33.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
+| 2.33.0
| tkit-quarkus-log-json
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-json.html[Link]
-| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
-| 2.28.0
+| https://github.com/1000kit/tkit-quarkus/blob/2.33.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
+| 2.33.0
| tkit-quarkus-rest
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-rest.html[Link]
-| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
-| 2.28.0
+| https://github.com/1000kit/tkit-quarkus/blob/2.33.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
+| 2.33.0
| tkit-quarkus-rest-context
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-rest-context.html[Link]
-| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
-| 2.28.0
+| https://github.com/1000kit/tkit-quarkus/blob/2.33.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
+| 2.33.0
| tkit-quarkus-jpa
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-jpa.html[Link]
-| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa.adoc[Link]
-| 2.28.0
+| https://github.com/1000kit/tkit-quarkus/blob/2.33.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa.adoc[Link]
+| 2.33.0
| quarkus-hibernate-validator
| https://quarkus.io/guides/validation[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-hibernate-validator.adoc[Link]
-| 3.12.2
+| 3.15.1
| onecx-permissions
| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-permissions.html[Link]
-| https://github.com/onecx/onecx-quarkus/blob/0.24.0/docs/modules/onecx-quarkus/pages/includes/onecx-permissions.adoc[Link]
-| 0.24.0
+| https://github.com/onecx/onecx-quarkus/blob/0.31.0/docs/modules/onecx-quarkus/pages/includes/onecx-permissions.adoc[Link]
+| 0.31.0
| quarkus-oidc
| https://quarkus.io/guides/security-oidc-bearer-token-authentication-tutorial[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-oidc.adoc[Link]
-| 3.12.2
+| 3.15.1
| 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.12.2
+| 3.15.1
| tkit-quarkus-security
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-security.html[Link]
-| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
-| 2.28.0
+| https://github.com/1000kit/tkit-quarkus/blob/2.33.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
+| 2.33.0
| onecx-core
| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-core.html[Link]
|
-| 0.24.0
+| 0.31.0
| quarkus-arc
| https://quarkus.io/guides/cdi-reference[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-arc.adoc[Link]
-| 3.12.2
+| 3.15.1
| quarkus-container-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.12.2
+| 3.15.1
diff --git a/pom.xml b/pom.xml
index 63abb31..3511faa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -191,22 +191,6 @@
true
-
- announcement-svc-v1
- generate-resources
-
- wget
-
-
-
- https://raw.githubusercontent.com/onecx/onecx-announcement-svc/main/src/main/openapi/announcement-openapi-v1.yaml
-
- target/tmp/openapi
- onecx-announcement-v1.yaml
- true
-
-
-
diff --git a/src/main/helm/values.yaml b/src/main/helm/values.yaml
index 43b9f40..3375e50 100644
--- a/src/main/helm/values.yaml
+++ b/src/main/helm/values.yaml
@@ -12,8 +12,6 @@ app:
read: permission on all GET requests and POST search
write: permission on PUT, POST, PATCH requests, where objects are saved or updated
delete: permission on all DELETE requests
- announcement:
- read: permission on all GET requests and POST search
keycloak:
client:
enabled: true
diff --git a/src/main/java/org/tkit/onecx/welcome/bff/rs/controllers/AnnouncementsRestController.java b/src/main/java/org/tkit/onecx/welcome/bff/rs/controllers/AnnouncementsRestController.java
deleted file mode 100644
index 865068b..0000000
--- a/src/main/java/org/tkit/onecx/welcome/bff/rs/controllers/AnnouncementsRestController.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.tkit.onecx.welcome.bff.rs.controllers;
-
-import jakarta.inject.Inject;
-import jakarta.validation.ConstraintViolationException;
-import jakarta.ws.rs.core.Response;
-
-import org.eclipse.microprofile.rest.client.inject.RestClient;
-import org.jboss.resteasy.reactive.ClientWebApplicationException;
-import org.jboss.resteasy.reactive.RestResponse;
-import org.jboss.resteasy.reactive.server.ServerExceptionMapper;
-import org.tkit.onecx.welcome.bff.rs.mappers.AnnouncementMapper;
-import org.tkit.onecx.welcome.bff.rs.mappers.ExceptionMapper;
-
-import gen.org.tkit.onecx.announcement.client.api.AnnouncementApi;
-import gen.org.tkit.onecx.announcement.client.model.AnnouncementPageResultV1;
-import gen.org.tkit.onecx.welcome.bff.rs.internal.AnnouncementsApiService;
-import gen.org.tkit.onecx.welcome.bff.rs.internal.model.AnnouncementSearchCriteriaDTO;
-import gen.org.tkit.onecx.welcome.bff.rs.internal.model.ProblemDetailResponseDTO;
-
-public class AnnouncementsRestController implements AnnouncementsApiService {
-
- @Inject
- @RestClient
- AnnouncementApi announcementClient;
-
- @Inject
- AnnouncementMapper mapper;
-
- @Inject
- ExceptionMapper exceptionMapper;
-
- @Override
- public Response searchAnnouncementsByCriteria(AnnouncementSearchCriteriaDTO announcementSearchCriteriaDTO) {
- try (Response response = announcementClient.getAnnouncementsByCriteria(mapper.map(announcementSearchCriteriaDTO))) {
- return Response.status(response.getStatus()).entity(mapper.map(response.readEntity(AnnouncementPageResultV1.class)))
- .build();
- }
- }
-
- @ServerExceptionMapper
- public RestResponse constraint(ConstraintViolationException ex) {
- return exceptionMapper.constraint(ex);
- }
-
- @ServerExceptionMapper
- public Response restException(ClientWebApplicationException ex) {
- return exceptionMapper.clientException(ex);
- }
-}
diff --git a/src/main/java/org/tkit/onecx/welcome/bff/rs/mappers/AnnouncementMapper.java b/src/main/java/org/tkit/onecx/welcome/bff/rs/mappers/AnnouncementMapper.java
deleted file mode 100644
index 78c236b..0000000
--- a/src/main/java/org/tkit/onecx/welcome/bff/rs/mappers/AnnouncementMapper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.tkit.onecx.welcome.bff.rs.mappers;
-
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.tkit.quarkus.rs.mappers.OffsetDateTimeMapper;
-
-import gen.org.tkit.onecx.announcement.client.model.AnnouncementPageResultV1;
-import gen.org.tkit.onecx.announcement.client.model.AnnouncementSearchCriteriaV1;
-import gen.org.tkit.onecx.welcome.bff.rs.internal.model.AnnouncementPageResultDTO;
-import gen.org.tkit.onecx.welcome.bff.rs.internal.model.AnnouncementSearchCriteriaDTO;
-
-@Mapper(uses = { OffsetDateTimeMapper.class })
-public interface AnnouncementMapper {
- AnnouncementSearchCriteriaV1 map(AnnouncementSearchCriteriaDTO announcementSearchCriteriaDTO);
-
- @Mapping(target = "removeStreamItem", ignore = true)
- AnnouncementPageResultDTO map(AnnouncementPageResultV1 announcementPageResultV1);
-}
diff --git a/src/main/openapi/openapi-bff.yaml b/src/main/openapi/openapi-bff.yaml
index d2f3b01..96a6215 100644
--- a/src/main/openapi/openapi-bff.yaml
+++ b/src/main/openapi/openapi-bff.yaml
@@ -13,7 +13,6 @@ servers:
- url: "http://onecx-welcome-bff:8080"
tags:
- name: imagesInternal
- - name: announcements
paths:
/images/info/{id}:
get:
@@ -241,35 +240,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetailResponse'
- /announcements/search:
- post:
- x-onecx:
- permissions:
- announcement:
- - read
- tags:
- - announcements
- description: search announcements by criteria
- operationId: searchAnnouncementsByCriteria
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/AnnouncementSearchCriteria'
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/AnnouncementPageResult'
- "400":
- description: BAD REQUEST
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ProblemDetailResponse'
components:
schemas:
ImageDataResponse:
@@ -330,95 +300,6 @@ components:
type: array
items:
$ref: '#/components/schemas/ImageInfo'
- Announcement:
- type: object
- properties:
- title:
- type: string
- content:
- type: string
- type:
- $ref: '#/components/schemas/Type'
- priority:
- $ref: '#/components/schemas/Priority'
- status:
- $ref: '#/components/schemas/Status'
- startDate:
- $ref: '#/components/schemas/OffsetDateTime'
- endDate:
- $ref: '#/components/schemas/OffsetDateTime'
- productName:
- type: string
- AnnouncementPageResult:
- description: PageResult for Announcements
- type: object
- properties:
- totalElements:
- format: int64
- type: integer
- number:
- format: int32
- type: integer
- size:
- format: int32
- type: integer
- totalPages:
- format: int64
- type: integer
- stream:
- type: array
- items:
- $ref: '#/components/schemas/Announcement'
- AnnouncementSearchCriteria:
- type: object
- properties:
- type:
- $ref: '#/components/schemas/Type'
- priority:
- $ref: '#/components/schemas/Priority'
- status:
- $ref: '#/components/schemas/Status'
- startDateFrom:
- $ref: '#/components/schemas/OffsetDateTime'
- startDateTo:
- $ref: '#/components/schemas/OffsetDateTime'
- endDateFrom:
- $ref: '#/components/schemas/OffsetDateTime'
- endDateTo:
- $ref: '#/components/schemas/OffsetDateTime'
- productName:
- type: string
- title:
- type: string
- workspaceName:
- type: string
- pageNumber:
- format: int32
- description: The number of page.
- default: 0
- type: integer
- pageSize:
- format: int32
- description: The size of page
- default: 100
- type: integer
- Priority:
- enum:
- - IMPORTANT
- - NORMAL
- - LOW
- type: string
- Status:
- enum:
- - ACTIVE
- - INACTIVE
- type: string
- Type:
- enum:
- - EVENT
- - INFO
- - SYSTEM_MAINTENANCE
- type: string
OffsetDateTime:
format: date-time
type: string
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 1e13a33..def4df4 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -21,7 +21,6 @@ quarkus.http.filter.imageInfo.matches=/info*
# PROD
%prod.quarkus.rest-client.onecx_welcome_internal.url=http://onecx-welcome-svc:8080
-%prod.quarkus.rest-client.onecx_announcement_v1.url=http://onecx-announcement-svc:8080
# DEV
%dev.quarkus.rest-client.onecx_welcome_internal.url=http://onecx-welcome-svc
@@ -43,19 +42,8 @@ quarkus.openapi-generator.codegen.spec.onecx_welcome_internal_yaml.type-mappings
quarkus.openapi-generator.codegen.spec.onecx_welcome_internal_yaml.additional-model-type-annotations=@io.quarkus.runtime.annotations.RegisterForReflection;
quarkus.openapi-generator.codegen.spec.onecx_welcome_internal_yaml.enable-security-generation=false
-# announcement-svc v1 client
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.config-key=onecx_announcement_v1
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.base-package=gen.org.tkit.onecx.announcement.client
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.return-response=true
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.additional-api-type-annotations=@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.additional-model-type-annotations=@io.quarkus.runtime.annotations.RegisterForReflection;
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.model-name-suffix=V1
-quarkus.openapi-generator.codegen.spec.onecx_announcement_v1_yaml.enable-security-generation=false
-quarkus.openapi-generator.codegen.input-base-dir=target/tmp/openapi
-
# OIDC
%prod.quarkus.rest-client.onecx_welcome_internal.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
-%prod.quarkus.rest-client.onecx_announcement_v1.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
%prod.quarkus.oidc-client.client-id=${quarkus.application.name}
# INTEGRATION TEST
@@ -70,7 +58,6 @@ quarkus.test.integration-test-profile=test
%test.quarkus.mockserver.devservices.config-file=/mockserver.properties
%test.quarkus.mockserver.devservices.config-dir=/mockserver
%test.quarkus.rest-client.onecx_welcome_internal.url=${quarkus.mockserver.endpoint}
-%test.quarkus.rest-client.onecx_announcement_v1.url=${quarkus.mockserver.endpoint}
%test.tkit.rs.context.token.header-param=apm-principal-token
%test.tkit.rs.context.token.enabled=false
diff --git a/src/test/java/org/tkit/onecx/welcome/bff/rs/AnnouncementsRestControllerIT.java b/src/test/java/org/tkit/onecx/welcome/bff/rs/AnnouncementsRestControllerIT.java
deleted file mode 100644
index 1bead5c..0000000
--- a/src/test/java/org/tkit/onecx/welcome/bff/rs/AnnouncementsRestControllerIT.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.tkit.onecx.welcome.bff.rs;
-
-import io.quarkus.test.junit.QuarkusIntegrationTest;
-
-@QuarkusIntegrationTest
-public class AnnouncementsRestControllerIT extends AnnouncementsRestControllerTest {
-}
diff --git a/src/test/java/org/tkit/onecx/welcome/bff/rs/AnnouncementsRestControllerTest.java b/src/test/java/org/tkit/onecx/welcome/bff/rs/AnnouncementsRestControllerTest.java
deleted file mode 100644
index 3ae84c0..0000000
--- a/src/test/java/org/tkit/onecx/welcome/bff/rs/AnnouncementsRestControllerTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.tkit.onecx.welcome.bff.rs;
-
-import static io.restassured.RestAssured.given;
-import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;
-import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST;
-import static jakarta.ws.rs.core.Response.Status.OK;
-import static org.mockserver.model.HttpRequest.request;
-import static org.mockserver.model.HttpResponse.response;
-
-import java.util.List;
-
-import jakarta.ws.rs.HttpMethod;
-import jakarta.ws.rs.core.Response;
-
-import org.assertj.core.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.mockserver.client.MockServerClient;
-import org.mockserver.model.JsonBody;
-import org.mockserver.model.MediaType;
-import org.tkit.onecx.welcome.bff.rs.controllers.AnnouncementsRestController;
-
-import gen.org.tkit.onecx.announcement.client.model.AnnouncementPageResultV1;
-import gen.org.tkit.onecx.announcement.client.model.AnnouncementSearchCriteriaV1;
-import gen.org.tkit.onecx.announcement.client.model.AnnouncementV1;
-import gen.org.tkit.onecx.welcome.bff.rs.internal.model.AnnouncementPageResultDTO;
-import gen.org.tkit.onecx.welcome.bff.rs.internal.model.AnnouncementSearchCriteriaDTO;
-import io.quarkiverse.mockserver.test.InjectMockServerClient;
-import io.quarkus.test.common.http.TestHTTPEndpoint;
-import io.quarkus.test.junit.QuarkusTest;
-
-@QuarkusTest
-@TestHTTPEndpoint(AnnouncementsRestController.class)
-class AnnouncementsRestControllerTest extends AbstractTest {
-
- @InjectMockServerClient
- MockServerClient mockServerClient;
-
- @Test
- void searchAnnouncementsByEmptyCriteriaTest() {
-
- AnnouncementSearchCriteriaV1 criteriaV1 = new AnnouncementSearchCriteriaV1();
- AnnouncementPageResultV1 response = new AnnouncementPageResultV1();
- response.number(1).size(1).stream(List.of(new AnnouncementV1().title("a1").productName("product1").content("content")));
-
- // create mock rest endpoint
- mockServerClient.when(request().withPath("/v1/applications/announcements/search").withMethod(HttpMethod.POST)
- .withBody(JsonBody.json(criteriaV1))).withId("mock")
- .respond(httpRequest -> response().withStatusCode(Response.Status.OK.getStatusCode())
- .withContentType(MediaType.APPLICATION_JSON)
- .withBody(JsonBody.json(response)));
-
- AnnouncementSearchCriteriaDTO criteriaDTO = new AnnouncementSearchCriteriaDTO();
-
- var data = given()
- .contentType(APPLICATION_JSON)
- .auth().oauth2(keycloakClient.getAccessToken(ADMIN))
- .header(APM_HEADER_PARAM, ADMIN)
- .body(criteriaDTO)
- .post()
- .then()
- .statusCode(OK.getStatusCode())
- .extract().as(AnnouncementPageResultDTO.class);
-
- Assertions.assertThat(data.getStream()).hasSameSizeAs(response.getStream());
- Assertions.assertThat(data.getStream().get(0).getTitle()).isEqualTo(response.getStream().get(0).getTitle());
- Assertions.assertThat(data.getStream().get(0).getProductName()).isEqualTo(response.getStream().get(0).getProductName());
-
- mockServerClient.clear("mock");
- }
-
- @Test
- void searchAnnouncementsByMissingCriteriaTest() {
- given()
- .contentType(APPLICATION_JSON)
- .auth().oauth2(keycloakClient.getAccessToken(ADMIN))
- .header(APM_HEADER_PARAM, ADMIN)
- .post()
- .then()
- .statusCode(BAD_REQUEST.getStatusCode());
- }
-
- @Test
- void searchAnnouncementsByCriteria_Client_Exception_Test() {
-
- AnnouncementSearchCriteriaV1 criteriaV1 = new AnnouncementSearchCriteriaV1();
-
- // create mock rest endpoint
- mockServerClient.when(request().withPath("/v1/applications/announcements/search").withMethod(HttpMethod.POST)
- .withBody(JsonBody.json(criteriaV1)))
- .withId("mock")
- .respond(httpRequest -> response().withStatusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode())
- .withContentType(MediaType.APPLICATION_JSON));
-
- AnnouncementSearchCriteriaDTO criteriaDTO = new AnnouncementSearchCriteriaDTO();
-
- given()
- .contentType(APPLICATION_JSON)
- .auth().oauth2(keycloakClient.getAccessToken(ADMIN))
- .header(APM_HEADER_PARAM, ADMIN)
- .body(criteriaDTO)
- .post()
- .then()
- .statusCode(BAD_REQUEST.getStatusCode());
-
- mockServerClient.clear("mock");
- }
-
-}
diff --git a/src/test/resources/mockserver/permissions.json b/src/test/resources/mockserver/permissions.json
index 80668c0..9901698 100644
--- a/src/test/resources/mockserver/permissions.json
+++ b/src/test/resources/mockserver/permissions.json
@@ -14,7 +14,6 @@
"appId": "onecx-welcome-bff",
"permissions": {
"image": ["read", "write", "delete"],
- "announcement": ["read"],
"permissions": ["admin-write","admin-read"]
}
},
@@ -37,7 +36,6 @@
"appId": "onecx-welcome-bff",
"permissions": {
"image": ["read"],
- "announcement": ["read"],
"permissions": ["admin-write","admin-read"]
}
},