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