diff options
author | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-05-08 11:17:34 +0200 |
---|---|---|
committer | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-05-08 11:17:34 +0200 |
commit | 384e3b576fa4c4f349c5fcde7ffaea16e53c1c97 (patch) | |
tree | cfd8962503acde0d155233cd61c11ddae386abec /src/test/java/at/gv | |
parent | 1aaec2e6127b9b2261a97749daa15c23f0af7be1 (diff) | |
download | moa-zs-384e3b576fa4c4f349c5fcde7ffaea16e53c1c97.tar.gz moa-zs-384e3b576fa4c4f349c5fcde7ffaea16e53c1c97.tar.bz2 moa-zs-384e3b576fa4c4f349c5fcde7ffaea16e53c1c97.zip |
Fix Namespace Prefixes in Marshaled Messages (msg: instead of ns#:)
- Implement own NamespacePrefixMapper that maps prefixes depending on
whether a msg or a mzs object is being marshaled.
- Namespaces are not hardcoded but extracted from jaxb's generated
sources (somewhat indirect, can be considered a hack, but there's no
public API to extract namespaces)
Diffstat (limited to 'src/test/java/at/gv')
-rw-r--r-- | src/test/java/at/gv/egiz/moazs/Mzs2MsgConverterTest.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/Mzs2MsgConverterTest.java b/src/test/java/at/gv/egiz/moazs/Mzs2MsgConverterTest.java index 0c092aa..990559c 100644 --- a/src/test/java/at/gv/egiz/moazs/Mzs2MsgConverterTest.java +++ b/src/test/java/at/gv/egiz/moazs/Mzs2MsgConverterTest.java @@ -7,6 +7,7 @@ import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @@ -27,7 +28,11 @@ public class Mzs2MsgConverterTest { private Mzs2MsgConverter converter; @Autowired - private Marshaller marshaller; + private Marshaller mzsMarshaller; + + @Autowired + private Marshaller msgMarshaller; + @Test public void testCanConvertValidMzsRequestToMsgRequest() throws IOException { @@ -36,13 +41,15 @@ public class Mzs2MsgConverterTest { try (var inputStream = new BufferedInputStream(new FileInputStream(fileName))) { - JAXBElement<DeliveryRequestType> mzsRequest = marshaller.unmarshallXml(inputStream); + JAXBElement<DeliveryRequestType> mzsRequest = mzsMarshaller.unmarshallXml(inputStream); + + logger.info("mzs request: {}", mzsMarshaller.marshallXml(mzsRequest)); var msgRequest = converter.convert(mzsRequest.getValue()); var jaxbMsgRequest = new ObjectFactory().createDeliveryRequest(msgRequest); - String msgRequestXML = marshaller.marshallXml(jaxbMsgRequest); + String msgRequestXML = msgMarshaller.marshallXml(jaxbMsgRequest); logger.info("msg request: {}", msgRequestXML); @@ -57,7 +64,7 @@ public class Mzs2MsgConverterTest { try (var inputStream = new BufferedInputStream(new FileInputStream(fileName))) { - JAXBElement<DeliveryRequestType> mzsRequest = marshaller.unmarshallXml(inputStream); + JAXBElement<DeliveryRequestType> mzsRequest = mzsMarshaller.unmarshallXml(inputStream); converter.convert(mzsRequest.getValue()); |