View Javadoc
1   package org.kuali.ole.docstore.xstream.work.bib.marc;
2   
3   import org.junit.Test;
4   import org.kuali.ole.docstore.model.xmlpojo.work.bib.marc.WorkBibMarcRecords;
5   import org.kuali.ole.docstore.model.xstream.work.bib.marc.WorkBibMarcRecordProcessor;
6   import org.kuali.ole.docstore.xstream.BaseTestCase;
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  import static junit.framework.Assert.assertNotNull;
15  
16  /**
17   * Created by IntelliJ IDEA.
18   * User: ND6967
19   * Date: 12/12/11
20   * Time: 3:27 PM
21   * To change this template use File | Settings | File Templates.
22   */
23  public class WorkBibMarcRecordProcessor_UT extends BaseTestCase {
24      //    private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(WorkBibMarcRecordProcessor_UT.class);
25      private static final Logger LOG = LoggerFactory.getLogger(WorkBibMarcRecordProcessor_UT.class);
26  
27  
28      @Test
29      public void testFromToXml() throws Exception {
30          WorkBibMarcRecordProcessor workBibMarcRecordProcessor = new WorkBibMarcRecordProcessor();
31          String resFile = "/bib/bib/marc/marc-one-record-xstream.xml";
32          URL resource = getClass().getResource(resFile);
33          File file = new File(resource.toURI());
34          String fileContent = new FileUtil().readFile(file);
35          WorkBibMarcRecords workBibMarcRecords = workBibMarcRecordProcessor.fromXML(fileContent);
36          assertNotNull(workBibMarcRecords);
37          String xml = workBibMarcRecordProcessor.toXml(workBibMarcRecords);
38          // TODO: Need to compare the input xml and output xml.
39          LOG.info(xml);
40      }
41  
42  }