View Javadoc
1   package org.kuali.ole.docstore.xstream.work.instance.oleml;
2   
3   import org.apache.commons.io.FileUtils;
4   import org.junit.Before;
5   import org.junit.Test;
6   import org.kuali.ole.docstore.model.xmlpojo.work.instance.oleml.SourceHoldings;
7   import org.kuali.ole.docstore.model.xstream.work.instance.oleml.WorkSourceHoldingOlemlRecordProcessor;
8   import org.kuali.ole.docstore.xstream.BaseTestCase;
9   import org.slf4j.Logger;
10  import org.slf4j.LoggerFactory;
11  
12  import java.io.File;
13  import java.net.URL;
14  
15  import static org.junit.Assert.assertNotNull;
16  
17  /**
18   * Created by IntelliJ IDEA.
19   * User: Pranitha
20   * Date: 9/4/12
21   * Time: 12:28 PM
22   * To change this template use File | Settings | File Templates.
23   */
24  public class WorkSourceHoldingsOlemlRecordProcessor_UT
25          extends BaseTestCase {
26  
27      private static final Logger LOG = LoggerFactory.getLogger(WorkSourceHoldingsOlemlRecordProcessor_UT.class);
28  
29      @Before
30      public void setUp() throws Exception {
31          super.setUp();
32      }
33  
34      @Test
35      public void testFromXMLAndToXmlInstanceCollection() throws Exception {
36          WorkSourceHoldingOlemlRecordProcessor srHolRecordProcessor = new WorkSourceHoldingOlemlRecordProcessor();
37          URL url = getClass().getResource("/org/kuali/ole/SourceHolding-Sample.xml");
38          File file = new File(url.toURI());
39          SourceHoldings sourceHoldings = srHolRecordProcessor.fromXML(FileUtils.readFileToString(file));
40          assertNotNull(sourceHoldings);
41          String xml = srHolRecordProcessor.toXML(sourceHoldings);
42          LOG.info("Generated XML : " + xml);
43          LOG.info("GENERATED XML: ");
44          LOG.info(xml);
45          assertNotNull(xml);
46      }
47  
48  }