diff --git a/stack/keycloak/migration/add-authorities-basisdaten-wahltage.yml b/stack/keycloak/migration/add-authorities-basisdaten-wahltage.yml
new file mode 100644
index 000000000..31c385c98
--- /dev/null
+++ b/stack/keycloak/migration/add-authorities-basisdaten-wahltage.yml
@@ -0,0 +1,37 @@
+id: add authorities basisdaten wahltage
+author: Nic12345678
+realm: ${SSO_REALM}
+changes:
+ - addRole:
+ name: Basisdaten_BUSINESSACTION_GetWahltage
+ clientRole: true
+ clientId: ${SSO_CLIENT_ID}
+ - assignRoleToGroup:
+ group: allBasisdatenAuthorities
+ role: Basisdaten_BUSINESSACTION_GetWahltage
+ clientId: ${SSO_CLIENT_ID}
+
+ - addRole:
+ name: Basisdaten_READ_Wahltag
+ clientRole: true
+ clientId: ${SSO_CLIENT_ID}
+ - assignRoleToGroup:
+ group: allBasisdatenAuthorities
+ role: Basisdaten_READ_Wahltag
+ clientId: ${SSO_CLIENT_ID}
+ - addRole:
+ name: Basisdaten_WRITE_Wahltag
+ clientRole: true
+ clientId: ${SSO_CLIENT_ID}
+ - assignRoleToGroup:
+ group: allBasisdatenAuthorities
+ role: Basisdaten_WRITE_Wahltag
+ clientId: ${SSO_CLIENT_ID}
+ - addRole:
+ name: Basisdaten_DELETE_Wahltag
+ clientRole: true
+ clientId: ${SSO_CLIENT_ID}
+ - assignRoleToGroup:
+ group: allBasisdatenAuthorities
+ role: Basisdaten_DELETE_Wahltag
+ clientId: ${SSO_CLIENT_ID}
\ No newline at end of file
diff --git a/stack/keycloak/migration/keycloak-changelog.yml b/stack/keycloak/migration/keycloak-changelog.yml
index 0ad30ab4f..1be1b5a89 100644
--- a/stack/keycloak/migration/keycloak-changelog.yml
+++ b/stack/keycloak/migration/keycloak-changelog.yml
@@ -33,4 +33,5 @@ includes:
- path: add-authorities-basisdaten-wahlvorschlaege.yml
- path: add-authorities-eai-wahlvorschlag.yml
- path: add-authorities-eai-wahldaten.yml
- - path: add-authorities-basisdaten-handbuch.yml
\ No newline at end of file
+ - path: add-authorities-basisdaten-handbuch.yml
+ - path: add-authorities-basisdaten-wahltage.yml
\ No newline at end of file
diff --git a/wls-basisdaten-service/pom.xml b/wls-basisdaten-service/pom.xml
index 35a01b8fe..34e08d266 100644
--- a/wls-basisdaten-service/pom.xml
+++ b/wls-basisdaten-service/pom.xml
@@ -393,7 +393,7 @@
generate
- ${project.basedir}/src/main/resources/openapis/openapi.eai.0.0.1-RC1.json
+ ${project.basedir}/src/main/resources/openapis/openapi.eai.0.1.0.json
java
resttemplate
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/DummyClientImpl.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/DummyClientImpl.java
index 5b2e10b6e..649647902 100644
--- a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/DummyClientImpl.java
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/DummyClientImpl.java
@@ -1,11 +1,15 @@
package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.configuration.Profiles;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModel;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltageClient;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.KandidatModel;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.WahlvorschlaegeClient;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.WahlvorschlaegeModel;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.WahlvorschlagModel;
import de.muenchen.oss.wahllokalsystem.wls.common.security.domain.BezirkUndWahlID;
+import java.time.LocalDate;
+import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.springframework.context.annotation.Profile;
@@ -13,7 +17,7 @@
@Component
@Profile(Profiles.DUMMY_CLIENTS)
-public class DummyClientImpl implements WahlvorschlaegeClient {
+public class DummyClientImpl implements WahlvorschlaegeClient, WahltageClient {
@Override
public WahlvorschlaegeModel getWahlvorschlaege(BezirkUndWahlID bezirkUndWahlID) {
@@ -25,4 +29,13 @@ public WahlvorschlaegeModel getWahlvorschlaege(BezirkUndWahlID bezirkUndWahlID)
Set.of(new KandidatModel(UUID.randomUUID().toString(), "kandidat21", 1L, true, 1L, true),
new KandidatModel(UUID.randomUUID().toString(), "kandidat22", 2L, false, 1L, false)))));
}
+
+ @Override
+ public List getWahltage(LocalDate tag) {
+ return List.of(
+ new WahltagModel("wahltagID4", LocalDate.now().plusMonths(2), "Beschreibung Wahltag 4", "3"),
+ new WahltagModel("wahltagID1", LocalDate.now().minusMonths(2), "Beschreibung Wahltag 1", "0"),
+ new WahltagModel("wahltagID3", LocalDate.now().plusMonths(1), "Beschreibung Wahltag 3", "2"),
+ new WahltagModel("wahltagID2", LocalDate.now().minusMonths(1), "Beschreibung Wahltag 2", "1"));
+ }
}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientImpl.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientImpl.java
new file mode 100644
index 000000000..d5e9f51e1
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientImpl.java
@@ -0,0 +1,45 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients;
+
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.configuration.Profiles;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.client.WahldatenControllerApi;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.exception.ExceptionConstants;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModel;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltageClient;
+import de.muenchen.oss.wahllokalsystem.wls.common.exception.WlsException;
+import de.muenchen.oss.wahllokalsystem.wls.common.exception.util.ExceptionFactory;
+import java.time.LocalDate;
+import java.util.List;
+import java.util.Set;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile(Profiles.NOT + Profiles.DUMMY_CLIENTS)
+@RequiredArgsConstructor
+@Slf4j
+public class WahltageClientImpl implements WahltageClient {
+
+ private final ExceptionFactory exceptionFactory;
+
+ private final WahldatenControllerApi wahldatenControllerApi;
+ private final WahltageClientMapper wahltageClientMapper;
+
+ @Override
+ public List getWahltage(LocalDate tag) throws WlsException {
+
+ final Set wahltageDTO;
+ try {
+ wahltageDTO = wahldatenControllerApi.loadWahltageSinceIncluding(tag);
+ } catch (final Exception exception) {
+ log.info("exception on loadwahltage from external", exception);
+ throw exceptionFactory.createTechnischeWlsException(ExceptionConstants.FAILED_COMMUNICATION_WITH_EAI);
+ }
+ if (wahltageDTO == null) {
+ throw exceptionFactory.createFachlicheWlsException(ExceptionConstants.NULL_FROM_CLIENT);
+ }
+ return wahltageClientMapper.fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(wahltageDTO);
+ }
+}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientMapper.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientMapper.java
new file mode 100644
index 000000000..7d56768bb
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientMapper.java
@@ -0,0 +1,18 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients;
+
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModel;
+import java.util.List;
+import java.util.Set;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+
+@Mapper
+public interface WahltageClientMapper {
+
+ @Mapping(target = "wahltagID", source = "identifikator")
+ @Mapping(target = "wahltag", source = "tag")
+ WahltagModel toWahltagModel(WahltagDTO wahltagDTO);
+
+ List fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(Set wahltageDTO);
+}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/ClientImpl.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahlvorschlaegeClientImpl.java
similarity index 96%
rename from wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/ClientImpl.java
rename to wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahlvorschlaegeClientImpl.java
index bdb6fa859..6c347d937 100644
--- a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/ClientImpl.java
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahlvorschlaegeClientImpl.java
@@ -17,7 +17,7 @@
@Profile(Profiles.NOT + Profiles.DUMMY_CLIENTS)
@RequiredArgsConstructor
@Slf4j
-public class ClientImpl implements WahlvorschlaegeClient {
+public class WahlvorschlaegeClientImpl implements WahlvorschlaegeClient {
private final ExceptionFactory exceptionFactory;
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/Wahltag.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/Wahltag.java
new file mode 100644
index 000000000..965874322
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/Wahltag.java
@@ -0,0 +1,47 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
+import java.time.LocalDate;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import org.springframework.stereotype.Indexed;
+
+@Entity
+@Indexed
+@Data
+@EqualsAndHashCode
+@NoArgsConstructor
+@AllArgsConstructor
+@Table(name = "Wahltag")
+public class Wahltag {
+
+ @Id
+ @NotNull
+ @Size(max = 1024)
+ @ToString.Include
+ private String wahltagID;
+
+ @NotNull
+ @ToString.Include
+ private LocalDate wahltag;
+
+ @Size(max = 1024)
+ @ToString.Include
+ private String beschreibung;
+
+ @Size(max = 1024)
+ @ToString.Include
+ private String nummer;
+}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/WahltagRepository.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/WahltagRepository.java
new file mode 100644
index 000000000..4e3c248de
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/WahltagRepository.java
@@ -0,0 +1,55 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain;
+
+import java.util.List;
+import java.util.Optional;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+
+@PreAuthorize("hasAuthority('Basisdaten_READ_Wahltag')")
+@Transactional
+public interface WahltagRepository extends CrudRepository {
+
+ String CACHE = "WAHLTAG_CACHE";
+
+ @Override
+ List findAll();
+
+ @Override
+ @Cacheable(value = CACHE, key = "#p0")
+ Optional findById(String wahltagID);
+
+ @Override
+ @CachePut(value = CACHE, key = "#p0.wahltagID")
+ @PreAuthorize("hasAuthority('Basisdaten_WRITE_Wahltag')")
+ S save(S entity);
+
+ @Override
+ @PreAuthorize("hasAuthority('Basisdaten_WRITE_Wahltag')")
+ Iterable saveAll(Iterable entities);
+
+ @Override
+ @CacheEvict(value = CACHE, key = "#p0")
+ @PreAuthorize("hasAuthority('Basisdaten_DELETE_Wahltag')")
+ void deleteById(String wahltagID);
+
+ @Override
+ @CacheEvict(value = CACHE, key = "#p0.wahltagID")
+ @PreAuthorize("hasAuthority('Basisdaten_DELETE_Wahltag')")
+ void delete(Wahltag entity);
+
+ @Override
+ @CacheEvict(value = CACHE, allEntries = true)
+ @PreAuthorize("hasAuthority('Basisdaten_DELETE_Wahltag')")
+ void deleteAll(Iterable extends Wahltag> entities);
+
+ @Override
+ @CacheEvict(value = CACHE, allEntries = true)
+ @PreAuthorize("hasAuthority('Basisdaten_DELETE_Wahltag')")
+ void deleteAll();
+
+ List findAllByOrderByWahltagAsc();
+}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltagDTO.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltagDTO.java
new file mode 100644
index 000000000..6c1c00511
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltagDTO.java
@@ -0,0 +1,12 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahltage;
+
+import jakarta.validation.constraints.NotNull;
+import java.time.LocalDate;
+import lombok.Builder;
+
+@Builder
+public record WahltagDTO(@NotNull String wahltagID,
+ @NotNull LocalDate wahltag,
+ String beschreibung,
+ String nummer) {
+}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageController.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageController.java
new file mode 100644
index 000000000..b654152ad
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageController.java
@@ -0,0 +1,26 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahltage;
+
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltageService;
+import io.swagger.v3.oas.annotations.Operation;
+import java.util.List;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/businessActions/wahltage")
+@RequiredArgsConstructor
+@Slf4j
+public class WahltageController {
+
+ private final WahltageService wahltageService;
+ private final WahltageDTOMapper wahltageDTOMapper;
+
+ @Operation(description = "Laden der Liste der Wahltage, aufsteigend sortiert nach Wahltag-Datum und nicht länger als 3 Monate in der Vergangenheit.")
+ @GetMapping
+ public List getWahltage() {
+ return wahltageDTOMapper.fromListOfWahltagModelToListOfWahltagDTO(wahltageService.getWahltage());
+ }
+}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageDTOMapper.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageDTOMapper.java
new file mode 100644
index 000000000..352efb744
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageDTOMapper.java
@@ -0,0 +1,10 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahltage;
+
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModel;
+import java.util.List;
+import org.mapstruct.Mapper;
+
+@Mapper
+public interface WahltageDTOMapper {
+ List fromListOfWahltagModelToListOfWahltagDTO(List wahltage);
+}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltagModel.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltagModel.java
new file mode 100644
index 000000000..1b60ae5d8
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltagModel.java
@@ -0,0 +1,14 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag;
+
+import jakarta.validation.constraints.NotNull;
+import java.time.LocalDate;
+import lombok.Builder;
+
+@Builder
+public record WahltagModel(@NotNull String wahltagID,
+ @NotNull LocalDate wahltag,
+ String beschreibung,
+ String nummer
+) {
+
+}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltagModelMapper.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltagModelMapper.java
new file mode 100644
index 000000000..c7d148efd
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltagModelMapper.java
@@ -0,0 +1,13 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag;
+
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.Wahltag;
+import java.util.List;
+import org.mapstruct.Mapper;
+
+@Mapper
+public interface WahltagModelMapper {
+
+ List fromWahltagEntityToWahltagModelList(List entities);
+
+ List fromWahltagModelToWahltagEntityList(List entities);
+}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageClient.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageClient.java
new file mode 100644
index 000000000..68bcf5445
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageClient.java
@@ -0,0 +1,20 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag;
+
+import de.muenchen.oss.wahllokalsystem.wls.common.exception.WlsException;
+import java.time.LocalDate;
+import java.util.List;
+
+public interface WahltageClient {
+
+ /**
+ * @param tag The Request Tag - Reference for requested Wahltage
+ * @return List
+ * @throws WlsException
+ * {@link de.muenchen.oss.wahllokalsystem.wls.common.exception.FachlicheWlsException} if
+ * return would be null
+ * {@link de.muenchen.oss.wahllokalsystem.wls.common.exception.TechnischeWlsException}
+ * if there were trouble during communication
+ */
+ List getWahltage(final LocalDate tag) throws WlsException;
+
+}
diff --git a/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageService.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageService.java
new file mode 100644
index 000000000..a5ce66c99
--- /dev/null
+++ b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageService.java
@@ -0,0 +1,32 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag;
+
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.WahltagRepository;
+import java.time.LocalDate;
+import java.util.List;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import lombok.val;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Service;
+
+@Service
+@RequiredArgsConstructor
+@Slf4j
+public class WahltageService {
+
+ private final WahltagRepository wahltagRepository;
+
+ private final WahltagModelMapper wahltagModelMapper;
+
+ private final WahltageClient wahltageClient;
+
+ @PreAuthorize(
+ "hasAuthority('Basisdaten_BUSINESSACTION_GetWahltage')"
+ )
+ public List getWahltage() {
+ log.info("#getWahltage");
+ val wahltage = wahltageClient.getWahltage(LocalDate.now().minusMonths(3));
+ wahltagRepository.saveAll(wahltagModelMapper.fromWahltagModelToWahltagEntityList(wahltage));
+ return wahltagModelMapper.fromWahltagEntityToWahltagModelList(wahltagRepository.findAllByOrderByWahltagAsc());
+ }
+}
diff --git a/wls-basisdaten-service/src/main/resources/db/migrations/h2/V3_0__createWahltagTable.sql b/wls-basisdaten-service/src/main/resources/db/migrations/h2/V3_0__createWahltagTable.sql
new file mode 100644
index 000000000..932b92471
--- /dev/null
+++ b/wls-basisdaten-service/src/main/resources/db/migrations/h2/V3_0__createWahltagTable.sql
@@ -0,0 +1,9 @@
+CREATE TABLE wahltag
+(
+ wahltagID VARCHAR(1024) NOT NULL,
+ wahltag TIMESTAMP NOT NULL,
+ beschreibung VARCHAR(1024),
+ nummer VARCHAR(1024),
+
+ PRIMARY KEY (wahltagID)
+);
\ No newline at end of file
diff --git a/wls-basisdaten-service/src/main/resources/db/migrations/oracle/V3_0__createWahltagTable.sql b/wls-basisdaten-service/src/main/resources/db/migrations/oracle/V3_0__createWahltagTable.sql
new file mode 100644
index 000000000..932b92471
--- /dev/null
+++ b/wls-basisdaten-service/src/main/resources/db/migrations/oracle/V3_0__createWahltagTable.sql
@@ -0,0 +1,9 @@
+CREATE TABLE wahltag
+(
+ wahltagID VARCHAR(1024) NOT NULL,
+ wahltag TIMESTAMP NOT NULL,
+ beschreibung VARCHAR(1024),
+ nummer VARCHAR(1024),
+
+ PRIMARY KEY (wahltagID)
+);
\ No newline at end of file
diff --git a/wls-basisdaten-service/src/main/resources/openapis/openapi.eai.0.0.1-RC1.json b/wls-basisdaten-service/src/main/resources/openapis/openapi.eai.0.0.1-RC1.json
deleted file mode 100644
index e254cb9c9..000000000
--- a/wls-basisdaten-service/src/main/resources/openapis/openapi.eai.0.0.1-RC1.json
+++ /dev/null
@@ -1 +0,0 @@
-{"openapi":"3.0.1","info":{"title":"EAI Service","contact":{"name":"Your Name","email":"Your E-Mail-Address"},"version":"0.0.1-RC1"},"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"bearerAuth":[]}],"paths":{"/wahlvorstaende":{"get":{"tags":["wahlvorstand-controller"],"operationId":"loadWahlvorstand","parameters":[{"name":"wahlbezirkID","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/WahlvorstandDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}},"post":{"tags":["wahlvorstand-controller"],"operationId":"saveAnwesenheit","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WahlvorstandsaktualisierungDTO"}}},"required":true},"responses":{"200":{"description":"OK"},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahllokalzustand":{"post":{"tags":["wahllokalzustand-controller"],"operationId":"saveWahllokalZustand","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WahllokalZustandDTO"}}},"required":true},"responses":{"200":{"description":"OK"},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahlergebnis":{"post":{"tags":["wahlergebnis-controller"],"operationId":"saveWahlergebnismeldung","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErgebnismeldungDTO"}}},"required":true},"responses":{"200":{"description":"OK"},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahlbeteiligung":{"post":{"tags":["wahlbeteiligung-controller"],"operationId":"saveWahlbeteiligung","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WahlbeteiligungsMeldungDTO"}}},"required":true},"responses":{"200":{"description":"OK"},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahldaten/wahltage":{"get":{"tags":["wahldaten-controller"],"operationId":"loadWahltageSinceIncluding","parameters":[{"name":"includingAfter","in":"query","required":true,"schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/WahltageDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahldaten/wahlen":{"get":{"tags":["wahldaten-controller"],"operationId":"loadWahlen","parameters":[{"name":"forDate","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"withNummer","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/WahlenDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahldaten/wahlbezirke/{wahlbezirkID}/wahlberechtigte":{"get":{"tags":["wahldaten-controller"],"operationId":"loadWahlberechtigte","parameters":[{"name":"wahlbezirkID","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WahlberechtigteDTO"}}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahldaten/wahlbezirk":{"get":{"tags":["wahldaten-controller"],"operationId":"loadWahlbezirke","parameters":[{"name":"forDate","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"withNummer","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/WahlbezirkeDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahldaten/basisdaten":{"get":{"tags":["wahldaten-controller"],"operationId":"getBasisdaten","parameters":[{"name":"forDate","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"withNummer","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/BasisdatenDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/vorschlaege/wahl/{wahlID}/{wahlbezirkID}":{"get":{"tags":["wahlvorschlag-controller"],"operationId":"loadWahlvorschlaege","parameters":[{"name":"wahlID","in":"path","required":true,"schema":{"type":"string"}},{"name":"wahlbezirkID","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/WahlvorschlaegeDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/vorschlaege/wahl/{wahlID}/liste":{"get":{"tags":["wahlvorschlag-controller"],"operationId":"loadWahlvorschlaegeListe","parameters":[{"name":"forDate","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"wahlID","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/WahlvorschlaegeListeDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/vorschlaege/referendum/{wahlID}/{wahlbezirkID}":{"get":{"tags":["wahlvorschlag-controller"],"operationId":"loadReferendumvorlagen","parameters":[{"name":"wahlID","in":"path","required":true,"schema":{"type":"string"}},{"name":"wahlbezirkID","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ReferendumvorlagenDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"no resource found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}}},"components":{"schemas":{"WahlvorstandsaktualisierungDTO":{"required":["anwesenheitBeginn","mitglieder","wahlbezirkID"],"type":"object","properties":{"wahlbezirkID":{"type":"string"},"mitglieder":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlvorstandsmitgliedAktualisierungDTO"}},"anwesenheitBeginn":{"type":"string","format":"date-time"}}},"WahlvorstandsmitgliedAktualisierungDTO":{"required":["anwesend","identifikator"],"type":"object","properties":{"identifikator":{"type":"string"},"anwesend":{"type":"boolean"}}},"DruckzustandDTO":{"required":["niederschriftDruckUhrzeit","niederschriftSendenUhrzeit","schnellmeldungDruckUhrzeit","schnellmeldungSendenUhrzeit","wahlID"],"type":"object","properties":{"wahlID":{"type":"string"},"schnellmeldungSendenUhrzeit":{"type":"string","format":"date-time"},"niederschriftSendenUhrzeit":{"type":"string","format":"date-time"},"schnellmeldungDruckUhrzeit":{"type":"string","format":"date-time"},"niederschriftDruckUhrzeit":{"type":"string","format":"date-time"}}},"WahllokalZustandDTO":{"required":["druckzustaende","letzteAbmeldung","wahlbezirkID","zuletztGesehen"],"type":"object","properties":{"wahlbezirkID":{"type":"string"},"zuletztGesehen":{"type":"string","format":"date-time"},"letzteAbmeldung":{"type":"string","format":"date-time"},"druckzustaende":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/DruckzustandDTO"}}}},"AWerteDTO":{"type":"object","properties":{"a1":{"type":"integer","format":"int64"},"a2":{"type":"integer","format":"int64"}}},"BWerteDTO":{"type":"object","properties":{"b":{"type":"integer","format":"int64"},"b1":{"type":"integer","format":"int64"},"b2":{"type":"integer","format":"int64"}}},"ErgebnisDTO":{"required":["ergebnis","kandidatID","stimmenart","wahlvorschlagID","wahlvorschlagsordnungszahl"],"type":"object","properties":{"stimmenart":{"type":"string"},"wahlvorschlagsordnungszahl":{"type":"integer","format":"int64"},"ergebnis":{"type":"integer","format":"int64"},"wahlvorschlagID":{"type":"string"},"kandidatID":{"type":"string"}}},"ErgebnismeldungDTO":{"required":["wahlID","wahlbezirkID"],"type":"object","properties":{"wahlbezirkID":{"type":"string"},"wahlID":{"type":"string"},"meldungsart":{"type":"string","enum":["NIEDERSCHRIFT","SCHNELLMELDUNG"]},"aWerte":{"$ref":"#/components/schemas/AWerteDTO"},"bWerte":{"$ref":"#/components/schemas/BWerteDTO"},"wahlbriefeWerte":{"$ref":"#/components/schemas/WahlbriefeWerteDTO"},"ungueltigeStimmzettels":{"type":"array","items":{"$ref":"#/components/schemas/UngueltigeStimmzettelDTO"}},"ungueltigeStimmzettelAnzahl":{"type":"integer","format":"int64"},"ergebnisse":{"type":"array","items":{"$ref":"#/components/schemas/ErgebnisDTO"}},"wahlart":{"type":"string","enum":["BAW","BEB","BTW","BZW","EUW","LTW","MBW","OBW","SRW","SVW","VE"]}}},"UngueltigeStimmzettelDTO":{"type":"object","properties":{"stimmenart":{"type":"string"},"anzahl":{"type":"integer","format":"int64"},"wahlvorschlagID":{"type":"string"}}},"WahlbriefeWerteDTO":{"type":"object","properties":{"zurueckgewiesenGesamt":{"type":"integer","format":"int64"}}},"WahlbeteiligungsMeldungDTO":{"required":["anzahlWaehler","meldeZeitpunkt","wahlID","wahlbezirkID"],"type":"object","properties":{"wahlID":{"type":"string"},"wahlbezirkID":{"type":"string"},"anzahlWaehler":{"type":"integer","format":"int64"},"meldeZeitpunkt":{"type":"string","format":"date-time"}}},"WahlvorstandDTO":{"required":["anwesenheitBeginn","mitglieder","wahlbezirkID"],"type":"object","properties":{"anwesenheitBeginn":{"type":"string","format":"date-time"},"wahlbezirkID":{"type":"string"},"mitglieder":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlvorstandsmitgliedDTO"}}}},"WahlvorstandsmitgliedDTO":{"required":["anwesend","funktion","identifikator","nachname","vorname"],"type":"object","properties":{"identifikator":{"type":"string"},"vorname":{"type":"string"},"nachname":{"type":"string"},"funktion":{"type":"string"},"anwesend":{"type":"boolean"}}},"WahltagDTO":{"required":["beschreibung","identifikator","nummer","tag"],"type":"object","properties":{"identifikator":{"type":"string"},"tag":{"type":"string","format":"date"},"beschreibung":{"type":"string"},"nummer":{"type":"string"}}},"WahltageDTO":{"required":["wahltage"],"type":"object","properties":{"wahltage":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahltagDTO"}}}},"WahlDTO":{"required":["identifikator","name","nummer","wahlart","wahltag"],"type":"object","properties":{"identifikator":{"type":"string"},"name":{"type":"string"},"wahlart":{"type":"string","enum":["BAW","BEB","BTW","BZW","EUW","LTW","MBW","OBW","SRW","SVW","VE"]},"wahltag":{"type":"string","format":"date"},"nummer":{"type":"string"}}},"WahlenDTO":{"required":["wahlen"],"type":"object","properties":{"wahlen":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlDTO"}}}},"WahlberechtigteDTO":{"required":["a1","a2","a3","wahlID","wahlbezirkID"],"type":"object","properties":{"wahlID":{"type":"string"},"wahlbezirkID":{"type":"string"},"a1":{"type":"integer","format":"int64"},"a2":{"type":"integer","format":"int64"},"a3":{"type":"integer","format":"int64"}}},"WahlbezirkDTO":{"required":["identifikator","nummer","wahlID","wahlbezirkArt","wahlnummer","wahltag"],"type":"object","properties":{"identifikator":{"type":"string"},"wahlbezirkArt":{"type":"string","enum":["UWB","BWB"]},"nummer":{"type":"string"},"wahltag":{"type":"string","format":"date"},"wahlnummer":{"type":"string"},"wahlID":{"type":"string"}}},"WahlbezirkeDTO":{"required":["wahlbezirke"],"type":"object","properties":{"wahlbezirke":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlbezirkDTO"}}}},"BasisdatenDTO":{"required":["basisstrukturdaten","stimmzettelgebiete","wahlbezirke","wahlen"],"type":"object","properties":{"basisstrukturdaten":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/BasisstrukturdatenDTO"}},"wahlen":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlDTO"}},"wahlbezirke":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlbezirkDTO"}},"stimmzettelgebiete":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/StimmzettelgebietDTO"}}}},"BasisstrukturdatenDTO":{"required":["stimmzettelgebietID","wahlID","wahlbezirkID","wahltag"],"type":"object","properties":{"wahlID":{"type":"string"},"stimmzettelgebietID":{"type":"string"},"wahlbezirkID":{"type":"string"},"wahltag":{"type":"string","format":"date"}}},"StimmzettelgebietDTO":{"required":["stimmzettelgebietart"],"type":"object","properties":{"identifikator":{"type":"string"},"nummer":{"type":"string"},"name":{"type":"string"},"wahltag":{"type":"string","format":"date"},"stimmzettelgebietart":{"type":"string","enum":["SB","SG","SK","WK"]}}},"KandidatDTO":{"required":["identifikator","listenposition","name","tabellenSpalteInNiederschrift"],"type":"object","properties":{"identifikator":{"type":"string"},"name":{"type":"string"},"listenposition":{"type":"integer","format":"int64"},"direktkandidat":{"type":"boolean"},"tabellenSpalteInNiederschrift":{"type":"integer","format":"int64"},"einzelbewerber":{"type":"boolean"}}},"WahlvorschlaegeDTO":{"required":["stimmzettelgebietID","wahlID","wahlbezirkID","wahlvorschlaege"],"type":"object","properties":{"wahlbezirkID":{"type":"string"},"wahlID":{"type":"string"},"stimmzettelgebietID":{"type":"string"},"wahlvorschlaege":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlvorschlagDTO"}}}},"WahlvorschlagDTO":{"required":["erhaeltStimmen","identifikator","kurzname","ordnungszahl"],"type":"object","properties":{"identifikator":{"type":"string"},"ordnungszahl":{"type":"integer","format":"int64"},"kurzname":{"type":"string"},"erhaeltStimmen":{"type":"boolean"},"kandidaten":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/KandidatDTO"}}}},"WahlvorschlaegeListeDTO":{"required":["wahlvorschlaege"],"type":"object","properties":{"wahlvorschlaege":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlvorschlaegeDTO"}}}},"ReferendumoptionDTO":{"required":["id","name"],"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"position":{"type":"integer","format":"int64"}}},"ReferendumvorlageDTO":{"required":["frage","kurzname","ordnungszahl","referendumoption","wahlvorschlagID"],"type":"object","properties":{"wahlvorschlagID":{"type":"string"},"ordnungszahl":{"type":"integer","format":"int64"},"kurzname":{"type":"string"},"frage":{"type":"string"},"referendumoption":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/ReferendumoptionDTO"}}}},"ReferendumvorlagenDTO":{"required":["referendumvorlage","stimmzettelgebietID"],"type":"object","properties":{"stimmzettelgebietID":{"type":"string"},"referendumvorlage":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/ReferendumvorlageDTO"}}}},"WlsExceptionDTO":{"required":["category","code","message","service"],"type":"object","properties":{"category":{"type":"string","enum":["F","T","S","I"]},"code":{"type":"string"},"service":{"type":"string"},"message":{"type":"string"}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}}}
\ No newline at end of file
diff --git a/wls-basisdaten-service/src/main/resources/openapis/openapi.eai.0.1.0.json b/wls-basisdaten-service/src/main/resources/openapis/openapi.eai.0.1.0.json
new file mode 100644
index 000000000..de8c135d1
--- /dev/null
+++ b/wls-basisdaten-service/src/main/resources/openapis/openapi.eai.0.1.0.json
@@ -0,0 +1 @@
+{"openapi":"3.0.1","info":{"title":"EAI Service","contact":{"name":"Your Name","email":"Your E-Mail-Address"},"version":"0.1.0"},"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"security":[{"bearerAuth":[]}],"paths":{"/wahlvorstaende/anwesenheit":{"put":{"tags":["wahlvorstand-controller"],"description":"Aktualisieren der Anwesenheit der Wahlvorstandsmitglieder eines bestimmten Wahlbezirkes","operationId":"saveAnwesenheit","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WahlvorstandsaktualisierungDTO"}}},"required":true},"responses":{"200":{"description":"OK"},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahllokalzustand":{"post":{"tags":["wahllokalzustand-controller"],"operationId":"saveWahllokalZustand","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WahllokalZustandDTO"}}},"required":true},"responses":{"200":{"description":"OK"},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahlergebnis":{"post":{"tags":["wahlergebnis-controller"],"operationId":"saveWahlergebnismeldung","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErgebnismeldungDTO"}}},"required":true},"responses":{"200":{"description":"OK"},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahlbeteiligung":{"post":{"tags":["wahlbeteiligung-controller"],"operationId":"saveWahlbeteiligung","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WahlbeteiligungsMeldungDTO"}}},"required":true},"responses":{"200":{"description":"OK"},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahlvorstaende":{"get":{"tags":["wahlvorstand-controller"],"description":"Abrufen des Wahlvorstandes für einen bestimmten Wahlbezirk","operationId":"loadWahlvorstand","parameters":[{"name":"wahlbezirkID","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/WahlvorstandDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahldaten/wahltage":{"get":{"tags":["wahldaten-controller"],"operationId":"loadWahltageSinceIncluding","parameters":[{"name":"includingSince","in":"query","required":true,"schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahltagDTO"}}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahldaten/wahlen":{"get":{"tags":["wahldaten-controller"],"operationId":"loadWahlen","parameters":[{"name":"forDate","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"withNummer","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlDTO"}}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahldaten/wahlbezirke/{wahlbezirkID}/wahlberechtigte":{"get":{"tags":["wahldaten-controller"],"operationId":"loadWahlberechtigte","parameters":[{"name":"wahlbezirkID","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WahlberechtigteDTO"}}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahldaten/wahlbezirk":{"get":{"tags":["wahldaten-controller"],"operationId":"loadWahlbezirke","parameters":[{"name":"forDate","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"withNummer","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlbezirkDTO"}}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/wahldaten/basisdaten":{"get":{"tags":["wahldaten-controller"],"operationId":"loadBasisdaten","parameters":[{"name":"forDate","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"withNummer","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/BasisdatenDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/vorschlaege/wahl/{wahlID}/{wahlbezirkID}":{"get":{"tags":["wahlvorschlag-controller"],"operationId":"loadWahlvorschlaege","parameters":[{"name":"wahlID","in":"path","required":true,"schema":{"type":"string"}},{"name":"wahlbezirkID","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/WahlvorschlaegeDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/vorschlaege/wahl/{wahlID}/liste":{"get":{"tags":["wahlvorschlag-controller"],"operationId":"loadWahlvorschlaegeListe","parameters":[{"name":"forDate","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"wahlID","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/WahlvorschlaegeListeDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}},"/vorschlaege/referendum/{wahlID}/{wahlbezirkID}":{"get":{"tags":["wahlvorschlag-controller"],"operationId":"loadReferendumvorlagen","parameters":[{"name":"wahlID","in":"path","required":true,"schema":{"type":"string"}},{"name":"wahlbezirkID","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ReferendumvorlagenDTO"}}}},"400":{"description":"request body validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}},"404":{"description":"resource not found"},"500":{"description":"unhandled error during communication with other system","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WlsExceptionDTO"}}}}}}}},"components":{"schemas":{"WahlvorstandsaktualisierungDTO":{"required":["anwesenheitBeginn","mitglieder","wahlbezirkID"],"type":"object","properties":{"wahlbezirkID":{"type":"string"},"mitglieder":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlvorstandsmitgliedAktualisierungDTO"}},"anwesenheitBeginn":{"type":"string","format":"date-time"}}},"WahlvorstandsmitgliedAktualisierungDTO":{"required":["anwesend","identifikator"],"type":"object","properties":{"identifikator":{"type":"string"},"anwesend":{"type":"boolean"}}},"DruckzustandDTO":{"required":["niederschriftDruckUhrzeit","niederschriftSendenUhrzeit","schnellmeldungDruckUhrzeit","schnellmeldungSendenUhrzeit","wahlID"],"type":"object","properties":{"wahlID":{"type":"string"},"schnellmeldungSendenUhrzeit":{"type":"string","format":"date-time"},"niederschriftSendenUhrzeit":{"type":"string","format":"date-time"},"schnellmeldungDruckUhrzeit":{"type":"string","format":"date-time"},"niederschriftDruckUhrzeit":{"type":"string","format":"date-time"}}},"WahllokalZustandDTO":{"required":["druckzustaende","letzteAbmeldung","wahlbezirkID","zuletztGesehen"],"type":"object","properties":{"wahlbezirkID":{"type":"string"},"zuletztGesehen":{"type":"string","format":"date-time"},"letzteAbmeldung":{"type":"string","format":"date-time"},"druckzustaende":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/DruckzustandDTO"}}}},"AWerteDTO":{"type":"object","properties":{"a1":{"type":"integer","format":"int64"},"a2":{"type":"integer","format":"int64"}}},"BWerteDTO":{"type":"object","properties":{"b":{"type":"integer","format":"int64"},"b1":{"type":"integer","format":"int64"},"b2":{"type":"integer","format":"int64"}}},"ErgebnisDTO":{"required":["ergebnis","kandidatID","stimmenart","wahlvorschlagID","wahlvorschlagsordnungszahl"],"type":"object","properties":{"stimmenart":{"type":"string"},"wahlvorschlagsordnungszahl":{"type":"integer","format":"int64"},"ergebnis":{"type":"integer","format":"int64"},"wahlvorschlagID":{"type":"string"},"kandidatID":{"type":"string"}}},"ErgebnismeldungDTO":{"required":["wahlID","wahlbezirkID"],"type":"object","properties":{"wahlbezirkID":{"type":"string"},"wahlID":{"type":"string"},"meldungsart":{"type":"string","enum":["NIEDERSCHRIFT","SCHNELLMELDUNG"]},"aWerte":{"$ref":"#/components/schemas/AWerteDTO"},"bWerte":{"$ref":"#/components/schemas/BWerteDTO"},"wahlbriefeWerte":{"$ref":"#/components/schemas/WahlbriefeWerteDTO"},"ungueltigeStimmzettels":{"type":"array","items":{"$ref":"#/components/schemas/UngueltigeStimmzettelDTO"}},"ungueltigeStimmzettelAnzahl":{"type":"integer","format":"int64"},"ergebnisse":{"type":"array","items":{"$ref":"#/components/schemas/ErgebnisDTO"}},"wahlart":{"type":"string","enum":["BAW","BEB","BTW","BZW","EUW","LTW","MBW","OBW","SRW","SVW","VE"]}}},"UngueltigeStimmzettelDTO":{"type":"object","properties":{"stimmenart":{"type":"string"},"anzahl":{"type":"integer","format":"int64"},"wahlvorschlagID":{"type":"string"}}},"WahlbriefeWerteDTO":{"type":"object","properties":{"zurueckgewiesenGesamt":{"type":"integer","format":"int64"}}},"WahlbeteiligungsMeldungDTO":{"required":["anzahlWaehler","meldeZeitpunkt","wahlID","wahlbezirkID"],"type":"object","properties":{"wahlID":{"type":"string"},"wahlbezirkID":{"type":"string"},"anzahlWaehler":{"type":"integer","format":"int64"},"meldeZeitpunkt":{"type":"string","format":"date-time"}}},"WahlvorstandDTO":{"required":["mitglieder","wahlbezirkID"],"type":"object","properties":{"wahlbezirkID":{"type":"string"},"mitglieder":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlvorstandsmitgliedDTO"}}}},"WahlvorstandsmitgliedDTO":{"required":["anwesend","funktion","identifikator","nachname","vorname"],"type":"object","properties":{"identifikator":{"type":"string"},"vorname":{"type":"string"},"nachname":{"type":"string"},"funktion":{"type":"string","enum":["W","SB","SWB","SSB","B"]},"anwesend":{"type":"boolean"}}},"WahltagDTO":{"required":["beschreibung","identifikator","nummer","tag"],"type":"object","properties":{"identifikator":{"type":"string"},"tag":{"type":"string","format":"date"},"beschreibung":{"type":"string"},"nummer":{"type":"string"}}},"WahlDTO":{"required":["identifikator","name","nummer","wahlart","wahltag"],"type":"object","properties":{"identifikator":{"type":"string"},"name":{"type":"string"},"wahlart":{"type":"string","enum":["BAW","BEB","BTW","BZW","EUW","LTW","MBW","OBW","SRW","SVW","VE"]},"wahltag":{"type":"string","format":"date"},"nummer":{"type":"string"}}},"WahlberechtigteDTO":{"required":["a1","a2","a3","wahlID","wahlbezirkID"],"type":"object","properties":{"wahlID":{"type":"string"},"wahlbezirkID":{"type":"string"},"a1":{"type":"integer","format":"int64"},"a2":{"type":"integer","format":"int64"},"a3":{"type":"integer","format":"int64"}}},"WahlbezirkDTO":{"required":["identifikator","nummer","wahlID","wahlbezirkArt","wahlnummer","wahltag"],"type":"object","properties":{"identifikator":{"type":"string"},"wahlbezirkArt":{"type":"string","enum":["UWB","BWB"]},"nummer":{"type":"string"},"wahltag":{"type":"string","format":"date"},"wahlnummer":{"type":"string"},"wahlID":{"type":"string"}}},"BasisdatenDTO":{"required":["basisstrukturdaten","stimmzettelgebiete","wahlbezirke","wahlen"],"type":"object","properties":{"basisstrukturdaten":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/BasisstrukturdatenDTO"}},"wahlen":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlDTO"}},"wahlbezirke":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlbezirkDTO"}},"stimmzettelgebiete":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/StimmzettelgebietDTO"}}}},"BasisstrukturdatenDTO":{"required":["stimmzettelgebietID","wahlID","wahlbezirkID","wahltag"],"type":"object","properties":{"wahlID":{"type":"string"},"stimmzettelgebietID":{"type":"string"},"wahlbezirkID":{"type":"string"},"wahltag":{"type":"string","format":"date"}}},"StimmzettelgebietDTO":{"required":["stimmzettelgebietsart"],"type":"object","properties":{"identifikator":{"type":"string"},"nummer":{"type":"string"},"name":{"type":"string"},"wahltag":{"type":"string","format":"date"},"stimmzettelgebietsart":{"type":"string","enum":["SB","SG","SK","WK"]}}},"KandidatDTO":{"required":["direktkandidat","einzelbewerber","identifikator","listenposition","name","tabellenSpalteInNiederschrift"],"type":"object","properties":{"identifikator":{"type":"string"},"name":{"type":"string"},"listenposition":{"type":"integer","format":"int64"},"direktkandidat":{"type":"boolean"},"tabellenSpalteInNiederschrift":{"type":"integer","format":"int64"},"einzelbewerber":{"type":"boolean"}}},"WahlvorschlaegeDTO":{"required":["stimmzettelgebietID","wahlID","wahlbezirkID","wahlvorschlaege"],"type":"object","properties":{"wahlbezirkID":{"type":"string"},"wahlID":{"type":"string"},"stimmzettelgebietID":{"type":"string"},"wahlvorschlaege":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlvorschlagDTO"}}}},"WahlvorschlagDTO":{"required":["erhaeltStimmen","identifikator","kurzname","ordnungszahl"],"type":"object","properties":{"identifikator":{"type":"string"},"ordnungszahl":{"type":"integer","format":"int64"},"kurzname":{"type":"string"},"erhaeltStimmen":{"type":"boolean"},"kandidaten":{"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/KandidatDTO"}}}},"WahlvorschlaegeListeDTO":{"required":["wahlID","wahlvorschlaegeliste"],"type":"object","properties":{"wahlID":{"type":"string"},"wahlvorschlaegeliste":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/WahlvorschlaegeDTO"}}}},"ReferendumoptionDTO":{"required":["id","name"],"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"position":{"type":"integer","format":"int64"}}},"ReferendumvorlageDTO":{"required":["frage","kurzname","ordnungszahl","referendumoptionen","wahlvorschlagID"],"type":"object","properties":{"wahlvorschlagID":{"type":"string"},"ordnungszahl":{"type":"integer","format":"int64"},"kurzname":{"type":"string"},"frage":{"type":"string"},"referendumoptionen":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/ReferendumoptionDTO"}}}},"ReferendumvorlagenDTO":{"required":["referendumvorlagen","stimmzettelgebietID"],"type":"object","properties":{"stimmzettelgebietID":{"type":"string"},"referendumvorlagen":{"maxItems":2147483647,"minItems":1,"uniqueItems":true,"type":"array","items":{"$ref":"#/components/schemas/ReferendumvorlageDTO"}}}},"WlsExceptionDTO":{"required":["category","code","message","service"],"type":"object","properties":{"category":{"type":"string","enum":["F","T","S","I"]},"code":{"type":"string"},"service":{"type":"string"},"message":{"type":"string"}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}}}
\ No newline at end of file
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/DummyClientImplTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/DummyClientImplTest.java
index b39c42dd2..7eaf7a40d 100644
--- a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/DummyClientImplTest.java
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/DummyClientImplTest.java
@@ -1,6 +1,7 @@
package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients;
import de.muenchen.oss.wahllokalsystem.wls.common.security.domain.BezirkUndWahlID;
+import java.time.LocalDate;
import lombok.val;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Nested;
@@ -20,4 +21,14 @@ void resultIsANonNullObject() {
Assertions.assertThat(result).hasNoNullFieldsOrProperties();
}
}
+
+ @Nested
+ class GetWahltage {
+
+ @Test
+ void resultIsAnArrayWithPositiveSize() {
+ val result = unitUnderTest.getWahltage(LocalDate.now().minusMonths(3));
+ Assertions.assertThat(result).size().isPositive();
+ }
+ }
}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientImplTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientImplTest.java
new file mode 100644
index 000000000..ad69c4d58
--- /dev/null
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientImplTest.java
@@ -0,0 +1,105 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients;
+
+import static org.mockito.ArgumentMatchers.any;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.client.WahldatenControllerApi;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.exception.ExceptionConstants;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModel;
+import de.muenchen.oss.wahllokalsystem.wls.common.exception.FachlicheWlsException;
+import de.muenchen.oss.wahllokalsystem.wls.common.exception.TechnischeWlsException;
+import de.muenchen.oss.wahllokalsystem.wls.common.exception.util.ExceptionFactory;
+import java.time.LocalDate;
+import java.util.List;
+import java.util.Set;
+import lombok.val;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.springframework.web.client.RestClientException;
+
+@ExtendWith(MockitoExtension.class)
+class WahltageClientImplTest {
+
+ @Mock
+ ExceptionFactory exceptionFactory;
+
+ @Mock
+ WahldatenControllerApi wahldatenControllerApi;
+
+ @Mock
+ WahltageClientMapper wahltageClientMapper;
+
+ @InjectMocks
+ WahltageClientImpl unitUnderTest;
+
+ @Nested
+ class GetWahltage {
+
+ @Test
+ void clientResponseIsMapped() {
+ val testDate = LocalDate.now().minusMonths(3);
+
+ val mockedClientResponse = createClientWahltageDTO();
+ val mockedMappedClientResponse = List.of(WahltagModel.builder().build());
+
+ Mockito.when(wahldatenControllerApi.loadWahltageSinceIncluding(testDate))
+ .thenReturn(mockedClientResponse);
+ Mockito.when(wahltageClientMapper.fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(mockedClientResponse))
+ .thenReturn(mockedMappedClientResponse);
+
+ val result = unitUnderTest.getWahltage(testDate);
+
+ Assertions.assertThat(result).isSameAs(mockedMappedClientResponse);
+ }
+
+ @Test
+ void exceptionWhenClientResponseIsNull() {
+ val mockedWlsException = FachlicheWlsException.withCode("").buildWithMessage("");
+
+ Mockito.when(wahldatenControllerApi.loadWahltageSinceIncluding(any())).thenReturn(null);
+ Mockito.when(exceptionFactory.createFachlicheWlsException(ExceptionConstants.NULL_FROM_CLIENT)).thenReturn(mockedWlsException);
+
+ Assertions.assertThatException().isThrownBy(() -> unitUnderTest.getWahltage(LocalDate.now())).isSameAs(mockedWlsException);
+ }
+
+ @Test
+ void controllerApiExceptionIsMapped() {
+ val testDate = LocalDate.now().minusMonths(3);
+ val mockedException = TechnischeWlsException.withCode("100")
+ .buildWithMessage("Bei der Kommunikation mit dem Aoueai-Service ist ein Fehler aufgetreten. Es konnten daher keine Daten geladen werden.");
+
+ Mockito.when(wahldatenControllerApi.loadWahltageSinceIncluding(any()))
+ .thenThrow(new RestClientException("error occurs while attempting to invoke the API"));
+ Mockito.when(exceptionFactory.createTechnischeWlsException(ExceptionConstants.FAILED_COMMUNICATION_WITH_EAI)).thenThrow(mockedException);
+ Assertions.assertThatException().isThrownBy(() -> unitUnderTest.getWahltage(testDate)).isSameAs(mockedException);
+ }
+
+ private Set createClientWahltageDTO() {
+
+ val wahltag1 = new de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO();
+ wahltag1.setIdentifikator("identifikatorWahltag1");
+ wahltag1.setBeschreibung("beschreibungWahltag1");
+ wahltag1.setNummer("nummerWahltag1");
+ wahltag1.setTag(LocalDate.now().minusMonths(2));
+
+ val wahltag2 = new de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO();
+ wahltag2.setIdentifikator("identifikatorWahltag2");
+ wahltag2.setBeschreibung("beschreibungWahltag2");
+ wahltag2.setNummer("nummerWahltag2");
+ wahltag2.setTag(LocalDate.now().minusMonths(1));
+
+ val wahltag3 = new WahltagDTO();
+ wahltag3.setIdentifikator("identifikatorWahltag3");
+ wahltag3.setBeschreibung("beschreibungWahltag3");
+ wahltag3.setNummer("nummerWahltag3");
+ wahltag3.setTag(LocalDate.now().plusMonths(1));
+
+ return Set.of(wahltag1, wahltag2, wahltag3);
+ }
+ }
+}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientMapperTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientMapperTest.java
new file mode 100644
index 000000000..cdccb46e4
--- /dev/null
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientMapperTest.java
@@ -0,0 +1,91 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients;
+
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModel;
+import java.time.LocalDate;
+import java.util.List;
+import java.util.Set;
+import lombok.val;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.mapstruct.factory.Mappers;
+
+class WahltageClientMapperTest {
+
+ private final WahltageClientMapper unitUnderTest = Mappers.getMapper(WahltageClientMapper.class);
+
+ @Nested
+ class ToWahltagModel {
+
+ @Test
+ void isMapped() {
+ val dtoToMap = new WahltagDTO();
+ dtoToMap.setIdentifikator("identifikatorWahltag1");
+ dtoToMap.setBeschreibung("beschreibungWahltag1");
+ dtoToMap.setNummer("nummerWahltag1");
+ dtoToMap.setTag(LocalDate.now().minusMonths(2));
+
+ Assertions.assertThat(dtoToMap).hasNoNullFieldsOrProperties();
+
+ val result = unitUnderTest.toWahltagModel(dtoToMap);
+
+ val expectedWahltag = new WahltagModel(
+ "identifikatorWahltag1",
+ LocalDate.now().minusMonths(2),
+ "beschreibungWahltag1",
+ "nummerWahltag1");
+
+ Assertions.assertThat(result).usingRecursiveComparison().isEqualTo(expectedWahltag);
+ }
+
+ }
+
+ @Nested
+ class FromRemoteClientWahltageDTOtoListOfWahltagModel {
+
+ @Test
+ void isMapped() {
+ val wahltag1 = new WahltagDTO();
+ wahltag1.setIdentifikator("identifikatorWahltag1");
+ wahltag1.setBeschreibung("beschreibungWahltag1");
+ wahltag1.setNummer("nummerWahltag1");
+ wahltag1.setTag(LocalDate.now().minusMonths(2));
+
+ val wahltag2 = new WahltagDTO();
+ wahltag2.setIdentifikator("identifikatorWahltag2");
+ wahltag2.setBeschreibung("beschreibungWahltag2");
+ wahltag2.setNummer("nummerWahltag2");
+ wahltag2.setTag(LocalDate.now().minusMonths(1));
+
+ val wahltag3 = new WahltagDTO();
+ wahltag3.setIdentifikator("identifikatorWahltag3");
+ wahltag3.setBeschreibung("beschreibungWahltag3");
+ wahltag3.setNummer("nummerWahltag3");
+ wahltag3.setTag(LocalDate.now().plusMonths(1));
+
+ val dtoToMap = Set.of(wahltag1, wahltag2, wahltag3);
+
+ Assertions.assertThat(dtoToMap).size().isEqualTo(3);
+ dtoToMap.forEach(wahltag -> Assertions.assertThat(wahltag).hasNoNullFieldsOrProperties());
+
+ val result = unitUnderTest.fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(dtoToMap);
+
+ val expectedWahltage = List.of(
+ new WahltagModel("identifikatorWahltag1",
+ LocalDate.now().minusMonths(2),
+ "beschreibungWahltag1",
+ "nummerWahltag1"),
+ new WahltagModel("identifikatorWahltag2",
+ LocalDate.now().minusMonths(1),
+ "beschreibungWahltag2",
+ "nummerWahltag2"),
+ new WahltagModel("identifikatorWahltag3",
+ LocalDate.now().plusMonths(1),
+ "beschreibungWahltag3",
+ "nummerWahltag3"));
+
+ Assertions.assertThat(result).containsExactlyInAnyOrderElementsOf(expectedWahltage);
+ }
+ }
+}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/ClientImplTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahlvorschlaegeClientImplTest.java
similarity index 97%
rename from wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/ClientImplTest.java
rename to wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahlvorschlaegeClientImplTest.java
index fa4982b75..ea66ac33a 100644
--- a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/ClientImplTest.java
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahlvorschlaegeClientImplTest.java
@@ -21,7 +21,7 @@
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
-class ClientImplTest {
+class WahlvorschlaegeClientImplTest {
@Mock
ExceptionFactory exceptionFactory;
@@ -33,7 +33,7 @@ class ClientImplTest {
WahlvorschlaegeClientMapper wahlvorschlaegeClientMapper;
@InjectMocks
- ClientImpl unitUnderTest;
+ WahlvorschlaegeClientImpl unitUnderTest;
@Nested
class GetWahlvorschlaege {
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/SecurityConfigurationTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/SecurityConfigurationTest.java
index ee6181c6c..47bd35573 100644
--- a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/SecurityConfigurationTest.java
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/SecurityConfigurationTest.java
@@ -8,6 +8,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.MicroServiceApplication;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltageService;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.handbuch.HandbuchService;
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.WahlvorschlaegeService;
import org.junit.jupiter.api.Nested;
@@ -34,6 +35,9 @@ class SecurityConfigurationTest {
@MockBean
WahlvorschlaegeService wahlvorschlaegeService;
+ @MockBean
+ WahltageService wahltageService;
+
@MockBean
HandbuchService handbuchService;
@@ -90,11 +94,27 @@ void accessGetWahlvorstaendeUnauthorizedThenUnauthorized() throws Exception {
@Test
@WithMockUser
- void accessGetWahlvorstaendeUnauthorizedThenOk() throws Exception {
+ void accessGetWahlvorschlaegeUnauthorizedThenOk() throws Exception {
api.perform(get("/businessActions/wahlvorschlaege/wahlID/wahlbezirkID")).andExpect(status().isOk());
}
}
+ @Nested
+ class Wahltage {
+
+ @Test
+ @WithAnonymousUser
+ void accessGetWahltageUnauthorizedThenUnauthorized() throws Exception {
+ api.perform(get("/businessActions/wahltage")).andExpect(status().isUnauthorized());
+ }
+
+ @Test
+ @WithMockUser
+ void accessGetWahltageUnauthorizedThenOk() throws Exception {
+ api.perform(get("/businessActions/wahltage")).andExpect(status().isOk());
+ }
+ }
+
@Nested
class Handbuch {
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/WahltagRepositoryTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/WahltagRepositoryTest.java
new file mode 100644
index 000000000..0b2479b1d
--- /dev/null
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/WahltagRepositoryTest.java
@@ -0,0 +1,61 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain;
+
+import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.SPRING_NO_SECURITY_PROFILE;
+import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.SPRING_TEST_PROFILE;
+
+import java.time.LocalDate;
+import java.util.Arrays;
+import lombok.val;
+import org.assertj.core.api.Assertions;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.MicroServiceApplication;
+import java.util.Comparator;
+import java.util.List;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+
+@SpringBootTest(
+ classes = { MicroServiceApplication.class },
+ webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
+)
+@ActiveProfiles(profiles = { SPRING_TEST_PROFILE, SPRING_NO_SECURITY_PROFILE })
+@Slf4j
+class WahltagRepositoryTest {
+
+ @Autowired
+ private WahltagRepository repository;
+
+ @AfterEach
+ void tearDown() {
+ repository.deleteAll();
+ }
+
+ /**
+ * Tests if searched returned Wahltags are right sorted
+ */
+ @Test
+ void findAllByOrderByWahltagAsc() {
+ List wahltageToSave = createWahltagList();
+ repository.saveAll(wahltageToSave);
+ List foundWahltage = repository.findAllByOrderByWahltagAsc();
+
+ wahltageToSave.sort(
+ Comparator
+ .comparing(Wahltag::getWahltag)
+ .thenComparing(Wahltag::getWahltag));
+
+ Assertions.assertThat(wahltageToSave).isEqualTo(foundWahltage);
+ }
+
+ private List createWahltagList() {
+ val wahltag4 = new Wahltag("_identifikatorWahltag4", LocalDate.now().plusMonths(5), "beschreibungWahltag4", "nummerWahltag4");
+ val wahltag1 = new Wahltag("_identifikatorWahltag1", LocalDate.now().minusMonths(2), "beschreibungWahltag1", "nummerWahltag1");
+ val wahltag3 = new Wahltag("_identifikatorWahltag3", LocalDate.now().plusMonths(1), "beschreibungWahltag3", "nummerWahltag3");
+ val wahltag2 = new Wahltag("_identifikatorWahltag2", LocalDate.now().minusMonths(1), "beschreibungWahltag2", "nummerWahltag2");
+
+ return Arrays.asList(wahltag4, wahltag1, wahltag3, wahltag2);
+ }
+}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageControllerIntegrationTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageControllerIntegrationTest.java
new file mode 100644
index 000000000..be01e71f3
--- /dev/null
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageControllerIntegrationTest.java
@@ -0,0 +1,210 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahltage;
+
+import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.SPRING_NO_SECURITY_PROFILE;
+import static de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants.SPRING_TEST_PROFILE;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.tomakehurst.wiremock.client.WireMock;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.MicroServiceApplication;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.clients.WahltageClientMapper;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.KandidatRepository;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.Wahltag;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.WahltagRepository;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.WahlvorschlagRepository;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.exception.ExceptionConstants;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModelMapper;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.utils.Authorities;
+import de.muenchen.oss.wahllokalsystem.wls.common.exception.rest.model.WlsExceptionCategory;
+import de.muenchen.oss.wahllokalsystem.wls.common.exception.rest.model.WlsExceptionDTO;
+import de.muenchen.oss.wahllokalsystem.wls.common.testing.SecurityUtils;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import lombok.val;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
+import org.springframework.http.HttpStatus;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.transaction.annotation.Transactional;
+
+@SpringBootTest(classes = MicroServiceApplication.class, webEnvironment = SpringBootTest.WebEnvironment.MOCK)
+@AutoConfigureMockMvc
+@AutoConfigureWireMock
+@ActiveProfiles(profiles = { SPRING_TEST_PROFILE, SPRING_NO_SECURITY_PROFILE })
+public class WahltageControllerIntegrationTest {
+
+ @Value("${service.info.oid}")
+ String serviceID;
+
+ @Autowired
+ MockMvc api;
+
+ @Autowired
+ ObjectMapper objectMapper;
+
+ @Autowired
+ WahltageDTOMapper dtoMapper;
+
+ @Autowired
+ WahltagModelMapper modelMapper;
+
+ @Autowired
+ WahltageClientMapper wahltageClientMapper;
+
+ @Autowired
+ WahltagRepository wahltagRepository;
+
+ @Autowired
+ WahlvorschlagRepository wahlvorschlagRepository;
+
+ @Autowired
+ KandidatRepository kandidatRepository;
+
+ @AfterEach
+ void tearDown() {
+ SecurityUtils.runWith(Authorities.ALL_AUTHORITIES_DELETE_WAHLTAGE);
+ wahltagRepository.deleteAll();
+ }
+
+ @BeforeEach
+ void setup() {
+ WireMock.resetAllRequests();
+ }
+
+ @Nested
+ class GetWahltage {
+
+ @Test
+ void loadedFromExternal() throws Exception {
+ val requestDate = LocalDate.now().minusMonths(3).toString();
+
+ val eaiWahltage = createClientWahltageDTO(false);
+ WireMock.stubFor(WireMock.get("/wahldaten/wahltage?includingSince=" + requestDate)
+ .willReturn(WireMock.aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value())
+ .withBody(objectMapper.writeValueAsBytes(eaiWahltage))));
+
+ val request = MockMvcRequestBuilders.get("/businessActions/wahltage");
+
+ val responseFromController = api.perform(request).andExpect(status().isOk()).andReturn();
+ val responseBodyAsDTO = objectMapper.readValue(responseFromController.getResponse().getContentAsString(),
+ de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahltage.WahltagDTO[].class);
+
+ val expectedResponseBody = dtoMapper
+ .fromListOfWahltagModelToListOfWahltagDTO(wahltageClientMapper.fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(eaiWahltage));
+
+ Assertions.assertThat(responseBodyAsDTO).containsExactlyInAnyOrderElementsOf(expectedResponseBody);
+ }
+
+ @Test
+ @Transactional
+ void externalDataIsPersisted() throws Exception {
+ val requestDate = LocalDate.now().minusMonths(3).toString();
+
+ val eaiWahltage = createClientWahltageDTO(false);
+ WireMock.stubFor(WireMock.get("/wahldaten/wahltage?includingSince=" + requestDate)
+ .willReturn(WireMock.aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value())
+ .withBody(objectMapper.writeValueAsBytes(eaiWahltage))));
+
+ val request = MockMvcRequestBuilders.get("/businessActions/wahltage");
+
+ api.perform(request).andExpect(status().isOk());
+
+ val dataFromRepo = wahltagRepository.findAllByOrderByWahltagAsc();
+
+ val expectedListOfData = modelMapper.fromWahltagModelToWahltagEntityList(
+ wahltageClientMapper.fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(eaiWahltage));
+
+ Assertions.assertThat(dataFromRepo)
+ .usingRecursiveComparison().ignoringCollectionOrder()
+ .isEqualTo(expectedListOfData);
+ }
+
+ @Test
+ void loadFromRemoteFirstAndThanUpdateRepository() throws Exception {
+ val entitiesToFindInRepository = modelMapper
+ .fromWahltagModelToWahltagEntityList(wahltageClientMapper
+ .fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(createClientWahltageDTO(true)));
+ val savedEntitiesInRepository_1 = wahltagRepository.saveAll(entitiesToFindInRepository);
+
+ val request = MockMvcRequestBuilders.get("/businessActions/wahltage");
+
+ val responseFromController = api.perform(request).andExpect(status().isOk()).andReturn();
+ val responseBodyAsListOfDTOs = objectMapper.readValue(responseFromController.getResponse().getContentAsString(),
+ de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahltage.WahltagDTO[].class);
+
+ WireMock.verify(1, WireMock.anyRequestedFor(WireMock.anyUrl()));
+
+ val expectedResponseBody_1 = dtoMapper.fromListOfWahltagModelToListOfWahltagDTO(
+ modelMapper.fromWahltagEntityToWahltagModelList((List) savedEntitiesInRepository_1));
+
+ Assertions.assertThat(new ArrayList<>(Arrays.asList(responseBodyAsListOfDTOs)))
+ .usingRecursiveComparison().ignoringCollectionOrder()
+ .ignoringFields("beschreibung")
+ .isEqualTo(expectedResponseBody_1);
+
+ Assertions.assertThat(new ArrayList<>(Arrays.asList(responseBodyAsListOfDTOs)))
+ .usingRecursiveComparison().ignoringCollectionOrder()
+ .isNotEqualTo(expectedResponseBody_1);
+
+ val expectedResponseBody_2 = dtoMapper.fromListOfWahltagModelToListOfWahltagDTO(
+ modelMapper.fromWahltagEntityToWahltagModelList(wahltagRepository.findAllByOrderByWahltagAsc()));
+
+ Assertions.assertThat(responseBodyAsListOfDTOs).containsExactlyInAnyOrderElementsOf(expectedResponseBody_2);
+ }
+
+ @Test
+ void technischeWlsExceptionWhenNoExternalDataFound() throws Exception {
+ val requestDate = LocalDate.now().minusMonths(3).toString();
+
+ WireMock.stubFor(WireMock.get("/wahldaten/wahltage?includingSince=" + requestDate)
+ .willReturn(WireMock.aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.NOT_FOUND.value())));
+
+ val request = MockMvcRequestBuilders.get("/businessActions/wahltage");
+
+ val response = api.perform(request).andExpect(status().isInternalServerError()).andReturn();
+ val responseBodyAsWlsExceptionDTO = objectMapper.readValue(response.getResponse().getContentAsString(), WlsExceptionDTO.class);
+
+ val expectedWlsExceptionDTO = new WlsExceptionDTO(WlsExceptionCategory.T,
+ ExceptionConstants.FAILED_COMMUNICATION_WITH_EAI.code(), serviceID,
+ ExceptionConstants.FAILED_COMMUNICATION_WITH_EAI.message());
+ Assertions.assertThat(responseBodyAsWlsExceptionDTO).isEqualTo(expectedWlsExceptionDTO);
+ }
+ }
+
+ private Set createClientWahltageDTO(
+ boolean beschreibungPartPreNumber) {
+
+ val wahltag1 = new de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO();
+ wahltag1.setIdentifikator("identifikatorWahltag1");
+ wahltag1.setBeschreibung((beschreibungPartPreNumber) ? "diff_beschreibungWahltag1" : "beschreibungWahltag1");
+ wahltag1.setNummer("nummerWahltag1");
+ wahltag1.setTag(LocalDate.now().minusMonths(2));
+
+ val wahltag2 = new de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO();
+ wahltag2.setIdentifikator("identifikatorWahltag2");
+ wahltag2.setBeschreibung((beschreibungPartPreNumber) ? "diff_beschreibungWahltag2" : "beschreibungWahltag2");
+ wahltag2.setNummer("nummerWahltag2");
+ wahltag2.setTag(LocalDate.now().minusMonths(1));
+
+ val wahltag3 = new WahltagDTO();
+ wahltag3.setIdentifikator("identifikatorWahltag3");
+ wahltag3.setBeschreibung((beschreibungPartPreNumber) ? "diff_beschreibungWahltag3" : "beschreibungWahltag3");
+ wahltag3.setNummer("nummerWahltag3");
+ wahltag3.setTag(LocalDate.now().plusMonths(1));
+
+ return Set.of(wahltag1, wahltag2, wahltag3);
+ }
+}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageControllerTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageControllerTest.java
new file mode 100644
index 000000000..86a5c70e8
--- /dev/null
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageControllerTest.java
@@ -0,0 +1,51 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahltage;
+
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModel;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltageService;
+import java.util.List;
+import lombok.val;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+@ExtendWith(MockitoExtension.class)
+class WahltageControllerTest {
+
+ @Mock
+ WahltageService wahltageService;
+
+ @Mock
+ WahltageDTOMapper wahltageDTOMapper;
+
+ @InjectMocks
+ WahltageController wahltageController;
+
+ @Nested
+ class GetWahltage {
+
+ @Test
+ void serviceIsCalledAndObjectsAreMapped() {
+ val wahltagModels = List.of(
+ WahltagModel.builder().build(),
+ WahltagModel.builder().build(),
+ WahltagModel.builder().build());
+
+ val wahltagDTOs = List.of(
+ WahltagDTO.builder().build(),
+ WahltagDTO.builder().build(),
+ WahltagDTO.builder().build());
+
+ Mockito.when(wahltageService.getWahltage()).thenReturn(wahltagModels);
+ Mockito.when(wahltageDTOMapper.fromListOfWahltagModelToListOfWahltagDTO(wahltagModels)).thenReturn(wahltagDTOs);
+
+ val result = wahltageController.getWahltage();
+
+ Assertions.assertThat(result).isEqualTo(wahltagDTOs);
+ }
+ }
+}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageDTOMapperTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageDTOMapperTest.java
new file mode 100644
index 000000000..0dbd33b6c
--- /dev/null
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltage/WahltageDTOMapperTest.java
@@ -0,0 +1,49 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahltage;
+
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModel;
+import java.time.LocalDate;
+import java.util.List;
+import lombok.val;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.mapstruct.factory.Mappers;
+
+class WahltageDTOMapperTest {
+
+ private final WahltageDTOMapper unitUnderTest = Mappers.getMapper(WahltageDTOMapper.class);
+
+ @Nested
+ class FromListOfWahltagModelToListOfWahltagDTO {
+
+ @Test
+ void nullInNullOut() {
+ Assertions.assertThat(unitUnderTest.fromListOfWahltagModelToListOfWahltagDTO(null)).isNull();
+ }
+
+ @Test
+ void isMappedToDTO() {
+ val modelsInput = createClientWahltagModels();
+ val dtosExpected = createClientWahltagDTOs();
+
+ val result = unitUnderTest.fromListOfWahltagModelToListOfWahltagDTO(modelsInput);
+ Assertions.assertThat(result).isEqualTo(dtosExpected);
+ }
+
+ private List createClientWahltagDTOs() {
+ val wahltag1 = new WahltagDTO("identifikatorWahltag1", LocalDate.now().minusMonths(2), "beschreibungWahltag1", "nummerWahltag1");
+ val wahltag2 = new WahltagDTO("identifikatorWahltag2", LocalDate.now().minusMonths(1), "beschreibungWahltag2", "nummerWahltag2");
+ val wahltag3 = new WahltagDTO("identifikatorWahltag3", LocalDate.now().plusMonths(1), "beschreibungWahltag3", "nummerWahltag3");
+
+ return List.of(wahltag1, wahltag2, wahltag3);
+ }
+
+ private List createClientWahltagModels() {
+ val wahltag1 = new WahltagModel("identifikatorWahltag1", LocalDate.now().minusMonths(2), "beschreibungWahltag1", "nummerWahltag1");
+ val wahltag2 = new WahltagModel("identifikatorWahltag2", LocalDate.now().minusMonths(1), "beschreibungWahltag2", "nummerWahltag2");
+ val wahltag3 = new WahltagModel("identifikatorWahltag3", LocalDate.now().plusMonths(1), "beschreibungWahltag3", "nummerWahltag3");
+
+ return List.of(wahltag1, wahltag2, wahltag3);
+ }
+ }
+}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltagModelMapperTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltagModelMapperTest.java
new file mode 100644
index 000000000..af8fbab2a
--- /dev/null
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltagModelMapperTest.java
@@ -0,0 +1,50 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag;
+
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.Wahltag;
+import java.time.LocalDate;
+import java.util.List;
+import lombok.val;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.mapstruct.factory.Mappers;
+
+class WahltagModelMapperTest {
+
+ private final WahltagModelMapper unitUnderTest = Mappers.getMapper(WahltagModelMapper.class);
+
+ @Test
+ void fromWahltagModelToWahltagEntityList() {
+ val modelsToMap = createWahltagModelList();
+
+ val result = unitUnderTest.fromWahltagModelToWahltagEntityList(modelsToMap);
+
+ val expectedResult = createWahltagList();
+ Assertions.assertThat(result).isEqualTo(expectedResult);
+ }
+
+ @Test
+ void fromWahltagEntityToWahltagModelList() {
+ val entitiesToMap = createWahltagList();
+
+ val result = unitUnderTest.fromWahltagEntityToWahltagModelList(entitiesToMap);
+
+ val expectedResult = createWahltagModelList();
+ Assertions.assertThat(result).isEqualTo(expectedResult);
+ }
+
+ private List createWahltagList() {
+ val wahltag1 = new Wahltag("identifikatorWahltag1", LocalDate.now().minusMonths(2), "beschreibungWahltag1", "nummerWahltag1");
+ val wahltag2 = new Wahltag("identifikatorWahltag2", LocalDate.now().minusMonths(1), "beschreibungWahltag2", "nummerWahltag2");
+ val wahltag3 = new Wahltag("identifikatorWahltag3", LocalDate.now().plusMonths(1), "beschreibungWahltag3", "nummerWahltag3");
+
+ return List.of(wahltag1, wahltag2, wahltag3);
+ }
+
+ private List createWahltagModelList() {
+ val wahltag1 = new WahltagModel("identifikatorWahltag1", LocalDate.now().minusMonths(2), "beschreibungWahltag1", "nummerWahltag1");
+ val wahltag2 = new WahltagModel("identifikatorWahltag2", LocalDate.now().minusMonths(1), "beschreibungWahltag2", "nummerWahltag2");
+ val wahltag3 = new WahltagModel("identifikatorWahltag3", LocalDate.now().plusMonths(1), "beschreibungWahltag3", "nummerWahltag3");
+
+ return List.of(wahltag1, wahltag2, wahltag3);
+ }
+}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageServiceSecurityTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageServiceSecurityTest.java
new file mode 100644
index 000000000..e7b79c031
--- /dev/null
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageServiceSecurityTest.java
@@ -0,0 +1,110 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.tomakehurst.wiremock.client.WireMock;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.MicroServiceApplication;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.TestConstants;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.WahltagRepository;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.utils.Authorities;
+import de.muenchen.oss.wahllokalsystem.wls.common.testing.SecurityUtils;
+import java.time.LocalDate;
+import java.util.Set;
+import java.util.stream.Stream;
+import lombok.val;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.aggregator.ArgumentsAccessor;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.test.context.ActiveProfiles;
+
+@SpringBootTest(classes = MicroServiceApplication.class)
+@ActiveProfiles(TestConstants.SPRING_TEST_PROFILE)
+@AutoConfigureWireMock
+public class WahltageServiceSecurityTest {
+
+ @Autowired
+ WahltageService wahltageService;
+
+ @Autowired
+ WahltagRepository wahltagRepository;
+
+ @Autowired
+ ObjectMapper objectMapper;
+
+ @Nested
+ class GetWahltage {
+
+ @AfterEach
+ void tearDown() {
+ SecurityUtils.runWith(Authorities.ALL_AUTHORITIES_DELETE_WAHLTAGE);
+ wahltagRepository.deleteAll();
+ }
+
+ @Test
+ void accessGranted() throws Exception {
+ SecurityUtils.runWith(Authorities.ALL_AUTHORITIES_GET_WAHLTAGE);
+
+ String requestDate = LocalDate.now().minusMonths(3).toString();
+ val eaiWahltage = createClientWahltageDTO();
+
+ WireMock.stubFor(WireMock.get("/wahldaten/wahltage?includingSince=" + requestDate)
+ .willReturn(WireMock.aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value())
+ .withBody(objectMapper.writeValueAsBytes(eaiWahltage))));
+
+ Assertions.assertThatNoException().isThrownBy(() -> wahltageService.getWahltage());
+ }
+
+ @ParameterizedTest(name = "{index} - {1} missing")
+ @MethodSource("getMissingAuthoritiesVariations")
+ void missingAuthorityCausesFailWithAccessDenied(final ArgumentsAccessor argumentsAccessor) throws Exception {
+ SecurityUtils.runWith(argumentsAccessor.get(0, String[].class));
+
+ String requestDate = LocalDate.now().minusMonths(3).toString();
+ val eaiWahltage = createClientWahltageDTO();
+
+ WireMock.stubFor(WireMock.get("/wahldaten/wahltage?includingSince=" + requestDate)
+ .willReturn(WireMock.aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.OK.value())
+ .withBody(objectMapper.writeValueAsBytes(eaiWahltage))));
+
+ Assertions.assertThatException().isThrownBy(() -> wahltageService.getWahltage())
+ .isInstanceOf(
+ AccessDeniedException.class);
+ }
+
+ private static Stream getMissingAuthoritiesVariations() {
+ return SecurityUtils.buildArgumentsForMissingAuthoritiesVariations(Authorities.ALL_AUTHORITIES_DELETE_WAHLTAGE);
+ }
+
+ private Set createClientWahltageDTO() {
+ val wahltag1 = new WahltagDTO();
+ wahltag1.setIdentifikator("identifikatorWahltag1");
+ wahltag1.setBeschreibung("beschreibungWahltag1");
+ wahltag1.setNummer("nummerWahltag1");
+ wahltag1.setTag(LocalDate.now().minusMonths(2));
+
+ val wahltag2 = new WahltagDTO();
+ wahltag2.setIdentifikator("identifikatorWahltag2");
+ wahltag2.setBeschreibung("beschreibungWahltag2");
+ wahltag2.setNummer("nummerWahltag2");
+ wahltag2.setTag(LocalDate.now().minusMonths(1));
+
+ val wahltag3 = new WahltagDTO();
+ wahltag3.setIdentifikator("identifikatorWahltag3");
+ wahltag3.setBeschreibung("beschreibungWahltag3");
+ wahltag3.setNummer("nummerWahltag3");
+ wahltag3.setTag(LocalDate.now().plusMonths(1));
+
+ return Set.of(wahltag3, wahltag2, wahltag1);
+ }
+ }
+}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageServiceTest.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageServiceTest.java
new file mode 100644
index 000000000..3cb0cd932
--- /dev/null
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahltag/WahltageServiceTest.java
@@ -0,0 +1,69 @@
+package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag;
+
+import org.assertj.core.api.Assertions;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.Wahltag;
+import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.WahltagRepository;
+import java.time.LocalDate;
+import java.util.List;
+import lombok.val;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+@ExtendWith(MockitoExtension.class)
+class WahltageServiceTest {
+
+ @Mock
+ WahltagRepository wahltagRepository;
+ @Mock
+ WahltagModelMapper wahltagModelMapper;
+ @Mock
+ WahltageClient wahltageClient;
+
+ @InjectMocks
+ WahltageService unitUnderTest;
+
+ @Nested
+ class GetWahltage {
+
+ @Test
+ void dataIsLoadedFromRemoteEvenIfExistingInRepoAndRepoIsUpdated() {
+ val mockedListOfEntities = createWahltagList("2");
+ val mockedClientResponse = createWahltagModelList("2");
+ val mockedMappedSavedEntities = createWahltagModelList("2");
+
+ Mockito.when(wahltageClient.getWahltage(LocalDate.now().minusMonths(3))).thenReturn(mockedClientResponse);
+ Mockito.when(wahltagModelMapper.fromWahltagModelToWahltagEntityList(mockedClientResponse)).thenReturn(mockedListOfEntities);
+ Mockito.when(wahltagRepository.findAllByOrderByWahltagAsc()).thenReturn(mockedListOfEntities);
+ Mockito.when(wahltagModelMapper.fromWahltagEntityToWahltagModelList(mockedListOfEntities)).thenReturn(mockedMappedSavedEntities);
+
+ val result = unitUnderTest.getWahltage();
+ Assertions.assertThat(result).isSameAs(mockedMappedSavedEntities);
+ Mockito.verify(wahltagRepository).saveAll(mockedListOfEntities);
+
+ }
+
+ private List createWahltagList(String wahltagIDPrefix) {
+ val wahltag1 = new Wahltag(wahltagIDPrefix + "_identifikatorWahltag1", LocalDate.now().minusMonths(2), "beschreibungWahltag1", "nummerWahltag1");
+ val wahltag2 = new Wahltag(wahltagIDPrefix + "_identifikatorWahltag2", LocalDate.now().minusMonths(1), "beschreibungWahltag2", "nummerWahltag2");
+ val wahltag3 = new Wahltag(wahltagIDPrefix + "_identifikatorWahltag3", LocalDate.now().plusMonths(1), "beschreibungWahltag3", "nummerWahltag3");
+
+ return List.of(wahltag1, wahltag2, wahltag3);
+ }
+
+ private List createWahltagModelList(String wahltagIDPrefix) {
+ val wahltag1 = new WahltagModel(wahltagIDPrefix + "_identifikatorWahltag1", LocalDate.now().minusMonths(2), "beschreibungWahltag1",
+ "nummerWahltag1");
+ val wahltag2 = new WahltagModel(wahltagIDPrefix + "_identifikatorWahltag2", LocalDate.now().minusMonths(1), "beschreibungWahltag2",
+ "nummerWahltag2");
+ val wahltag3 = new WahltagModel(wahltagIDPrefix + "_identifikatorWahltag3", LocalDate.now().plusMonths(1), "beschreibungWahltag3",
+ "nummerWahltag3");
+
+ return List.of(wahltag1, wahltag2, wahltag3);
+ }
+ }
+}
diff --git a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/utils/Authorities.java b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/utils/Authorities.java
index fe4f7f709..adbca30a6 100644
--- a/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/utils/Authorities.java
+++ b/wls-basisdaten-service/src/test/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/utils/Authorities.java
@@ -7,6 +7,7 @@
public class Authorities {
public static final String SERVICE_GET_WAHLVORSCHLAEGE = "Basisdaten_BUSINESSACTION_GetWahlvorschlaege";
+ public static final String SERVICE_GET_WAHLTAGE = "Basisdaten_BUSINESSACTION_GetWahltage";
public static final String SERVICE_GET_HANDBUCH = "Basisdaten_BUSINESSACTION_GetHandbuch";
public static final String SERVICE_POST_HANDBUCH = "Basisdaten_BUSINESSACTION_PostHandbuch";
@@ -23,6 +24,10 @@ public class Authorities {
public static final String REPOSITORY_WRITE_KANDIDAT = "Basisdaten_WRITE_Kandidat";
public static final String REPOSITORY_DELETE_KANDIDAT = "Basisdaten_DELETE_Kandidat";
+ public static final String REPOSITORY_READ_WAHLTAG = "Basisdaten_READ_Wahltag";
+ public static final String REPOSITORY_DELETE_WAHLTAG = "Basisdaten_DELETE_Wahltag";
+ public static final String REPOSITORY_WRITE_WAHLTAG = "Basisdaten_WRITE_Wahltag";
+
public static final String REPOSITORY_READ_HANDBUCH = "Basisdaten_READ_Handbuch";
public static final String REPOSITORY_WRITE_HANDBUCH = "Basisdaten_WRITE_Handbuch";
public static final String REPOSITORY_DELETE_HANDBUCH = "Basisdaten_DELETE_Handbuch";
@@ -52,4 +57,19 @@ public class Authorities {
REPOSITORY_WRITE_HANDBUCH
};
+ public static final String[] ALL_AUTHORITIES_GET_WAHLTAGE = new String[] {
+ SERVICE_GET_WAHLTAGE,
+ REPOSITORY_READ_WAHLTAG,
+ REPOSITORY_WRITE_WAHLTAG
+ };
+ public static final String[] ALL_AUTHORITIES_SET_WAHLTAGE = new String[] {
+ SERVICE_GET_WAHLTAGE,
+ REPOSITORY_READ_WAHLTAG,
+ REPOSITORY_WRITE_WAHLTAG
+ };
+
+ public static final String[] ALL_AUTHORITIES_DELETE_WAHLTAGE = new String[] {
+ REPOSITORY_DELETE_WAHLTAG
+ };
+
}
diff --git a/wls-basisdaten-service/src/test/resources/wahltage.http b/wls-basisdaten-service/src/test/resources/wahltage.http
new file mode 100644
index 000000000..6cac6bd5b
--- /dev/null
+++ b/wls-basisdaten-service/src/test/resources/wahltage.http
@@ -0,0 +1,22 @@
+### Get token wls_all
+POST {{ SSO_URL }}/auth/realms/wls_realm/protocol/openid-connect/token
+Content-Type: application/x-www-form-urlencoded
+
+password = test &
+grant_type = password &
+client_secret = top-secret &
+client_id = wls &
+username = wls_all
+
+> {%
+ client.global.set("auth_token", response.body.access_token);
+ client.global.set("token_type", response.body.token_type);
+%}
+
+### get userinfo with auth_token
+GET {{ SSO_URL }}/auth/realms/wls_realm/protocol/openid-connect/userinfo
+Authorization: {{ token_type }} {{ auth_token }}
+
+### Get Basisdaten - working with dummy.client
+GET {{ WLS_BASISDATEN_SERVICE_URL }}/businessActions/wahltage
+Authorization: {{ token_type }} {{ auth_token }}
\ No newline at end of file