Skip to content

Commit

Permalink
feat: refactoring, migration org.tkit
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras committed Feb 2, 2024
1 parent 943740c commit 27d3907
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 235 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ jobs:
uses: onecx/ci-quarkus/.github/workflows/build.yml@v1
secrets: inherit
with:
helmEventTargetRepository: onecx/onecx-theme
helmEventTargetRepository: onecx/onecx-help

9 changes: 9 additions & 0 deletions .github/workflows/create-new-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Create new build

on:
workflow_dispatch:

jobs:
build:
uses: onecx/ci-common/.github/workflows/create-new-build.yml@v1
secrets: inherit
26 changes: 17 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.github.onecx</groupId>
<groupId>org.tkit.onecx</groupId>
<artifactId>onecx-quarkus3-parent</artifactId>
<version>0.25.0</version>
<version>0.31.0</version>
</parent>

<artifactId>onecx-help-bff</artifactId>
Expand All @@ -25,10 +25,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.openapi.generator</groupId>
<artifactId>quarkus-openapi-generator</artifactId>
Expand Down Expand Up @@ -56,7 +52,7 @@
</dependency>
<dependency>
<groupId>org.tkit.quarkus.lib</groupId>
<artifactId>tkit-quarkus-jpa</artifactId>
<artifactId>tkit-quarkus-rest-context</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
Expand All @@ -78,6 +74,18 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc-client-reactive-filter</artifactId>
</dependency>
<!-- DEV -->
<dependency>
<groupId>io.quarkiverse.mockserver</groupId>
Expand Down Expand Up @@ -117,8 +125,8 @@
</goals>
<configuration>
<inputSpec>src/main/openapi/openapi-help-bff.yaml</inputSpec>
<apiPackage>gen.io.github.onecx.help.bff.rs.internal</apiPackage>
<modelPackage>gen.io.github.onecx.help.bff.rs.internal.model</modelPackage>
<apiPackage>gen.org.tkit.onecx.help.bff.rs.internal</apiPackage>
<modelPackage>gen.org.tkit.onecx.help.bff.rs.internal.model</modelPackage>
</configuration>
</execution>
</executions>
Expand Down
6 changes: 3 additions & 3 deletions src/main/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v2
name: onecx-helm-bff
name: onecx-help-bff
version: 0.0.0
appVersion: 0.0.0
description: Onecx helm bff
description: Onecx help bff
keywords:
- iam
- parameters
sources:
- https://github.com/onecx/onecx-helm-bff
- https://github.com/onecx/onecx-help-bff
maintainers:
- name: Tkit Developer
email: [email protected]
Expand Down
6 changes: 2 additions & 4 deletions src/main/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
app:
name: bff
image:
repository: "onecx/onecx-announcement-bff"
tag: 999-SNAPSHOT
db:
enabled: true
repository: "onecx/onecx-help-bff"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.onecx.help.bff.rs.controller;
package org.tkit.onecx.help.bff.rs.controller;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
Expand All @@ -10,18 +10,18 @@
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.jboss.resteasy.reactive.RestResponse;
import org.jboss.resteasy.reactive.server.ServerExceptionMapper;
import org.tkit.onecx.help.bff.rs.mappers.ExceptionMapper;
import org.tkit.onecx.help.bff.rs.mappers.HelpMapper;
import org.tkit.onecx.help.bff.rs.mappers.ProblemDetailMapper;
import org.tkit.quarkus.log.cdi.LogService;

import gen.io.github.onecx.help.bff.clients.api.HelpsInternalApi;
import gen.io.github.onecx.help.bff.clients.model.Help;
import gen.io.github.onecx.help.bff.clients.model.HelpAppIds;
import gen.io.github.onecx.help.bff.clients.model.HelpPageResult;
import gen.io.github.onecx.help.bff.clients.model.ProblemDetailResponse;
import gen.io.github.onecx.help.bff.rs.internal.HelpsInternalApiService;
import gen.io.github.onecx.help.bff.rs.internal.model.*;
import io.github.onecx.help.bff.rs.mappers.ExceptionMapper;
import io.github.onecx.help.bff.rs.mappers.HelpMapper;
import io.github.onecx.help.bff.rs.mappers.ProblemDetailMapper;
import gen.org.tkit.onecx.help.bff.clients.api.HelpsInternalApi;
import gen.org.tkit.onecx.help.bff.clients.model.Help;
import gen.org.tkit.onecx.help.bff.clients.model.HelpAppIds;
import gen.org.tkit.onecx.help.bff.clients.model.HelpPageResult;
import gen.org.tkit.onecx.help.bff.clients.model.ProblemDetailResponse;
import gen.org.tkit.onecx.help.bff.rs.internal.HelpsInternalApiService;
import gen.org.tkit.onecx.help.bff.rs.internal.model.*;

