Skip to content
Snippets Groups Projects
Commit 43fc0c7a authored by Tobias Bruns's avatar Tobias Bruns
Browse files

OZG-6988 fix data structure

parent d3b1ff0c
No related branches found
No related tags found
1 merge request!3Ozg 6988 add reporting
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<parent> <parent>
<groupId>de.ozgcloud.common</groupId> <groupId>de.ozgcloud.common</groupId>
<artifactId>ozgcloud-common-parent</artifactId> <artifactId>ozgcloud-common-parent</artifactId>
<version>4.7.0-SNAPSHOT</version> <version>4.8.0-SNAPSHOT</version>
<relativePath/> <relativePath/>
</parent> </parent>
......
...@@ -12,7 +12,6 @@ import org.springframework.data.mongodb.core.mapping.Document; ...@@ -12,7 +12,6 @@ import org.springframework.data.mongodb.core.mapping.Document;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import de.ozgcloud.admin.reporting.ReportingAggregationManagerSettingDto.FormIdentifierDto;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import lombok.Singular; import lombok.Singular;
...@@ -32,7 +31,7 @@ public class AggregationMapping { ...@@ -32,7 +31,7 @@ public class AggregationMapping {
private String name = "aggregationMapping"; private String name = "aggregationMapping";
@Valid @Valid
private FormIdentifierDto formIdentifier; private FormIdentifier formIdentifier;
@NotEmpty @NotEmpty
@Singular @Singular
...@@ -47,7 +46,9 @@ public class AggregationMapping { ...@@ -47,7 +46,9 @@ public class AggregationMapping {
private String targetPath; private String targetPath;
} }
static class FormIdentifer { @Builder
@Getter
static class FormIdentifier {
@NotBlank @NotBlank
private String formEngineName; private String formEngineName;
@NotBlank @NotBlank
......
...@@ -9,7 +9,7 @@ import lombok.RequiredArgsConstructor; ...@@ -9,7 +9,7 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor @RequiredArgsConstructor
@DtoService(SettingConstants.AGGREGATION_MANAGER) @DtoService(SettingConstants.AGGREGATION_MANAGER)
class ReportingAggregationManagerSettingDTOService implements SettingDtoService { class ReportingAggregationManagerSettingDtoService implements SettingDtoService {
private final AggregationMappingRepository repository; private final AggregationMappingRepository repository;
private final AggregationMappingMapper mapper; private final AggregationMappingMapper mapper;
......
...@@ -29,6 +29,7 @@ import static org.assertj.core.groups.Tuple.tuple; ...@@ -29,6 +29,7 @@ import static org.assertj.core.groups.Tuple.tuple;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.keycloak.representations.idm.GroupRepresentation; import org.keycloak.representations.idm.GroupRepresentation;
...@@ -122,9 +123,9 @@ class KeycloakApiServiceITCase { ...@@ -122,9 +123,9 @@ class KeycloakApiServiceITCase {
private String getOrganisationsEinheitId(GroupRepresentation group) { private String getOrganisationsEinheitId(GroupRepresentation group) {
var attributes = group.getAttributes(); var attributes = group.getAttributes();
return attributes.containsKey(properties.getOrganisationsEinheitIdKey()) ? return attributes.containsKey(properties.getOrganisationsEinheitIdKey())
attributes.get(properties.getOrganisationsEinheitIdKey()).getFirst() : ? attributes.get(properties.getOrganisationsEinheitIdKey()).getFirst()
null; : null;
} }
} }
...@@ -175,7 +176,7 @@ class KeycloakApiServiceITCase { ...@@ -175,7 +176,7 @@ class KeycloakApiServiceITCase {
var groupId = service.addGroup(groupToAdd); var groupId = service.addGroup(groupToAdd);
assertThat(findGroupInKeycloak(groupId)).isPresent().get().extracting(GroupRepresentation::getSubGroups) assertThat(findGroupInKeycloak(groupId)).isPresent().get().extracting(GroupRepresentation::getSubGroups)
.asList().isEmpty(); .asInstanceOf(InstanceOfAssertFactories.LIST).isEmpty();
} }
private GroupRepresentation createUniqueGroupRepresentation(String nameSuffix) { private GroupRepresentation createUniqueGroupRepresentation(String nameSuffix) {
......
...@@ -3,7 +3,7 @@ package de.ozgcloud.admin.reporting; ...@@ -3,7 +3,7 @@ package de.ozgcloud.admin.reporting;
import java.util.UUID; import java.util.UUID;
import de.ozgcloud.admin.reporting.AggregationMapping.FieldMapping; import de.ozgcloud.admin.reporting.AggregationMapping.FieldMapping;
import de.ozgcloud.admin.reporting.ReportingAggregationManagerSettingDto.FormIdentifierDto; import de.ozgcloud.admin.reporting.AggregationMapping.FormIdentifier;
class AggregationMappingTestFactory { class AggregationMappingTestFactory {
...@@ -21,7 +21,7 @@ class AggregationMappingTestFactory { ...@@ -21,7 +21,7 @@ class AggregationMappingTestFactory {
public static AggregationMapping.AggregationMappingBuilder createBuilder() { public static AggregationMapping.AggregationMappingBuilder createBuilder() {
return AggregationMapping.builder() return AggregationMapping.builder()
.id(UUID.randomUUID().toString()) .id(UUID.randomUUID().toString())
.formIdentifier(FormIdentifierDto.builder() .formIdentifier(FormIdentifier.builder()
.formEngineName(FORM_ENGINE_NAME) .formEngineName(FORM_ENGINE_NAME)
.formId(FORM_ID) .formId(FORM_ID)
.build()) .build())
......
...@@ -10,10 +10,10 @@ import org.mapstruct.factory.Mappers; ...@@ -10,10 +10,10 @@ import org.mapstruct.factory.Mappers;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Spy; import org.mockito.Spy;
class ReportingAggregationManagerSettingDTOServiceTest { class ReportingAggregationManagerSettingDtoServiceTest {
@InjectMocks @InjectMocks
private ReportingAggregationManagerSettingDTOService service; private ReportingAggregationManagerSettingDtoService service;
@Spy @Spy
private AggregationMappingMapper mapper = Mappers.getMapper(AggregationMappingMapper.class); private AggregationMappingMapper mapper = Mappers.getMapper(AggregationMappingMapper.class);
......
...@@ -14,7 +14,7 @@ class ReportingSettingDtoTestFactory { ...@@ -14,7 +14,7 @@ class ReportingSettingDtoTestFactory {
return createBuilder().build(); return createBuilder().build();
} }
public static ReportingAggregationManagerSettingDto.ReportingSettingDtoBuilder createBuilder() { public static ReportingAggregationManagerSettingDto.ReportingAggregationManagerSettingDtoBuilder createBuilder() {
return ReportingAggregationManagerSettingDto.builder() return ReportingAggregationManagerSettingDto.builder()
.aggregationMapping(AggregationMappingDto.builder() .aggregationMapping(AggregationMappingDto.builder()
.formIdentifier(FORM_IDENTIFIER) .formIdentifier(FORM_IDENTIFIER)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment