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