diff options
author | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-11-22 13:57:41 +0100 |
---|---|---|
committer | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-11-22 14:05:10 +0100 |
commit | 7acd8cf9b3bd0aacea61fff3a07e17b9b57ad8cc (patch) | |
tree | 49d1eec27f2ee74e574d5099ecd56f8e9e56cb32 /src/test/java/at | |
parent | 9cd371997e9671301d7bae68d75af72687c2860d (diff) | |
download | moa-zs-7acd8cf9b3bd0aacea61fff3a07e17b9b57ad8cc.tar.gz moa-zs-7acd8cf9b3bd0aacea61fff3a07e17b9b57ad8cc.tar.bz2 moa-zs-7acd8cf9b3bd0aacea61fff3a07e17b9b57ad8cc.zip |
Fix Msg Schema Error: Honor Mutual Exclusiveness of <Choice>
- Problem: When activating the QueryPersonRequest, the TNVZ returns an
Identification element that needs to be integrated into the
msg:DeliveryRequest as a child of Receiver. The Identification child
is mutually exclusive to another sequence consisting of (Person,
AustrianAddressesOnly, Address). I forget to delete the sequence
when adding the Identifcation element and violate the the msg
schema.
- Solution: Delete sequence when adding Identification.
- Test the fix in test case.
Thanks to Johannes Hörtnagl for pointing out the problem.
Diffstat (limited to 'src/test/java/at')
-rw-r--r-- | src/test/java/at/gv/egiz/moazs/Mzs2MsgConverterTest.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/Mzs2MsgConverterTest.java b/src/test/java/at/gv/egiz/moazs/Mzs2MsgConverterTest.java index 77654de..c6146a5 100644 --- a/src/test/java/at/gv/egiz/moazs/Mzs2MsgConverterTest.java +++ b/src/test/java/at/gv/egiz/moazs/Mzs2MsgConverterTest.java @@ -25,6 +25,7 @@ import at.gv.egiz.moazs.scheme.Marshaller; import at.gv.egiz.moazs.scheme.Mzs2MsgConverter; import at.gv.zustellung.app2mzs.xsd.DeliveryRequestType; import at.gv.zustellung.msg.xsd.ObjectFactory; +import at.gv.zustellung.msg.xsd.persondata.IdentificationType; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; @@ -35,6 +36,8 @@ import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; +import static at.gv.zustellung.msg.xsd.persondata.IdentificationType.Value.valueBuilder; +import static at.gv.zustellung.msg.xsd.persondata.IdentificationType.identificationTypeBuilder; import static org.assertj.core.api.Assertions.assertThat; /** @@ -80,4 +83,36 @@ public class Mzs2MsgConverterTest { } } + + @Test + public void testCanConvertValidMzsRequestToMsgRequestWithIdentificationFromTNVZ() throws IOException { + + var fileName = basePath + "/validMzsDeliveryRequest.xml"; + + var idFromTNVZ = identificationTypeBuilder() + .withType("some-id-type") + .withValue(valueBuilder().withValue("some-id-value").build()) + .build(); + + try (var inputStream = new BufferedInputStream(new FileInputStream(fileName))) { + + JAXBElement<DeliveryRequestType> mzsRequest = mzsMarshaller.unmarshallXml(inputStream); + + var msgRequest = converter.convert(mzsRequest.getValue(), idFromTNVZ); + + var jaxbMsgRequest = new ObjectFactory().createDeliveryRequest(msgRequest); + + String msgRequestXML = msgMarshaller.marshallXml(jaxbMsgRequest); + + logger.info(msgRequestXML); + + assertThat(msgRequestXML) + .contains("<AppDeliveryID>valid-delivery-request-id</AppDeliveryID>") + .contains("some-id-type") + .contains("some-id-value") + .doesNotContain("Mustermann1") + .doesNotContain("Maxi"); + } + + } } |