Skip to content

Commit

Permalink
feat: added name as fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
JordenReuter committed Oct 31, 2024
1 parent 9b2f885 commit d5b8547
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 36 deletions.
72 changes: 36 additions & 36 deletions docs/modules/onecx-theme-svc/pages/onecx-theme-svc-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,158 +12,158 @@ h| Version

| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-core.html[Link]
|
| 0.26.0
| 0.34.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.26.0/docs/modules/onecx-quarkus/pages/includes/onecx-tenant.adoc[Link]
| 0.26.0
| https://github.com/onecx/onecx-quarkus/blob/0.34.0/docs/modules/onecx-quarkus/pages/includes/onecx-tenant.adoc[Link]
| 0.34.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.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
| 2.31.0
| https://github.com/1000kit/tkit-quarkus/blob/2.36.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
| 2.36.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.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa-tenant.adoc[Link]
| 2.31.0
| https://github.com/1000kit/tkit-quarkus/blob/2.36.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa-tenant.adoc[Link]
| 2.36.0

| tkit-quarkus-data-import

| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-data-import.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-data-import.adoc[Link]
| 2.31.0
| https://github.com/1000kit/tkit-quarkus/blob/2.36.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-data-import.adoc[Link]
| 2.36.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.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa.adoc[Link]
| 2.31.0
| https://github.com/1000kit/tkit-quarkus/blob/2.36.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa.adoc[Link]
| 2.36.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.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
| 2.31.0
| https://github.com/1000kit/tkit-quarkus/blob/2.36.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
| 2.36.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.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
| 2.31.0
| https://github.com/1000kit/tkit-quarkus/blob/2.36.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
| 2.36.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.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
| 2.31.0
| https://github.com/1000kit/tkit-quarkus/blob/2.36.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
| 2.36.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.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
| 2.31.0
| https://github.com/1000kit/tkit-quarkus/blob/2.36.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
| 2.36.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.13.2
| 3.15.1
| 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.13.2
| 3.15.1
| 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.13.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.13.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.13.2
| 3.15.1
| 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.13.2
| 3.15.1
| quarkus-rest
| https://quarkus.io/guides/rest[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-rest.adoc[Link]
| 3.13.2
| 3.15.1
| quarkus-rest-jackson
| https://quarkus.io/guides/rest-json[Link]
|
| 3.13.2
| 3.15.1
| 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.13.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.13.2
| 3.15.1
| 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.13.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.13.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.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
| 2.31.0
| https://github.com/1000kit/tkit-quarkus/blob/2.36.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
| 2.36.0
| 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.13.2
| 3.15.1
| onecx-security
|
|
| 0.26.0
| 0.34.0
| quarkus-smallrye-context-propagation
|
|
| 3.13.2
| 3.15.1
|===
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Map<String, Map<String, ImageDTOV1>> createImages(List<Image> images) {
@Mapping(target = "tenantId", ignore = true)
@Mapping(target = "operator", ignore = true)
@Mapping(target = "properties", qualifiedByName = "properties")
@Mapping(target = "displayName", source = "dto.displayName", defaultExpression = "java(name)")
public abstract Theme create(String name, EximThemeDTOV1 dto);

@Named("properties")
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/import/template.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"themes": {
"OneCX": {
"displayName": "OneCX Theme",
"cssFile": null,
"description": "OneCX Theme",
"assetsUrl": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,58 @@ void importThemesTest() {
from(ImportThemeResponseStatusDTOV1::toString));
}

@Test
void importThemeWithoutDisplayNameTest() {

var request = new ThemeSnapshotDTOV1();

var data = given()
.auth().oauth2(getKeycloakClientToken("testClient"))
.when()
.contentType(APPLICATION_JSON)
.body(request)
.post("export")
.then()
.statusCode(OK.getStatusCode())
.extract().as(ThemeSnapshotDTOV1.class);
assertThat(data).isNotNull();
assertThat(data.getThemes()).hasSize(3);

var importTheme = new EximThemeDTOV1();
importTheme.setDescription("new theme description");
importTheme.putImagesItem("logo", new ImageDTOV1().imageData(new byte[] { 1, 2, 3 }).mimeType("image/*"));
importTheme.putImagesItem("logo2", new ImageDTOV1().imageData(new byte[] { 1, 2, 3 }).mimeType("image/*"));
data.getThemes().put("themeWithoutDisplayName", importTheme);

var dto = given()
.auth().oauth2(getKeycloakClientToken("testClient"))
.when()
.contentType(APPLICATION_JSON)
.body(data)
.post("import")
.then()
.statusCode(OK.getStatusCode())
.extract().as(ImportThemeResponseDTOV1.class);

assertThat(dto).isNotNull().returns(data.getId(), from(ImportThemeResponseDTOV1::getId));

//check if fallback displayname was used
var exportResponse = given()
.auth().oauth2(getKeycloakClientToken("testClient"))
.when()
.contentType(APPLICATION_JSON)
.body(request)
.post("export")
.then()
.statusCode(OK.getStatusCode())
.extract().as(ThemeSnapshotDTOV1.class);

assertThat(exportResponse).isNotNull();
assertThat(exportResponse.getThemes()).hasSize(4);
assertThat(exportResponse.getThemes().get("themeWithoutDisplayName").getDisplayName())
.isEqualTo("themeWithoutDisplayName");
}

@Test
void importOperatorThemesTest() {

Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/import/theme-import.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"themes": {
"Theme1": {
"displayName": "Theme 1",
"description": "Theme1 basic color scheme",
"properties": {
"topbar": {
Expand Down Expand Up @@ -50,6 +51,7 @@
}
},
"Theme2": {
"diplayName": "Theme 2",
"description": "Theme2 theme",
"properties": {
"topbar": {
Expand Down Expand Up @@ -100,6 +102,7 @@
}
},
"Theme3": {
"displayName": "Theme 3",
"description": "Theme3 basic color scheme",
"properties": {
"topbar": {
Expand Down

0 comments on commit d5b8547

Please sign in to comment.