View Javadoc
1   package org.kuali.ole.utility;
2   
3   import org.junit.Test;
4   import org.kuali.ole.docstore.model.xmlpojo.work.instance.oleml.Item;
5   import org.kuali.ole.docstore.model.xmlpojo.work.instance.oleml.OleHoldings;
6   import org.kuali.ole.docstore.model.xstream.work.instance.oleml.WorkHoldingOlemlRecordProcessor;
7   import org.kuali.ole.docstore.xstream.FileUtil;
8   import org.slf4j.Logger;
9   import org.slf4j.LoggerFactory;
10  
11  import java.io.File;
12  import java.net.URL;
13  
14  /**
15   * Created by IntelliJ IDEA.
16   * User: SR8455
17   * Date: 12/27/12
18   * Time: 6:47 PM
19   * To change this template use File | Settings | File Templates.
20   */
21  public class WorkHoldingOlemlRecordProcessor_UT {
22      public static final Logger LOG = LoggerFactory.getLogger(WorkItemOlemlRecordProcessor_UT.class);
23  
24      @Test
25      public void testWorkItemOlemlRecordProcessor() {
26          try {
27              WorkHoldingOlemlRecordProcessor workHoldingOlemlRecordProcessor = new WorkHoldingOlemlRecordProcessor();
28              String resFile = "/bib/bib/dublin/Bib-Bib-DublinQ-Test2.xml";
29              URL resource = getClass().getResource(resFile);
30              File file = new File(resource.toURI());
31              String fileContent;
32              fileContent = new FileUtil().readFile(file);
33              OleHoldings oleHoldings = workHoldingOlemlRecordProcessor.fromXML(fileContent);
34              if (oleHoldings != null) {
35                  LOG.info(oleHoldings.toString());
36              }
37              String stringXml = workHoldingOlemlRecordProcessor.toXML(oleHoldings);
38              if (stringXml != null) {
39                  LOG.info(stringXml);
40              }
41          } catch (Exception e) {
42              LOG.info(e.getMessage());
43          }
44  
45      }
46  }