Skip to content

Commit

Permalink
fix: sonar issues (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras authored Jul 19, 2024
1 parent 0472c3d commit f65592c
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 15 deletions.
8 changes: 8 additions & 0 deletions docs/modules/onecx-search-config-svc/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include::onecx-search-config-svc-attributes.adoc[opts=optional]

== onecx-search-config-svc

include::docs.adoc[opts=optional]


include::onecx-search-config-svc-docs.adoc[opts=optional]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

:docker-registry: https://github.com/onecx/onecx-search-config-svc/pkgs/container/onecx-search-config-svc
:helm-registry: https://github.com/onecx/onecx-search-config-svc/pkgs/container/charts%2Fonecx-search-config-svc
:properties-file: src/main/resources/application.properties
:helm-file: src/main/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

include::onecx-search-config-svc-attributes.adoc[opts=optional]

=== Default properties

.{properties-file}
[%collapsible%open]
====
[source,properties,subs=attributes+]
----
quarkus.datasource.db-kind=postgresql
quarkus.datasource.jdbc.max-size=8
quarkus.datasource.jdbc.min-size=2
quarkus.hibernate-orm.database.generation=validate
quarkus.hibernate-orm.multitenant=DISCRIMINATOR
quarkus.hibernate-orm.jdbc.timezone=UTC
quarkus.liquibase.migrate-at-start=true
quarkus.liquibase.validate-on-migrate=true
tkit.rs.context.tenant-id.enabled=true
onecx.permission.token.verified=true
onecx.permission.token.issuer.public-key-location.suffix=/protocol/openid-connect/certs
onecx.permission.token.issuer.public-key-location.enabled=false
onecx.permission.token.claim.path=realm_access/roles
%prod.quarkus.datasource.jdbc.url=${DB_URL:jdbc:postgresql://localhost:5432/onecx-search-config?sslmode=disable}
%prod.quarkus.datasource.username=${DB_USER:onecx-search-config}
%prod.quarkus.datasource.password=${DB_PWD:onecx-search-config}
----
====

=== Extensions

include::onecx-search-config-svc-extensions.adoc[opts=optional]

=== Container

{docker-registry}[Docker registry]


=== Helm

{helm-registry}[Helm registry]

Default values

.{helm-file}
[source,yaml]
----
app:
name: svc
image:
repository: "onecx/onecx-search-config-svc"
db:
enabled: true
operator:
keycloak:
client:
enabled: true
spec:
kcConfig:
defaultClientScopes: [ ocx-tn:read ]
----

Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@

include::onecx-search-config-svc-attributes.adoc[opts=optional]

[.extension.table.searchable, cols="50,.^15,.^15,.^20"]
|===
h| Extensions
h| Documentation
h| Configuration
h| Version

| 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

| 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

| 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

| 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

| 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

| onecx-tenant

| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-tenant.html[Link]
| https://github.com/onecx/onecx-quarkus/blob/0.24.0/docs/modules/onecx-quarkus/pages/includes/onecx-tenant.adoc[Link]
| 0.24.0

| tkit-quarkus-jpa-tenant

| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-jpa-tenant.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa-tenant.adoc[Link]
| 2.28.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

| quarkus-liquibase

| https://quarkus.io/guides/liquibase[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-liquibase.adoc[Link]
| 3.12.2
| 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
| 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
| quarkus-hibernate-orm
| https://quarkus.io/guides/hibernate-orm[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-hibernate-orm.adoc[Link]
| 3.12.2
| quarkus-resteasy-reactive
| https://quarkus.io/guides/resteasy-reactive[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-resteasy-reactive.adoc[Link]
| 3.12.2
| quarkus-resteasy-reactive-jackson
| https://quarkus.io/guides/rest-json[Link]
|
| 3.12.2
| 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
| quarkus-jdbc-postgresql
| https://quarkus.io/guides/datasource[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-jdbc-postgresql.adoc[Link]
| 3.12.2
| 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
| quarkus-smallrye-jwt
| https://quarkus.io/guides/security-jwt-build[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-smallrye-jwt.adoc[Link]
| 3.12.2
| 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
| 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
| 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
| onecx-core
| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-core.html[Link]
|
| 0.24.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
| 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
|===
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static org.jboss.resteasy.reactive.RestResponse.Status.*;

import java.util.*;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;
import org.tkit.onecx.search.config.test.AbstractTest;
Expand Down Expand Up @@ -222,12 +221,12 @@ void shouldFindByCriteria() {

List<String> searchConfigApplications = configs.stream()
.map(SearchConfigResultDTO::getAppId)
.collect(Collectors.toList());
.toList();
assertThat(searchConfigApplications).contains(application);

List<String> configIds = configs.stream()
.map(SearchConfigResultDTO::getId)
.collect(Collectors.toList());
.toList();
assertThat(configIds).containsAll(Arrays.asList(expectedIds));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static org.jboss.resteasy.reactive.RestResponse.Status.*;

import java.util.*;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;
import org.tkit.onecx.search.config.test.AbstractTest;
Expand Down Expand Up @@ -282,12 +281,12 @@ void shouldFindByCriteria() {

List<String> searchConfigApplications = configs.stream()
.map(SearchConfigResultDTO::getAppId)
.collect(Collectors.toList());
.toList();
assertThat(searchConfigApplications).contains(application);

List<String> configIds = configs.stream()
.map(SearchConfigResultDTO::getId)
.collect(Collectors.toList());
.toList();
assertThat(configIds).containsAll(Arrays.asList(expectedIds));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static org.jboss.resteasy.reactive.RestResponse.Status.*;

import java.util.*;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;
import org.tkit.onecx.search.config.test.AbstractTest;
Expand Down Expand Up @@ -117,9 +116,7 @@ void shouldCreateSearchConfig() {
void shouldUpdateModificationCount() {
String searchConfigId = "c1";

String application = "support-tool-ui";
String name = "criteria-name";
String page = "criteria-page";

UpdateSearchConfigRequestDTOV1 updateRequestBody = new UpdateSearchConfigRequestDTOV1();
updateRequestBody.setName(name);
Expand Down Expand Up @@ -238,7 +235,7 @@ void shouldFindByCriteria() {

List<String> configIds = configs.stream()
.map(SearchConfigSearchResultDTOV1::getName)
.collect(Collectors.toList());
.toList();
assertThat(configIds).containsAll(Arrays.asList(expectedIds));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import static org.jboss.resteasy.reactive.RestResponse.Status.*;

import java.util.*;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;
import org.tkit.onecx.search.config.test.AbstractTest;
Expand Down Expand Up @@ -289,7 +288,7 @@ void shouldFindByCriteria() {

List<String> configIds = configs.stream()
.map(SearchConfigSearchResultDTOV1::getConfigId)
.collect(Collectors.toList());
.toList();
assertThat(configIds).containsAll(Arrays.asList(expectedIds));
}

Expand Down Expand Up @@ -317,15 +316,14 @@ void shouldFindByCriteriaPage() {

List<String> configIds = configs.stream()
.map(SearchConfigSearchResultDTOV1::getName)
.collect(Collectors.toList());
.toList();
assertThat(configIds).containsAll(Arrays.asList(expectedIds));
}

@Test
void shouldFindOneResultByCriteria() {
String application = "support-tool-ui";
String page = "page1";
String name = "name1";
SearchConfigSearchRequestDTOV1 requestBody = new SearchConfigSearchRequestDTOV1();
requestBody.setProductName("productName1");
requestBody.setAppId(application);
Expand Down Expand Up @@ -382,7 +380,7 @@ void shouldFindAllByCriteriaEmpty() {

@Test
void shouldNotFindByCriteriaNullCriteria() {
var response = given()
given()
.contentType(APPLICATION_JSON)
.post("/search")
.then()
Expand Down

0 comments on commit f65592c

Please sign in to comment.