Skip to content
Snippets Groups Projects
Commit cb9fe792 authored by Felix Reichenbach's avatar Felix Reichenbach
Browse files

OZG-7907 add new fields to aggregation mapping configuration

parent e8876358
Branches
Tags
1 merge request!13OZG-7907 add new fields to aggregation mapping configuration
Showing
with 70 additions and 3 deletions
......@@ -61,6 +61,10 @@ public class AggregationMapping {
@NotEmpty(message = FIELD_IS_EMPTY)
private String name;
private String parent;
private Status status;
private Scope scope;
@Valid
private FormIdentifier formIdentifier;
......@@ -88,4 +92,12 @@ public class AggregationMapping {
@NotBlank(message = FIELD_IS_EMPTY)
private String formId;
}
enum Status {
AUSSTEHEND, FREIGEGEBEN, ZURUECKGEHALTEN
}
enum Scope {
LAND, MANDANT
}
}
......@@ -43,6 +43,9 @@ public class ReportingAggregationManagerSettingDto {
static class AggregationMappingDto {
private FormIdentifierDto formIdentifier;
private String name;
private String parent;
private StatusDto status;
private ScopeDto scope;
@Singular
private List<FieldMappingDto> fieldMappings;
}
......@@ -60,4 +63,12 @@ public class ReportingAggregationManagerSettingDto {
private String sourcePath;
private String targetPath;
}
enum StatusDto {
AUSSTEHEND, FREIGEGEBEN, ZURUECKGEHALTEN
}
enum ScopeDto {
LAND, MANDANT
}
}
......@@ -5,11 +5,16 @@ import static de.ozgcloud.admin.reporting.AggregationMappingTestFactory.*;
import de.ozgcloud.admin.reporting.ReportingAggregationManagerSettingDto.AggregationMappingDto;
import de.ozgcloud.admin.reporting.ReportingAggregationManagerSettingDto.FieldMappingDto;
import de.ozgcloud.admin.reporting.ReportingAggregationManagerSettingDto.FormIdentifierDto;
import de.ozgcloud.admin.reporting.ReportingAggregationManagerSettingDto.ScopeDto;
import de.ozgcloud.admin.reporting.ReportingAggregationManagerSettingDto.StatusDto;
public class AggregationMappingDtoTestFactory {
public static final FormIdentifierDto FORM_IDENTIFIER = FormIdentifierDto.builder().formId(FORM_ID).formEngineName(FORM_ENGINE_NAME).build();
public static final String NAME = AggregationMappingTestFactory.NAME;
public static final String PARENT = AggregationMappingTestFactory.PARENT;
public static final StatusDto STATUS = StatusDto.valueOf(AggregationMappingTestFactory.STATUS.name());
public static final ScopeDto SCOPE = ScopeDto.valueOf(AggregationMappingTestFactory.SCOPE.name());
public static AggregationMappingDto create() {
return createBuilder().build();
......@@ -19,6 +24,9 @@ public class AggregationMappingDtoTestFactory {
return AggregationMappingDto.builder()
.formIdentifier(FORM_IDENTIFIER)
.name(NAME)
.parent(PARENT)
.status(STATUS)
.scope(SCOPE)
.fieldMapping(FieldMappingDto.builder().sourcePath(SOURCE_PATH).targetPath(TARGET_PATH).build());
}
}
......@@ -36,6 +36,8 @@ import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import de.ozgcloud.admin.reporting.AggregationMapping.Scope;
import de.ozgcloud.admin.reporting.AggregationMapping.Status;
import de.ozgcloud.admin.setting.PropertiesTestFactory;
import de.ozgcloud.common.test.DataITCase;
import lombok.SneakyThrows;
......@@ -78,6 +80,9 @@ public class AggregationMappingEnvironmentSettingITCase {
.formId(PropertiesTestFactory.FORM_ID_1)
.build())
.name(PropertiesTestFactory.NAME_1)
.parent(PropertiesTestFactory.PARENT_1)
.status(Status.valueOf(PropertiesTestFactory.STATUS_1))
.scope(Scope.valueOf(PropertiesTestFactory.SCOPE_1))
.mapping(AggregationMapping.FieldMapping.builder().sourcePath(PropertiesTestFactory.SOURCE_PATH_1_1)
.targetPath(PropertiesTestFactory.TARGET_PATH_1_1).build())
.mapping(AggregationMapping.FieldMapping.builder().sourcePath(PropertiesTestFactory.SOURCE_PATH_1_2)
......@@ -91,6 +96,9 @@ public class AggregationMappingEnvironmentSettingITCase {
.formId(PropertiesTestFactory.FORM_ID_2)
.build())
.name(PropertiesTestFactory.NAME_2)
.parent(PropertiesTestFactory.PARENT_2)
.status(Status.valueOf(PropertiesTestFactory.STATUS_2))
.scope(Scope.valueOf(PropertiesTestFactory.SCOPE_2))
.mapping(AggregationMapping.FieldMapping.builder().sourcePath(PropertiesTestFactory.SOURCE_PATH_2_1)
.targetPath(PropertiesTestFactory.TARGET_PATH_2_1).build())
.mapping(AggregationMapping.FieldMapping.builder().sourcePath(PropertiesTestFactory.SOURCE_PATH_2_2)
......
......@@ -25,8 +25,12 @@ package de.ozgcloud.admin.reporting;
import java.util.UUID;
import com.thedeanda.lorem.LoremIpsum;
import de.ozgcloud.admin.reporting.AggregationMapping.FieldMapping;
import de.ozgcloud.admin.reporting.AggregationMapping.FormIdentifier;
import de.ozgcloud.admin.reporting.AggregationMapping.Scope;
import de.ozgcloud.admin.reporting.AggregationMapping.Status;
public class AggregationMappingTestFactory {
......@@ -34,6 +38,9 @@ public class AggregationMappingTestFactory {
public static final String NAME = "Test Auswertung";
public static final String FORM_ENGINE_NAME = "A12";
public static final String FORM_ID = "42";
public static final String PARENT = LoremIpsum.getInstance().getName();
public static final Status STATUS = Status.AUSSTEHEND;
public static final Scope SCOPE = Scope.MANDANT;
public static final String SOURCE_PATH = "name";
public static final String TARGET_PATH = "antragsteller.name";
......@@ -46,6 +53,9 @@ public class AggregationMappingTestFactory {
return AggregationMapping.builder()
.id(UUID.randomUUID().toString())
.name(NAME)
.parent(PARENT)
.status(STATUS)
.scope(SCOPE)
.formIdentifier(FormIdentifier.builder()
.formEngineName(FORM_ENGINE_NAME)
.formId(FORM_ID)
......
......@@ -69,7 +69,7 @@ class ReportingAggregationManagerSettingDtoServiceTest {
void shouldBuildDto() {
var dto = service.mapToDto(List.of(AggregationMappingTestFactory.create()));
assertThat(dto).usingRecursiveComparison().isEqualTo(ReportingAggregationMAnagerSettingDtoTestFactory.create());
assertThat(dto).usingRecursiveComparison().isEqualTo(ReportingAggregationManagerSettingDtoTestFactory.create());
}
}
......@@ -81,7 +81,7 @@ class ReportingAggregationManagerSettingDtoServiceTest {
@BeforeEach
void disableMapToDtoFunction() {
doReturn(ReportingAggregationMAnagerSettingDtoTestFactory.create()).when(service).mapToDto(any());
doReturn(ReportingAggregationManagerSettingDtoTestFactory.create()).when(service).mapToDto(any());
}
@Test
......
......@@ -23,7 +23,7 @@
*/
package de.ozgcloud.admin.reporting;
class ReportingAggregationMAnagerSettingDtoTestFactory {
class ReportingAggregationManagerSettingDtoTestFactory {
public static ReportingAggregationManagerSettingDto create() {
return createBuilder().build();
......
......@@ -37,6 +37,9 @@ public class PropertiesTestFactory {
public static final String FORM_ENGINE_NAME_1 = LoremIpsum.getInstance().getWords(1);
public static final String FORM_ID_1 = LoremIpsum.getInstance().getWords(1);
public static final String NAME_1 = LoremIpsum.getInstance().getWords(1);
public static final String PARENT_1 = LoremIpsum.getInstance().getWords(1);
public static final String STATUS_1 = "AUSSTEHEND";
public static final String SCOPE_1 = "MANDANT";
public static final String SOURCE_PATH_1_1 = LoremIpsum.getInstance().getWords(1);
public static final String TARGET_PATH_1_1 = LoremIpsum.getInstance().getWords(1);
public static final String SOURCE_PATH_1_2 = LoremIpsum.getInstance().getWords(1);
......@@ -46,6 +49,9 @@ public class PropertiesTestFactory {
public static final String FORM_ENGINE_NAME_2 = LoremIpsum.getInstance().getWords(1);
public static final String FORM_ID_2 = LoremIpsum.getInstance().getWords(1);
public static final String NAME_2 = LoremIpsum.getInstance().getWords(1);
public static final String PARENT_2 = LoremIpsum.getInstance().getWords(1);
public static final String STATUS_2 = "FREIGEGEBEN";
public static final String SCOPE_2 = "LAND";
public static final String SOURCE_PATH_2_1 = LoremIpsum.getInstance().getWords(1);
public static final String TARGET_PATH_2_1 = LoremIpsum.getInstance().getWords(1);
public static final String SOURCE_PATH_2_2 = LoremIpsum.getInstance().getWords(1);
......@@ -79,6 +85,9 @@ public class PropertiesTestFactory {
FORM_ENGINE_NAME_1,
FORM_ID_1,
NAME_1,
PARENT_1,
STATUS_1,
SCOPE_1,
SOURCE_PATH_1_1,
TARGET_PATH_1_1,
SOURCE_PATH_1_2,
......@@ -88,6 +97,9 @@ public class PropertiesTestFactory {
FORM_ENGINE_NAME_2,
FORM_ID_2,
NAME_2,
PARENT_2,
STATUS_2,
SCOPE_2,
SOURCE_PATH_2_1,
TARGET_PATH_2_1,
SOURCE_PATH_2_2,
......
......@@ -13,6 +13,9 @@
"ozgcloud.aggregation.aggregationMappings[0].formIdentifier.formEngineName": "%s",
"ozgcloud.aggregation.aggregationMappings[0].formIdentifier.formId": "%s",
"ozgcloud.aggregation.aggregationMappings[0].name": "%s",
"ozgcloud.aggregation.aggregationMappings[0].parent": "%s",
"ozgcloud.aggregation.aggregationMappings[0].status": "%s",
"ozgcloud.aggregation.aggregationMappings[0].scope": "%s",
"ozgcloud.aggregation.aggregationMappings[0].fieldMappings[0].sourcePath": "%s",
"ozgcloud.aggregation.aggregationMappings[0].fieldMappings[0].targetPath": "%s",
"ozgcloud.aggregation.aggregationMappings[0].fieldMappings[1].sourcePath": "%s",
......@@ -22,6 +25,9 @@
"ozgcloud.aggregation.aggregationMappings[1].formIdentifier.formEngineName": "%s",
"ozgcloud.aggregation.aggregationMappings[1].formIdentifier.formId": "%s",
"ozgcloud.aggregation.aggregationMappings[1].name": "%s",
"ozgcloud.aggregation.aggregationMappings[1].parent": "%s",
"ozgcloud.aggregation.aggregationMappings[1].status": "%s",
"ozgcloud.aggregation.aggregationMappings[1].scope": "%s",
"ozgcloud.aggregation.aggregationMappings[1].fieldMappings[0].sourcePath": "%s",
"ozgcloud.aggregation.aggregationMappings[1].fieldMappings[0].targetPath": "%s",
"ozgcloud.aggregation.aggregationMappings[1].fieldMappings[1].sourcePath": "%s",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment