From 41fe46ca3815a011f0561caac62d84b18b227221 Mon Sep 17 00:00:00 2001
From: Jan Zickermann <jan.zickermann@dataport.de>
Date: Wed, 2 Apr 2025 15:20:35 +0200
Subject: [PATCH] KOP-3126 Test schema validation with invalid id

---
 .../xta/client/XtaSchemaValidationITCase.java |  84 ++++++++++-----
 .../XtaMockServerResponseTestFactory.java     | 102 ++----------------
 ...ef0_Geschaeftsgang.Geschaeftsgang.0201.zip | Bin
 .../envelope.template.xml                     |  49 +++++++++
 .../stage-example/envelope.template.xml       |  19 ----
 .../stage-example/example2/example.xml        |   1 -
 .../getMessage/valid/envelope.template.xml    |  49 +++++++++
 .../stage-example/metadata.template.xml       |  33 ------
 8 files changed, 162 insertions(+), 175 deletions(-)
 rename src/test/resources/mock-responses/getMessage/{stage-example => }/84d0edd7-709b-4a7b-9aac-b3ee82041ef0_Geschaeftsgang.Geschaeftsgang.0201.zip (100%)
 create mode 100644 src/test/resources/mock-responses/getMessage/invalid-id-attribute/envelope.template.xml
 delete mode 100644 src/test/resources/mock-responses/getMessage/stage-example/envelope.template.xml
 delete mode 100644 src/test/resources/mock-responses/getMessage/stage-example/example2/example.xml
 create mode 100644 src/test/resources/mock-responses/getMessage/valid/envelope.template.xml
 delete mode 100644 src/test/resources/mock-responses/getStatusList/MessageMetaData/stage-example/metadata.template.xml

diff --git a/src/test/java/de/ozgcloud/xta/client/XtaSchemaValidationITCase.java b/src/test/java/de/ozgcloud/xta/client/XtaSchemaValidationITCase.java
index 3a7fa5c..264f675 100644
--- a/src/test/java/de/ozgcloud/xta/client/XtaSchemaValidationITCase.java
+++ b/src/test/java/de/ozgcloud/xta/client/XtaSchemaValidationITCase.java
@@ -11,6 +11,7 @@ import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.DisplayName;
 import org.junit.jupiter.api.Test;
+import org.opensaml.core.xml.io.UnmarshallingException;
 
 import com.github.tomakehurst.wiremock.WireMockServer;
 import com.github.tomakehurst.wiremock.client.WireMock;
@@ -20,15 +21,12 @@ import de.ozgcloud.xta.client.core.WrappedXtaService;
 import de.ozgcloud.xta.client.core.WrappedXtaServiceFactory;
 import de.ozgcloud.xta.client.factory.XtaMockServerResponseTestFactory;
 import de.ozgcloud.xta.client.model.XtaIdentifier;
