1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util.xml.jaxb;
17
18 import org.junit.Test;
19 import org.junit.runner.RunWith;
20 import org.kuali.common.util.log.log4j.model.Log4JConfiguration;
21 import org.kuali.common.util.log.log4j.model.Logger;
22 import org.kuali.common.util.project.spring.KualiUtilProjectConfig;
23 import org.kuali.common.util.xml.service.XmlService;
24 import org.slf4j.LoggerFactory;
25 import org.springframework.test.context.ContextConfiguration;
26 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
27
28 @RunWith(SpringJUnit4ClassRunner.class)
29 @ContextConfiguration(classes = { KualiUtilProjectConfig.class })
30 public class Log4XMLParseTest {
31
32 private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Log4XMLParseTest.class);
33
34 @Test
35 public void test() {
36 try {
37 Log4JConfiguration config = new Log4JConfiguration.Builder(Logger.DEFAULT).build();
38
39 XmlService service1 = new JAXBXmlService.Builder().useNamespaceAwareParser(false).useEclipseLinkMoxyProvider(false).build();
40
41 String xml1 = service1.toXml(config, "UTF-8");
42 logger.info(xml1);
43
44 XmlService service2 = new JAXBXmlService.Builder().useNamespaceAwareParser(false).useEclipseLinkMoxyProvider(true).build();
45 String xml2 = service2.toXml(config, "UTF-8");
46 logger.info(xml2);
47 } catch (Exception e) {
48 e.printStackTrace();
49 }
50 }
51
52 }