From b0ea9a2821a0871ea22ea41c79162f8ed7baa075 Mon Sep 17 00:00:00 2001 From: Felix Reichenbach <felix.reichenbach@mgm-tp.com> Date: Fri, 24 Jan 2025 11:27:11 +0100 Subject: [PATCH] OZG-7539 fix xta configuration for fim --- .../src/main/resources/application.yml | 8 +- .../eingang/xta/FimFormDataTestFactory.java | 97 +++++++++++++++++++ .../eingang/xta/SemantikAdapterITCase.java | 46 +++++++++ xta-adapter/src/test/resources/antrag.xml | 69 +++++++++++++ 4 files changed, 216 insertions(+), 4 deletions(-) create mode 100644 xta-adapter/src/test/java/de/ozgcloud/eingang/xta/FimFormDataTestFactory.java create mode 100644 xta-adapter/src/test/java/de/ozgcloud/eingang/xta/SemantikAdapterITCase.java create mode 100644 xta-adapter/src/test/resources/antrag.xml diff --git a/xta-adapter/src/main/resources/application.yml b/xta-adapter/src/main/resources/application.yml index fd1f72982..32946db66 100644 --- a/xta-adapter/src/main/resources/application.yml +++ b/xta-adapter/src/main/resources/application.yml @@ -13,7 +13,7 @@ ozgcloud: status-list: "http://www.osci.eu/ws/2008/05/transport/urn/messageTypes/MsgBoxStatusListRequest" fetch-request: "http://www.osci.eu/ws/2008/05/transport/urn/messageTypes/MsgBoxFetchRequest" close-request: "http://www.osci.eu/ws/2008/05/transport/urn/messageTypes/MsgBoxCloseRequest" - -fim: - schemeLocations: - - fim-s17000652_1.4/S17000652V1.4_xfall.xsd \ No newline at end of file + eingang: + fim: + schemeLocations: + - fim-s17000652_1.4/S17000652V1.4_xfall.xsd \ No newline at end of file diff --git a/xta-adapter/src/test/java/de/ozgcloud/eingang/xta/FimFormDataTestFactory.java b/xta-adapter/src/test/java/de/ozgcloud/eingang/xta/FimFormDataTestFactory.java new file mode 100644 index 000000000..f5711880b --- /dev/null +++ b/xta-adapter/src/test/java/de/ozgcloud/eingang/xta/FimFormDataTestFactory.java @@ -0,0 +1,97 @@ +package de.ozgcloud.eingang.xta; + +import java.io.File; +import java.util.Map; +import java.util.Optional; + +import de.ozgcloud.eingang.common.formdata.FormData; +import de.ozgcloud.eingang.common.formdata.FormData.FormDataControl; +import de.ozgcloud.eingang.common.formdata.FormData.Representations; +import de.ozgcloud.eingang.common.formdata.FormHeader; +import de.ozgcloud.eingang.common.formdata.IncomingFile; + +class FimFormDataTestFactory { + + public static final String FILE_NAME = "antrag.xml"; + public static final Map<String, Object> FORM_DATA_MAP = createFormDataMap(); + + public static FormData createEmptyFormData() { + return FormData.builder() + .header(FormHeader.builder() + .channel("XTA") + .formEngineName("FIM") + .build()) + .control(FormDataControl.builder() + .representations(Optional.of(Representations.builder() + .primaryFormDataRepresentation(FILE_NAME) + .build())) + .build()) + .representation(IncomingFile.builder() + .name(FILE_NAME) + .file(new File("src/test/resources/" + FILE_NAME)) + .contentType("application/xml") + .build()) + .build(); + } + + private static Map<String, Object> createFormDataMap() { + return Map.of("F17003371", + Map.of("label", "Anzeigenart", "value", "Anzeigen einer ortsfesten Versammlung (Kundgebung / Demonstration)"), "F17009191", + Map.of("label", "Anzeige durch Person", "value", "false"), "G17002112", + Map.of("label", "Anzeigenersteller:in", "value", Map.of("F17009011", + Map.of("label", "Auswahl Anzeigenersteller:in = Verantwortliche Versammlungsleiter:in", "value", "false"), "F60000227", + Map.of("label", "Familienname", "value", "Manager"), "F60000228", Map.of("label", "Vornamen", "value", "Test"), "F60000240", + Map.of("label", "Telefon", "value", "0123456789"), "F60000242", + Map.of("label", "E-Mail", "value", "oliver.charlet@dataport.de"), "G60000086", + Map.of("label", "Anschrift Inland Straßenanschrift", "value", + Map.of("F60000243", Map.of("label", "Straße", "value", "Teststr"), "F60000244", + Map.of("label", "Hausnummer", "value", "1"), "F60000246", Map.of("label", "Postleitzahl", "value", "12345"), + "F60000247", Map.of("label", "Ort", "value", "TEsthausen"), "F60000248", + Map.of("label", "Anschrift Zusatzangaben", "value", "keine"))))), + "G17003529", + Map.of("label", "EfA|SH Standard", "value", + Map.of("F17005454", Map.of("label", "Datenschutzhinweis DSGVO", "value", "true"), "F17005455", + Map.of("label", "Zustimmung zu einem digitalen Bescheid", "value", "false"), "F17005533", + Map.of("label", "UUID", "value", "c4efef86-1fa2-458f-b4d3-be4ce21371b8"), "G05001479", + Map.of("label", "nachrichtenkopf", "value", Map.of("G05001480", Map.of("label", "identifikation.nachricht", "value", + Map.of("F05002750", Map.of("label", "nachrichtenUUID", "value", "c4efef86-1fa2-458f-b4d3-be4ce21371b8"), + "F05002751", Map.of("label", "erstellungszeitpunkt", "value", "21.01.2025 13:19:34"), "F05002752", + Map.of("label", "nachrichtentyp", "value", "fim.S17000652.17000652001004"), "F05002753", + Map.of("label", "dienstname", "value", "urn:fim:Versammlungsanzeige:1.4"))), + "G05001481", + Map.of("label", "Leser", "value", + Map.of("F05002754", + Map.of("label", "Organisationsname", "value", "Fachdienst Sicherheit und Ordnung"), + "F05002755", Map.of("label", "Organisationsschlüssel", "value", "vbe:010550120100"), + "F05002756", Map.of("label", "Kategorie", "value", "Versammlungsbehörde"))), + "G05001482", + Map.of("label", "Autor", "value", + Map.of("F05002754", Map.of("label", "Organisationsname", "value", "Dataport"), "F05002755", + Map.of("label", "Organisationsschlüssel", "value", "ehp:010100100000"), "F05002756", + Map.of("label", "Kategorie", "value", "Versammlungsbehörde"))))))), + "G17005404", Map + .of("label", "Versammlung (ortsfest)", "value", Map.of( + "G17007202", Map + .of("label", "Allgemeine Angaben zur Versammlung", "value", + Map.of("F17003373", Map.of("label", "Thema der Versammlung", "value", "gegen alles"), "F17003377", + Map.of("label", "Versammlungsort", "value", "Marktplatz"), "G17005405", + Map.of("label", "Karte Versammlungsort", "value", + Map.of("F60000296", Map.of("label", "Nachweis", "value", "VO_Sehr_witzig.jpg"))), + "G17005406", + Map.of("label", "Zeitraum (Versammlungsanzeige)", "value", + Map.of("F17001348", Map.of("label", "Uhrzeit Start", "value", "9"), "F17001349", + Map.of("label", "Uhrzeit Abschluss", "value", "10"), "F60000048", + Map.of("label", "Anfang", "value", "2025-01-31"), "F60000049", + Map.of("label", "Ende", "value", "2025-01-31"))))), + "G17007205", + Map.of("label", "Weitere Angaben", "value", + Map.of("F17003379", Map.of("label", "Anzahl der Teilnehmenden", "value", "3"), "F17003380", + Map.of("label", "Anzahl eingeplanter Ordner:innen", "value", "1"), "F17003382", + Map.of("label", "Weitere teilnehmende Organisationen", "value", "keine"), "G17007234", + Map.of("label", "Aufbauzeit", "value", + Map.of("F17011826", + Map.of("label", "Beträgt die Aufbauzeit über 30 Minuten?", "value", "Keine"))), + "G17007235", Map.of("label", "Abbauzeit", "value", Map.of("F17011827", + Map.of("label", "Beträgt die Abbauzeit über 30 Minuten?", "value", "Keine")))))))); + } +} diff --git a/xta-adapter/src/test/java/de/ozgcloud/eingang/xta/SemantikAdapterITCase.java b/xta-adapter/src/test/java/de/ozgcloud/eingang/xta/SemantikAdapterITCase.java new file mode 100644 index 000000000..d7589a5a7 --- /dev/null +++ b/xta-adapter/src/test/java/de/ozgcloud/eingang/xta/SemantikAdapterITCase.java @@ -0,0 +1,46 @@ +package de.ozgcloud.eingang.xta; + +import static org.assertj.core.api.Assertions.*; +import static org.mockito.Mockito.*; + +import java.util.Map; + +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.bean.override.mockito.MockitoBean; + +import de.ozgcloud.common.test.ITCase; +import de.ozgcloud.eingang.common.formdata.FormData; +import de.ozgcloud.eingang.router.VorgangService; +import de.ozgcloud.eingang.semantik.SemantikAdapter; + +@ITCase +class SemantikAdapterITCase { + + @Autowired + private SemantikAdapter semantikAdapter; + + @MockitoBean + private VorgangService vorgangService; + + @Nested + class TestForFim { + private final Map<String, Object> excpectedFormDataMap = FimFormDataTestFactory.FORM_DATA_MAP; + + private final FormData emptyFormData = FimFormDataTestFactory.createEmptyFormData(); + + @Captor + private ArgumentCaptor<FormData> formDataCaptor; + + @Test + void shouldParseFormDataMap() { + semantikAdapter.processFormData(emptyFormData); + + verify(vorgangService).createVorgang(formDataCaptor.capture()); + assertThat(formDataCaptor.getValue().getFormData()).usingRecursiveComparison().isEqualTo(excpectedFormDataMap); + } + } +} \ No newline at end of file diff --git a/xta-adapter/src/test/resources/antrag.xml b/xta-adapter/src/test/resources/antrag.xml new file mode 100644 index 000000000..9f5cb1812 --- /dev/null +++ b/xta-adapter/src/test/resources/antrag.xml @@ -0,0 +1,69 @@ +<fim.S17000652.17000652001004 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns="urn:xoev-de:xfall:standard:fim-s17000652_1.4"> + <G17003529> + <G05001479> + <G05001480> + <F05002750>c4efef86-1fa2-458f-b4d3-be4ce21371b8</F05002750> + <F05002751>21.01.2025 13:19:34</F05002751> + <F05002752>fim.S17000652.17000652001004</F05002752> + <F05002753>urn:fim:Versammlungsanzeige:1.4</F05002753> + </G05001480> + <G05001481> + <F05002754>Fachdienst Sicherheit und Ordnung</F05002754> + <F05002755>vbe:010550120100</F05002755> + <F05002756>Versammlungsbehörde</F05002756> + </G05001481> + <G05001482> + <F05002754>Dataport</F05002754> + <F05002755>ehp:010100100000</F05002755> + <F05002756>Versammlungsbehörde</F05002756> + </G05001482> + </G05001479> + <F17005454>true</F17005454> + <F17005455>false</F17005455> + <F17005533>c4efef86-1fa2-458f-b4d3-be4ce21371b8</F17005533> + </G17003529> + <F17009191>false</F17009191> + <G17002112> + <F60000228>Test</F60000228> + <F60000227>Manager</F60000227> + <G60000086> + <F60000243>Teststr</F60000243> + <F60000244>1</F60000244> + <F60000246>12345</F60000246> + <F60000247>TEsthausen</F60000247> + <F60000248>keine</F60000248> + </G60000086> + <F60000240>0123456789</F60000240> + <F60000242>oliver.charlet@dataport.de</F60000242> + <F17009011>false</F17009011> + </G17002112> + <F17003371>Anzeigen einer ortsfesten Versammlung (Kundgebung / Demonstration)</F17003371> + <G17005404> + <G17007202> + <F17003373>gegen alles</F17003373> + <F17003377>Marktplatz</F17003377> + <G17005405> + <F60000296>VO_Sehr_witzig.jpg</F60000296> + </G17005405> + <G17005406> + <F60000048>2025-01-31</F60000048> + <F17001348>9</F17001348> + <F60000049>2025-01-31</F60000049> + <F17001349>10</F17001349> + </G17005406> + </G17007202> + <G17007205> + <F17003379>3</F17003379> + <F17003380>1</F17003380> + <F17003382>keine</F17003382> + <G17007234> + <F17011826>Keine</F17011826> + </G17007234> + <G17007235> + <F17011827>Keine</F17011827> + </G17007235> + </G17007205> + </G17005404> +</fim.S17000652.17000652001004> \ No newline at end of file -- GitLab