View Javadoc
1   /**
2    * Copyright 2010-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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  }