diff --git a/wls-basisdaten-service/pom.xml b/wls-basisdaten-service/pom.xml index 2346d00cd..09195ca67 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.1.1-Beta1.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/WahltageClientImpl.java b/wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahltageClientImpl.java index ec299a424..d5e9f51e1 100644 --- 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 @@ -2,7 +2,7 @@ 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.WahltageDTO; +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; @@ -10,6 +10,7 @@ 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; @@ -29,7 +30,7 @@ public class WahltageClientImpl implements WahltageClient { @Override public List getWahltage(LocalDate tag) throws WlsException { - final WahltageDTO wahltageDTO; + final Set wahltageDTO; try { wahltageDTO = wahldatenControllerApi.loadWahltageSinceIncluding(tag); } catch (final Exception exception) { @@ -39,6 +40,6 @@ public List getWahltage(LocalDate tag) throws WlsException { if (wahltageDTO == null) { throw exceptionFactory.createFachlicheWlsException(ExceptionConstants.NULL_FROM_CLIENT); } - return wahltageClientMapper.fromRemoteClientWahltageDTOtoListOfWahltagModel(wahltageDTO); + 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 index c00f63fb6..7d56768bb 100644 --- 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 @@ -1,9 +1,9 @@ package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients; import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO; -import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltageDTO; 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; @@ -14,7 +14,5 @@ public interface WahltageClientMapper { @Mapping(target = "wahltag", source = "tag") WahltagModel toWahltagModel(WahltagDTO wahltagDTO); - default List fromRemoteClientWahltageDTOtoListOfWahltagModel(final WahltageDTO wahltageDTO) { - return wahltageDTO.getWahltage().stream().map(this::toWahltagModel).toList(); - } + List fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(Set wahltageDTO); } 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/main/resources/openapis/openapi.eai.0.1.1-Beta1.json b/wls-basisdaten-service/src/main/resources/openapis/openapi.eai.0.1.1-Beta1.json deleted file mode 100644 index bf93e7477..000000000 --- a/wls-basisdaten-service/src/main/resources/openapis/openapi.eai.0.1.1-Beta1.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.1.1-Beta1"},"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":{"$ref":"#/components/schemas/WahltageDTO"}}}},"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":{"$ref":"#/components/schemas/WahlenDTO"}}}},"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":{"$ref":"#/components/schemas/WahlbezirkeDTO"}}}},"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"}}},"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":["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","wahlvorschlaege"],"type":"object","properties":{"wahlID":{"type":"string"},"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/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 index bc5ab0de1..ad69c4d58 100644 --- 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 @@ -2,7 +2,7 @@ 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.WahltageDTO; +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; @@ -10,6 +10,7 @@ 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; @@ -43,12 +44,12 @@ class GetWahltage { void clientResponseIsMapped() { val testDate = LocalDate.now().minusMonths(3); - val mockedClientResponse = new WahltageDTO(); + val mockedClientResponse = createClientWahltageDTO(); val mockedMappedClientResponse = List.of(WahltagModel.builder().build()); Mockito.when(wahldatenControllerApi.loadWahltageSinceIncluding(testDate)) .thenReturn(mockedClientResponse); - Mockito.when(wahltageClientMapper.fromRemoteClientWahltageDTOtoListOfWahltagModel(mockedClientResponse)) + Mockito.when(wahltageClientMapper.fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(mockedClientResponse)) .thenReturn(mockedMappedClientResponse); val result = unitUnderTest.getWahltage(testDate); @@ -77,5 +78,28 @@ void controllerApiExceptionIsMapped() { 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 index 755f2292b..cdccb46e4 100644 --- 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 @@ -1,7 +1,6 @@ package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients; import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO; -import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltageDTO; import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahltag.WahltagModel; import java.time.LocalDate; import java.util.List; @@ -47,8 +46,6 @@ class FromRemoteClientWahltageDTOtoListOfWahltagModel { @Test void isMapped() { - val dtoToMap = new WahltageDTO(); - val wahltag1 = new WahltagDTO(); wahltag1.setIdentifikator("identifikatorWahltag1"); wahltag1.setBeschreibung("beschreibungWahltag1"); @@ -67,13 +64,12 @@ void isMapped() { wahltag3.setNummer("nummerWahltag3"); wahltag3.setTag(LocalDate.now().plusMonths(1)); - dtoToMap.setWahltage(Set.of( - wahltag1, wahltag2, wahltag3)); + val dtoToMap = Set.of(wahltag1, wahltag2, wahltag3); - Assertions.assertThat(dtoToMap).hasNoNullFieldsOrProperties(); - Assertions.assertThat(dtoToMap.getWahltage()).size().isEqualTo(3); + Assertions.assertThat(dtoToMap).size().isEqualTo(3); + dtoToMap.forEach(wahltag -> Assertions.assertThat(wahltag).hasNoNullFieldsOrProperties()); - val result = unitUnderTest.fromRemoteClientWahltageDTOtoListOfWahltagModel(dtoToMap); + val result = unitUnderTest.fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(dtoToMap); val expectedWahltage = List.of( new WahltagModel("identifikatorWahltag1", 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 index dc95a3693..be01e71f3 100644 --- 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 @@ -103,7 +103,7 @@ void loadedFromExternal() throws Exception { de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.wahltage.WahltagDTO[].class); val expectedResponseBody = dtoMapper - .fromListOfWahltagModelToListOfWahltagDTO(wahltageClientMapper.fromRemoteClientWahltageDTOtoListOfWahltagModel(eaiWahltage)); + .fromListOfWahltagModelToListOfWahltagDTO(wahltageClientMapper.fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(eaiWahltage)); Assertions.assertThat(responseBodyAsDTO).containsExactlyInAnyOrderElementsOf(expectedResponseBody); } @@ -125,7 +125,7 @@ void externalDataIsPersisted() throws Exception { val dataFromRepo = wahltagRepository.findAllByOrderByWahltagAsc(); val expectedListOfData = modelMapper.fromWahltagModelToWahltagEntityList( - wahltageClientMapper.fromRemoteClientWahltageDTOtoListOfWahltagModel(eaiWahltage)); + wahltageClientMapper.fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(eaiWahltage)); Assertions.assertThat(dataFromRepo) .usingRecursiveComparison().ignoringCollectionOrder() @@ -136,7 +136,7 @@ void externalDataIsPersisted() throws Exception { void loadFromRemoteFirstAndThanUpdateRepository() throws Exception { val entitiesToFindInRepository = modelMapper .fromWahltagModelToWahltagEntityList(wahltageClientMapper - .fromRemoteClientWahltageDTOtoListOfWahltagModel(createClientWahltageDTO(true))); + .fromRemoteClientSetOfWahltagDTOtoListOfWahltagModel(createClientWahltageDTO(true))); val savedEntitiesInRepository_1 = wahltagRepository.saveAll(entitiesToFindInRepository); val request = MockMvcRequestBuilders.get("/businessActions/wahltage"); @@ -184,9 +184,8 @@ void technischeWlsExceptionWhenNoExternalDataFound() throws Exception { } } - private de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltageDTO createClientWahltageDTO( + private Set createClientWahltageDTO( boolean beschreibungPartPreNumber) { - val clientWahltageDTO = new de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltageDTO(); val wahltag1 = new de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahltagDTO(); wahltag1.setIdentifikator("identifikatorWahltag1"); @@ -206,9 +205,6 @@ private de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.Wahltage wahltag3.setNummer("nummerWahltag3"); wahltag3.setTag(LocalDate.now().plusMonths(1)); - val wahltage = Set.of(wahltag1, wahltag2, wahltag3); - clientWahltageDTO.setWahltage(wahltage); - - return clientWahltageDTO; + return Set.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 index 5be8576e2..e7b79c031 100644 --- 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 @@ -6,7 +6,6 @@ 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.eai.aou.model.WahltageDTO; import de.muenchen.oss.wahllokalsystem.basisdatenservice.utils.Authorities; import de.muenchen.oss.wahllokalsystem.wls.common.testing.SecurityUtils; import java.time.LocalDate; @@ -86,8 +85,7 @@ private static Stream getMissingAuthoritiesVariations() { return SecurityUtils.buildArgumentsForMissingAuthoritiesVariations(Authorities.ALL_AUTHORITIES_DELETE_WAHLTAGE); } - private WahltageDTO createClientWahltageDTO() { - val dto = new WahltageDTO(); + private Set createClientWahltageDTO() { val wahltag1 = new WahltagDTO(); wahltag1.setIdentifikator("identifikatorWahltag1"); wahltag1.setBeschreibung("beschreibungWahltag1"); @@ -106,9 +104,7 @@ private WahltageDTO createClientWahltageDTO() { wahltag3.setNummer("nummerWahltag3"); wahltag3.setTag(LocalDate.now().plusMonths(1)); - dto.setWahltage(Set.of(wahltag3, wahltag2, wahltag1)); - - return dto; + return Set.of(wahltag3, wahltag2, wahltag1); } } }