@ApplicationScoped
@Transactional(value = Transactional.TxType.NOT_SUPPORTED)
Expand Down Expand Up @@ -78,24 +78,6 @@ public Response getHelpById(String id) {
}
}

@Override
public Response getHelpByItemId(String itemId) {
try (Response response = client.getHelpByItemId(itemId)) {
Help help = response.readEntity(Help.class);
HelpDTO helpDTO = helpMapper.mapHelp(help);
return Response.status(response.getStatus()).entity(helpDTO).build();
}
}

@Override
public Response getHelps(Integer pageNumber, Integer pageSize) {
try (Response response = client.getHelps(pageNumber, pageSize)) {
HelpPageResult helpPageResult = response.readEntity(HelpPageResult.class);
HelpPageResultDTO helpPageResultDTO = helpMapper.mapHelpPageResults(helpPageResult);
return Response.status(response.getStatus()).entity(helpPageResultDTO).build();
}
}

@Override
public Response searchHelps(HelpSearchCriteriaDTO helpSearchCriteriaDTO) {

Expand All @@ -118,13 +100,11 @@ public Response updateHelp(String id, UpdateHelpDTO updateHelpDTO) {

@ServerExceptionMapper
public RestResponse<ProblemDetailResponseDTO> constraint(ConstraintViolationException ex) {

return exceptionMapper.constraint(ex);
}

@ServerExceptionMapper
public Response restException(WebApplicationException ex) {

return Response.status(ex.getResponse().getStatus()).build();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.onecx.help.bff.rs.mappers;
package org.tkit.onecx.help.bff.rs.mappers;

import java.util.List;
import java.util.Map;
Expand All @@ -14,9 +14,9 @@
import org.mapstruct.Mapping;
import org.tkit.quarkus.rs.mappers.OffsetDateTimeMapper;

import gen.io.github.onecx.help.bff.rs.internal.model.ProblemDetailInvalidParamDTO;
import gen.io.github.onecx.help.bff.rs.internal.model.ProblemDetailParamDTO;
import gen.io.github.onecx.help.bff.rs.internal.model.ProblemDetailResponseDTO;
import gen.org.tkit.onecx.help.bff.rs.internal.model.ProblemDetailInvalidParamDTO;
import gen.org.tkit.onecx.help.bff.rs.internal.model.ProblemDetailParamDTO;
import gen.org.tkit.onecx.help.bff.rs.internal.model.ProblemDetailResponseDTO;

@Mapper(uses = { OffsetDateTimeMapper.class })
public interface ExceptionMapper {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.github.onecx.help.bff.rs.mappers;
package org.tkit.onecx.help.bff.rs.mappers;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.tkit.quarkus.rs.mappers.OffsetDateTimeMapper;

import gen.io.github.onecx.help.bff.clients.model.*;
import gen.io.github.onecx.help.bff.rs.internal.model.*;
import gen.org.tkit.onecx.help.bff.clients.model.*;
import gen.org.tkit.onecx.help.bff.rs.internal.model.*;

@Mapper(uses = { OffsetDateTimeMapper.class })
public interface HelpMapper {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.github.onecx.help.bff.rs.mappers;
package org.tkit.onecx.help.bff.rs.mappers;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.tkit.quarkus.rs.mappers.OffsetDateTimeMapper;

import gen.io.github.onecx.help.bff.clients.model.ProblemDetailResponse;
import gen.io.github.onecx.help.bff.rs.internal.model.ProblemDetailResponseDTO;
import gen.org.tkit.onecx.help.bff.clients.model.ProblemDetailResponse;
import gen.org.tkit.onecx.help.bff.rs.internal.model.ProblemDetailResponseDTO;

@Mapper(uses = { OffsetDateTimeMapper.class })
public interface ProblemDetailMapper {
Expand Down
76 changes: 4 additions & 72 deletions src/main/openapi/openapi-help-bff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,6 @@ tags:
- name: helpsInternal
paths:
/helps:
get:
tags:
- helpsInternal
description: Return list of helps
operationId: getHelps
parameters:
- name: pageNumber
in: query
schema:
format: int32
description: The number of page.
default: 0
type: integer
- name: pageSize
in: query
schema:
format: int32
description: The size of page
default: 10
type: integer
responses:
"200":
description: OK
content:
application/json:
schema:
items:
$ref: '#/components/schemas/HelpPageResult'
post:
tags:
- helpsInternal
Expand Down Expand Up @@ -162,27 +134,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/HelpPageResult'
/helps/itemId/{itemId}:
get:
tags:
- helpsInternal
description: Load a single help definition
operationId: getHelpByItemId
parameters:
- name: itemId
in: path
required: true
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Help'
"404":
description: Not found
components:
schemas:
HelpSearchCriteria:
Expand Down Expand Up @@ -233,7 +184,7 @@ components:
- itemId
type: object
properties:
version:
modificationCount:
format: int32
type: integer
creationDate:
Expand Down Expand Up @@ -294,19 +245,6 @@ components:
- itemId
type: object
properties:
version:
format: int32
type: integer
creationDate:
$ref: '#/components/schemas/OffsetDateTime'
creationUser:
type: string
modificationDate:
$ref: '#/components/schemas/OffsetDateTime'
modificationUser:
type: string
id:
type: string
itemId:
type: string
context:
Expand All @@ -320,19 +258,13 @@ components:
UpdateHelp:
required:
- name
- itemId
- modificationCount
type: object
properties:
version:
modificationCount:
format: int32
type: integer
creationDate:
$ref: '#/components/schemas/OffsetDateTime'
creationUser:
type: string
modificationDate:
$ref: '#/components/schemas/OffsetDateTime'
modificationUser:
type: string
id:
type: string
itemId:
Expand Down
20 changes: 17 additions & 3 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
# PROD
%prod.quarkus.rest-client.onecx_help_svc.url=http://onecx-help-svc:8080

# propagate the apm-principal-token from requests we receive
org.eclipse.microprofile.rest.client.propagateHeaders=apm-principal-token

# OIDC
quarkus.oidc.enabled=false
#quarkus.rest-client.onecx_help_svc_yaml.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
#quarkus.oidc-client.client-id=${quarkus.application.name}
#quarkus.oidc-client.credentials.secret=
#quarkus.oidc-client.auth-server-url=${quarkus.oidc.auth-server-url}

# DEV
%dev.quarkus.rest-client.onecx_help_svc.url=http://onecx-help-svc

# BUILD
quarkus.openapi-generator.codegen.spec.onecx_help_svc_yaml.config-key=onecx_help_svc
quarkus.openapi-generator.codegen.spec.onecx_help_svc_yaml.base-package=gen.io.github.onecx.help.bff.clients
quarkus.openapi-generator.codegen.spec.onecx_help_svc_yaml.base-package=gen.org.tkit.onecx.help.bff.clients
quarkus.openapi-generator.codegen.spec.onecx_help_svc_yaml.return-response=true
quarkus.openapi-generator.codegen.input-base-dir=target/tmp/openapi
quarkus.openapi-generator.codegen.spec.onecx_help_svc_yaml.additional-api-type-annotations=@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;


# INTEGRATION TEST
quarkus.test.integration-test-profile=test

# TEST
%test.quarkus.http.test-port=0
%test.tkit.log.json.enabled=false
%test.quarkus.mockserver.devservices.config-class-path=true
%test.quarkus.mockserver.devservices.log=false
%test.quarkus.mockserver.devservices.reuse=true
%test.quarkus.mockserver.devservices.config-file=/mockserver.properties
%test.quarkus.mockserver.devservices.config-dir=/mockserver
%test.quarkus.rest-client.onecx_help_svc.url=${quarkus.mockserver.endpoint}

# PIPE CONFIG
# PIPE CONFIG



Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.onecx.help.bff.rs;
package org.tkit.onecx.help.bff.rs;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
Expand Down
Loading

0 comments on commit 27d3907

Please sign in to comment.