aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/config
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-06-28 09:20:02 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-06-28 09:20:02 +0200
commit7eb6db5c837db22055b51988031920599a7e7270 (patch)
tree16defb166a7c65aac1bd927be48d6b79de2d2021 /src/main/java/at/gv/egiz/moazs/config
parent52306ddf6e786bd1ceaba09cbe37b42778b715fe (diff)
downloadmoa-zs-7eb6db5c837db22055b51988031920599a7e7270.tar.gz
moa-zs-7eb6db5c837db22055b51988031920599a7e7270.tar.bz2
moa-zs-7eb6db5c837db22055b51988031920599a7e7270.zip
Refactor: Deduplicate Code by Simplifying MarshallerConfig
- Move JaxbM initialization into Marshaller such that it can be used in tests without Spring's Application Context. - Remove SpringRunner from Mzs2MsgConverter Test, which makes the test run faster.
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/config')
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java47
1 files changed, 2 insertions, 45 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java b/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java
index bde33c1..38f4c1a 100644
--- a/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java
+++ b/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java
@@ -13,56 +13,13 @@ import java.util.HashMap;
public class MarshallerConfig {
@Bean
- public NamespacePrefixMapper msgMapper() {
- return new MoaZSPrefixMapper(false);
- }
-
- @Bean
- public NamespacePrefixMapper mzsMapper() {
- return new MoaZSPrefixMapper(true);
- }
-
- @Bean
- public Jaxb2Marshaller mzsJaxbMarshaller() {
- Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
-
- marshaller.setClassesToBeBound(
- at.gv.zustellung.app2mzs.xsd.ObjectFactory.class,
- at.gv.zustellung.app2mzs.xsd.persondata.ObjectFactory.class,
- at.gv.zustellung.msg.xsd.ObjectFactory.class);
-
- var map = new HashMap<String, Object>();
- map.put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true);
- map.put("com.sun.xml.bind.namespacePrefixMapper", mzsMapper());
- marshaller.setMarshallerProperties(map);
-
- return marshaller;
- }
-
- @Bean
- public Jaxb2Marshaller msgJaxbMarshaller() {
- Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
-
- marshaller.setClassesToBeBound(
- at.gv.zustellung.msg.xsd.ObjectFactory.class,
- at.gv.zustellung.msg.xsd.persondata.ObjectFactory.class);
-
- var map = new HashMap<String, Object>();
- map.put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true);
- map.put("com.sun.xml.bind.namespacePrefixMapper", msgMapper());
- marshaller.setMarshallerProperties(map);
-
- return marshaller;
- }
-
- @Bean
public Marshaller mzsMarshaller() {
- return new Marshaller(mzsJaxbMarshaller());
+ return new Marshaller(true);
}
@Bean
public Marshaller msgMarshaller() {
- return new Marshaller(msgJaxbMarshaller());
+ return new Marshaller(false);
}