+import de.ozgcloud.xta.client.model.XtaMessage;
 import lombok.SneakyThrows;
 
 class XtaSchemaValidationITCase {
 
-	WrappedXtaService xtaService;
-
-	private static final String XTA_MOCK_SERVER_URL_BASE = "https://localhost:8089";
 	private static final String XTA_MOCK_SERVER_URL_PATH = "/MB_XTA-WS/XTA210";
-	private static final String XTA_MOCK_SERVER_URL = XTA_MOCK_SERVER_URL_BASE + XTA_MOCK_SERVER_URL_PATH;
 
 	WireMockServer wireMockServer;
 
@@ -48,9 +46,53 @@ class XtaSchemaValidationITCase {
 		wireMockServer.start();
 
 		WireMock.configureFor(8088);
+	}
+
+	@AfterEach
+	void tearDown() {
+		wireMockServer.stop();
+	}
 
-		xtaService = WrappedXtaServiceFactory.from(XtaClientConfig.builder()
-				.schemaValidation(true)
+	@DisplayName("should throw UnmarshallException on bad response")
+	@Test
+	@SneakyThrows
+	void shouldThrowUnmarshallExceptionOnBadResponse() {
+		var xtaService = createXtaService(true);
+		stubGetMessageExample("invalid-id-attribute");
+
+		assertThatThrownBy(() -> getMessage(xtaService))
+				.isInstanceOf(UnmarshallingException.class);
+	}
+
+	@DisplayName("should not fail with schemaValidation disabled and bad response")
+	@Test
+	@SneakyThrows
+	void shouldNotFailWithSchemaValidationDisabledAndBadResponse() {
+		var xtaService = createXtaService(false);
+		stubGetMessageExample("invalid-id-attribute");
+
+		var message = getMessage(xtaService);
+
+		assertThat(message).isNotNull();
+	}
+
+	@DisplayName("should not fail on good response")
+	@Test
+	@SneakyThrows
+	void shouldNotFailOnGoodResponse() {
+		var xtaService = createXtaService(true);
+		stubGetMessageExample("valid");
+
+		var message = getMessage(xtaService);
+
+		assertThat(message).isNotNull();
+	}
+
+
+	@SneakyThrows
+	private WrappedXtaService createXtaService(boolean schemaValidation) {
+		return WrappedXtaServiceFactory.from(XtaClientConfig.builder()
+				.schemaValidation(schemaValidation)
 				.logSoapResponses(true)
 				.logSoapRequests(true)
 				.trustStore(XtaClientConfig.KeyStore.builder()
@@ -69,30 +111,16 @@ class XtaSchemaValidationITCase {
 				.build()).create();
 	}
 
-	@AfterEach
-	void tearDown() {
-		wireMockServer.stop();
-	}
-
-	@DisplayName("should throw UnmarshallException on bad response")
-	@Test
 	@SneakyThrows
-	void shouldThrowUnmarshallExceptionOnBadResponse() {
-		wireMockServer.stubFor(post(XTA_MOCK_SERVER_URL_PATH + "msgBoxPort.svc")
-				.willReturn(
-						XtaMockServerResponseTestFactory.createConstantGetMessageResponse(
-								"84d0edd7-709b-4a7b-9aac-b3ee82041ef0_Geschaeftsgang.Geschaeftsgang.0201.zip")));
-
-		var message = xtaService.getMessage("urn:de:xta:messageid:dataport_xta_210:db6ad282-c510-4154-a167-daaa8b9f345a", XtaIdentifier.builder()
-				.value("afmsh:ozg-cloud-stage-Utopia")
-				.build());
-
-		assertThat(message).isNotNull();
+	private XtaMessage getMessage(WrappedXtaService service) {
+		var clientIdentifier = XtaIdentifier.builder().value("afmsh:ozg-cloud-stage-Utopia").build();
+		return service.getMessage("urn:de:xta:messageid:dataport_xta_210:b32f749e-8188-49a9-add4-3e0f3c309f78", clientIdentifier);
 	}
 
-	@DisplayName("should not fail on good response")
-	@Test
-	void shouldNotFailOnGoodResponse() {
-
+	private void stubGetMessageExample(String exampleName) {
+		stubFor(post(XTA_MOCK_SERVER_URL_PATH + "msgBoxPort.svc")
+				.willReturn(
+						XtaMockServerResponseTestFactory.createConstantGetMessageResponse(exampleName)
+				));
 	}
 }
diff --git a/src/test/java/de/ozgcloud/xta/client/factory/XtaMockServerResponseTestFactory.java b/src/test/java/de/ozgcloud/xta/client/factory/XtaMockServerResponseTestFactory.java
index fbab553..5311ff5 100644
--- a/src/test/java/de/ozgcloud/xta/client/factory/XtaMockServerResponseTestFactory.java
+++ b/src/test/java/de/ozgcloud/xta/client/factory/XtaMockServerResponseTestFactory.java
@@ -5,9 +5,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.*;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Base64;
-import java.util.List;
 import java.util.Map;
-import java.util.UUID;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -21,7 +19,6 @@ public class XtaMockServerResponseTestFactory {
 	// The MIME Multipart/Related Content-type (See https://www.ietf.org/rfc/rfc2387.txt)
 	private static final String MULTIPART_RELATED_CONTENT_TYPE = "multipart/related; type=\"application/xop+xml\";start=\"<http://tempuri.org/0>\";boundary=\"%s\";start-info=\"application/soap+xml\"".formatted(
 			UUID_BOUNDARY);
-	private static final String INCLUDE_URL = "http://tempuri.org/1/638485294711394846";
 
 	private static final Map<String, String> ENVELOPE_HEADERS = Map.of(
 			"Content-ID", "<http://tempuri.org/0>",
@@ -29,88 +26,15 @@ public class XtaMockServerResponseTestFactory {
 			"Content-Type", "application/xop+xml;charset=utf-8;type=\"application/soap+xml\""
 	);
 
-	private static String generateMessageID(String xtaAttachmentFileName) {
-		return "urn:de:xta:messageid:dataport_xta_210:%s".formatted(UUID.nameUUIDFromBytes(xtaAttachmentFileName.getBytes()).toString());
-	}
-
-	public static ResponseDefinitionBuilder createEmptyGetStatusListResponse() {
-		var envelopeXMLString = TestUtils.loadTextFile(
-				"mock-responses/getStatusList/envelope.template.xml",
-				"0",
-				""
-		);
-
-		var body = combineParts(
-				createPart(
-						ENVELOPE_HEADERS,
-						envelopeXMLString
-				)
-		);
-
-		return ok()
-				.withHeader("Content-Type", MULTIPART_RELATED_CONTENT_TYPE)
-				.withBody(body);
-	}
-
-	public static ResponseDefinitionBuilder createGetStatusListResponse(List<String> xtaAttachmentFileNames) {
-		var messageMetaDataEntriesString = xtaAttachmentFileNames.stream()
-				.map(XtaMockServerResponseTestFactory::createMessageMetadataXml)
-				.collect(Collectors.joining());
-		var envelopeXMLString = TestUtils.loadTextFile(
-				"mock-responses/getStatusList/envelope.template.xml",
-				String.valueOf(xtaAttachmentFileNames.size()),
-				messageMetaDataEntriesString
-		);
-
-		var body = combineParts(
-				createPart(
-						ENVELOPE_HEADERS,
-						envelopeXMLString
-				)
-		);
-
-		return ok()
-				.withHeader("Content-Type", MULTIPART_RELATED_CONTENT_TYPE)
-				.withBody(body);
-	}
-
-	public static ResponseDefinitionBuilder createGetMessageResponse(String xtaAttachmentFileName) {
-		var metadataMessageXml = createMessageMetadataXml(xtaAttachmentFileName);
-
+	public static ResponseDefinitionBuilder createConstantGetMessageResponse(String exampleName) {
+		var filePath = getAttachmentFilePath("84d0edd7-709b-4a7b-9aac-b3ee82041ef0_Geschaeftsgang.Geschaeftsgang.0201.zip");
+		var fileSize = getFileSize(filePath);
 		var envelopeXMLString = TestUtils.loadTextFile(
-				"mock-responses/getMessage/stage-example/envelope.template.xml",
-				generateMessageID(xtaAttachmentFileName),
-				metadataMessageXml,
-				xtaAttachmentFileName,
-				getFileSize(getAttachmentFilePath(xtaAttachmentFileName)),
-				INCLUDE_URL
-		);
-
-		var body = combineParts(
-				createPart(
-						ENVELOPE_HEADERS,
-						envelopeXMLString
-				),
-				createPart(
-						Map.of(
-								"Content-ID", "<%s>".formatted(INCLUDE_URL),
-								"Content-Transfer-Encoding", "base64",
-								"Content-Type", "application/octet-stream"
-						),
-						loadFileAsBase64(
-								getAttachmentFilePath(xtaAttachmentFileName)
-						)
-				)
+				"mock-responses/getMessage/%s/envelope.template.xml".formatted(exampleName),
+				fileSize,
+				fileSize
 		);
 
-		return ok()
-				.withHeader("Content-Type", MULTIPART_RELATED_CONTENT_TYPE)
-				.withBody(body);
-	}
-	public static ResponseDefinitionBuilder createConstantGetMessageResponse(String xtaAttachmentFileName) {
-
-		var envelopeXMLString = TestUtils.loadTextFile("mock-responses/getMessage/stage-example/example2/example.xml");
-
 		var body = combineParts(
 				createPart(
 						ENVELOPE_HEADERS,
@@ -122,9 +46,7 @@ public class XtaMockServerResponseTestFactory {
 								"Content-Transfer-Encoding", "base64",
 								"Content-Type", "application/octet-stream"
 						),
-						loadFileAsBase64(
-								getAttachmentFilePath(xtaAttachmentFileName)
-						)
+						loadFileAsBase64(filePath)
 				)
 		);
 
@@ -133,14 +55,6 @@ public class XtaMockServerResponseTestFactory {
 				.withBody(body);
 	}
 
-	private static String createMessageMetadataXml(String xtaAttachmentFileName) {
-		return TestUtils.loadTextFile(
-				"mock-responses/getStatusList/MessageMetaData/stage-example/metadata.template.xml",
-				generateMessageID(xtaAttachmentFileName),
-				getFileSize(getAttachmentFilePath(xtaAttachmentFileName))
-		);
-	}
-
 	private static String getFileSize(String filePath) {
 		try (var inputStream = TestUtils.loadFile(filePath)) {
 			return String.valueOf(inputStream.readAllBytes().length);
@@ -150,7 +64,7 @@ public class XtaMockServerResponseTestFactory {
 	}
 
 	private static String getAttachmentFilePath(String xtaAttachmentFileName) {
-		return "mock-responses/getMessage/stage-example/%s".formatted(xtaAttachmentFileName);
+		return "mock-responses/getMessage/%s".formatted(xtaAttachmentFileName);
 	}
 
 	private static String loadFileAsBase64(String fileName) {
diff --git a/src/test/resources/mock-responses/getMessage/stage-example/84d0edd7-709b-4a7b-9aac-b3ee82041ef0_Geschaeftsgang.Geschaeftsgang.0201.zip b/src/test/resources/mock-responses/getMessage/84d0edd7-709b-4a7b-9aac-b3ee82041ef0_Geschaeftsgang.Geschaeftsgang.0201.zip
similarity index 100%
rename from src/test/resources/mock-responses/getMessage/stage-example/84d0edd7-709b-4a7b-9aac-b3ee82041ef0_Geschaeftsgang.Geschaeftsgang.0201.zip
rename to src/test/resources/mock-responses/getMessage/84d0edd7-709b-4a7b-9aac-b3ee82041ef0_Geschaeftsgang.Geschaeftsgang.0201.zip
diff --git a/src/test/resources/mock-responses/getMessage/invalid-id-attribute/envelope.template.xml b/src/test/resources/mock-responses/getMessage/invalid-id-attribute/envelope.template.xml
new file mode 100644
index 0000000..e5fde62
--- /dev/null
+++ b/src/test/resources/mock-responses/getMessage/invalid-id-attribute/envelope.template.xml
@@ -0,0 +1,49 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
+	<s:Header>
+		<a:Action s:mustUnderstand="1">http://www.osci.eu/ws/2008/05/transport/urn/messageTypes/MsgBoxFetchRequest</a:Action>
+		<h:MsgBoxResponse MsgBoxRequestID="urn:de:xta:messageid:dataport_xta_210:b32f749e-8188-49a9-add4-3e0f3c309f78" xmlns:h="http://www.osci.eu/ws/2008/05/transport" xmlns="http://www.osci.eu/ws/2008/05/transport" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+			<ItemsPending>0</ItemsPending>
+		</h:MsgBoxResponse>
+		<MessageMetaData xmlns="http://www.osci.eu/ws/2014/10/transport">
+			<DeliveryAttributes>
+				<Origin>2024-04-04T10:24:07.57</Origin>
+				<Delivery>2024-04-04T10:24:08.723</Delivery>
+			</DeliveryAttributes>
+			<Originators>
+				<Author>
+					<Identifier type="xoev">afmsh:WebMethod_Online-Dienste</Identifier>
+				</Author>
+			</Originators>
+			<Destinations>
+				<Reader>
+					<Identifier type="xoev">afmsh:ozg-cloud-stage-Utopia</Identifier>
+				</Reader>
+			</Destinations>
+			<MsgIdentification>
+				<a:MessageID>urn:de:xta:messageid:dataport_xta_210:b32f749e-8188-49a9-add4-3e0f3c309f78</a:MessageID>
+			</MsgIdentification>
+			<Qualifier>
+				<Service>urn:xdomea:AFM</Service>
+				<BusinessScenario>
+					<Defined listURI="urn:de:dataport:codeliste:business.scenario" listVersionID="1">
+						<code xmlns="">AFM_DATA</code>
+					</Defined>
+				</BusinessScenario>
+				<MessageType listURI="urn:de:payloadSchema:elementName" listVersionID="1.0"
+						payloadSchema="http://www.xdomea.de/V2.0.1">
+					<code xmlns="">Geschaeftsgang.Geschaeftsgang.0201</code>
+				</MessageType>
+			</Qualifier>
+			<MsgSize>%s</MsgSize>
+		</MessageMetaData>
+	</s:Header>
+	<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+		<GenericContentContainer xmlns="http://xoev.de/transport/xta/211">
+			<ContentContainer>
+				<Message contentType="application/zip" filename="84d0edd7-709b-4a7b-9aac-b3ee82041ef0_Geschaeftsgang.Geschaeftsgang.0201.zip" id="84d0edd7-709b-4a7b-9aac-b3ee82041ef0" size="%s">
+					<xop:Include href="cid:http://tempuri.org/1/638791906228054916" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
+				</Message>
+			</ContentContainer>
+		</GenericContentContainer>
+	</s:Body>
+</s:Envelope>
\ No newline at end of file
diff --git a/src/test/resources/mock-responses/getMessage/stage-example/envelope.template.xml b/src/test/resources/mock-responses/getMessage/stage-example/envelope.template.xml
deleted file mode 100644
index 5fd0ac9..0000000
--- a/src/test/resources/mock-responses/getMessage/stage-example/envelope.template.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
-	<s:Header>
-		<a:Action s:mustUnderstand="1">http://www.osci.eu/ws/2008/05/transport/urn/messageTypes/MsgBoxFetchRequest</a:Action>
-		<h:MsgBoxResponse MsgBoxRequestID="%s" xmlns:h="http://www.osci.eu/ws/2008/05/transport" xmlns="http://www.osci.eu/ws/2008/05/transport" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-			<ItemsPending>0</ItemsPending>
-		</h:MsgBoxResponse>
-		%s
-		<a:RelatesTo>urn:uuid:a0c6d23f-4fbf-49fd-b1f4-b5187d5170f0</a:RelatesTo>
-	</s:Header>
-	<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-		<GenericContentContainer xmlns="http://xoev.de/transport/xta/211">
-			<ContentContainer>
-				<Message contentType="application/zip" filename="%s" id="2f45a9e9-ed40-4e14-a082-de0d063e56e7" size="%s">
-					<xop:Include href="%s" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
-				</Message>
-			</ContentContainer>
-		</GenericContentContainer>
-	</s:Body>
-</s:Envelope>
\ No newline at end of file
diff --git a/src/test/resources/mock-responses/getMessage/stage-example/example2/example.xml b/src/test/resources/mock-responses/getMessage/stage-example/example2/example.xml
deleted file mode 100644
index ad95df2..0000000
--- a/src/test/resources/mock-responses/getMessage/stage-example/example2/example.xml
+++ /dev/null
@@ -1 +0,0 @@
-<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://www.osci.eu/ws/2008/05/transport/urn/messageTypes/MsgBoxFetchRequest</a:Action><h:MsgBoxResponse MsgBoxRequestID="urn:de:xta:messageid:dataport_xta_210:b32f749e-8188-49a9-add4-3e0f3c309f78" xmlns:h="http://www.osci.eu/ws/2008/05/transport" xmlns="http://www.osci.eu/ws/2008/05/transport" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ItemsPending>0</ItemsPending></h:MsgBoxResponse><h:MessageMetaData xmlns:h="http://www.osci.eu/ws/2014/10/transport" xmlns="http://www.osci.eu/ws/2014/10/transport"><DeliveryAttributes><Origin>2025-04-02T10:41:30.488</Origin><Delivery>2025-04-02T10:41:33.17</Delivery></DeliveryAttributes><Originators><Author><Identifier type="xoev">afmsh:WebMethod_Online-Dienste</Identifier></Author></Originators><Destinations><Reader><Identifier type="xoev">afmsh:ozg-cloud-stage-Utopia</Identifier></Reader></Destinations><MsgIdentification><MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:de:xta:messageid:dataport_xta_210:b32f749e-8188-49a9-add4-3e0f3c309f78</MessageID></MsgIdentification><Qualifier><Service>urn:xdomea:AFM</Service><BusinessScenario><Defined listURI="urn:de:dataport:codeliste:business.scenario" listVersionID="1"><code xmlns="">AFM_DATA</code></Defined></BusinessScenario><MessageType listURI="urn:de:payloadSchema:elementName" listVersionID="1.0" payloadSchema="http://www.xdomea.de/V2.0.1"><code xmlns="">Geschaeftsgang.Geschaeftsgang.0201</code></MessageType></Qualifier><MsgSize>57828</MsgSize></h:MessageMetaData><a:RelatesTo>urn:uuid:f3942209-ef9c-4371-9a12-df4fc4b846a8</a:RelatesTo></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GenericContentContainer xmlns="http://xoev.de/transport/xta/211"><ContentContainer><Message contentType="application/zip" filename="84d0edd7-709b-4a7b-9aac-b3ee82041ef0_Geschaeftsgang.Geschaeftsgang.0201.zip" id="84d0edd7-709b-4a7b-9aac-b3ee82041ef0" size="57828"><xop:Include href="cid:http://tempuri.org/1/638791906228054916" xmlns:xop="http://www.w3.org/2004/08/xop/include"/></Message></ContentContainer></GenericContentContainer></s:Body></s:Envelope>
\ No newline at end of file
diff --git a/src/test/resources/mock-responses/getMessage/valid/envelope.template.xml b/src/test/resources/mock-responses/getMessage/valid/envelope.template.xml
new file mode 100644
index 0000000..3f0fd89
--- /dev/null
+++ b/src/test/resources/mock-responses/getMessage/valid/envelope.template.xml
@@ -0,0 +1,49 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
+	<s:Header>
+		<a:Action s:mustUnderstand="1">http://www.osci.eu/ws/2008/05/transport/urn/messageTypes/MsgBoxFetchRequest</a:Action>
+		<h:MsgBoxResponse MsgBoxRequestID="urn:de:xta:messageid:dataport_xta_210:b32f749e-8188-49a9-add4-3e0f3c309f78" xmlns:h="http://www.osci.eu/ws/2008/05/transport" xmlns="http://www.osci.eu/ws/2008/05/transport" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+			<ItemsPending>0</ItemsPending>
+		</h:MsgBoxResponse>
+		<MessageMetaData xmlns="http://www.osci.eu/ws/2014/10/transport">
+			<DeliveryAttributes>
+				<Origin>2024-04-04T10:24:07.57</Origin>
+				<Delivery>2024-04-04T10:24:08.723</Delivery>
+			</DeliveryAttributes>
+			<Originators>
+				<Author>
+					<Identifier type="xoev">afmsh:WebMethod_Online-Dienste</Identifier>
+				</Author>
+			</Originators>
+			<Destinations>
+				<Reader>
+					<Identifier type="xoev">afmsh:ozg-cloud-stage-Utopia</Identifier>
+				</Reader>
+			</Destinations>
+			<MsgIdentification>
+				<a:MessageID>urn:de:xta:messageid:dataport_xta_210:b32f749e-8188-49a9-add4-3e0f3c309f78</a:MessageID>
+			</MsgIdentification>
+			<Qualifier>
+				<Service>urn:xdomea:AFM</Service>
+				<BusinessScenario>
+					<Defined listURI="urn:de:dataport:codeliste:business.scenario" listVersionID="1">
+						<code xmlns="">AFM_DATA</code>
+					</Defined>
+				</BusinessScenario>
+				<MessageType listURI="urn:de:payloadSchema:elementName" listVersionID="1.0"
+						payloadSchema="http://www.xdomea.de/V2.0.1">
+					<code xmlns="">Geschaeftsgang.Geschaeftsgang.0201</code>
+				</MessageType>
+			</Qualifier>
+			<MsgSize>%s</MsgSize>
+		</MessageMetaData>
+	</s:Header>
+	<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+		<GenericContentContainer xmlns="http://xoev.de/transport/xta/211">
+			<ContentContainer>
+				<Message contentType="application/zip" filename="84d0edd7-709b-4a7b-9aac-b3ee82041ef0_Geschaeftsgang.Geschaeftsgang.0201.zip" size="%s">
+					<xop:Include href="cid:http://tempuri.org/1/638791906228054916" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
+				</Message>
+			</ContentContainer>
+		</GenericContentContainer>
+	</s:Body>
+</s:Envelope>
\ No newline at end of file
diff --git a/src/test/resources/mock-responses/getStatusList/MessageMetaData/stage-example/metadata.template.xml b/src/test/resources/mock-responses/getStatusList/MessageMetaData/stage-example/metadata.template.xml
deleted file mode 100644
index bd5d22a..0000000
--- a/src/test/resources/mock-responses/getStatusList/MessageMetaData/stage-example/metadata.template.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<h:MessageMetaData xmlns:h="http://www.osci.eu/ws/2014/10/transport" xmlns="http://www.osci.eu/ws/2014/10/transport">
-	<DeliveryAttributes>
-		<Origin>2025-03-28T02:24:29.176</Origin>
-		<Delivery>2025-03-28T02:24:30.883</Delivery>
-		<InitialFetch>2025-04-01T10:01:16.1</InitialFetch>
-		<Reception>2025-04-01T15:03:22.61</Reception>
-	</DeliveryAttributes>
-	<Originators>
-		<Author>
-			<Identifier type="xoev">afmsh:WebMethod_Online-Dienste</Identifier>
-		</Author>
-	</Originators>
-	<Destinations>
-		<Reader>
-			<Identifier type="xoev">afmsh:ozg-cloud-stage-Utopia</Identifier>
-		</Reader>
-	</Destinations>
-	<MsgIdentification>
-		<MessageID xmlns="http://www.w3.org/2005/08/addressing">%s</MessageID>
-	</MsgIdentification>
-	<Qualifier>
-		<Service>urn:xdomea:AFM</Service>
-		<BusinessScenario>
-			<Defined listURI="urn:de:dataport:codeliste:business.scenario" listVersionID="1">
-				<code xmlns="">AFM_DATA</code>
-			</Defined>
-		</BusinessScenario>
-		<MessageType listURI="urn:de:payloadSchema:elementName" listVersionID="1.0" payloadSchema="http://www.xdomea.de/V2.0.1">
-			<code xmlns="">Geschaeftsgang.Geschaeftsgang.0201</code>
-		</MessageType>
-	</Qualifier>
-	<MsgSize>%s</MsgSize>
-</h:MessageMetaData>
\ No newline at end of file
-- 
GitLab