1 package org.kuali.ole;
2
3 import org.apache.commons.io.FileUtils;
4 import org.junit.Test;
5 import org.kuali.ole.docstore.xstream.FileUtil;
6
7 import java.io.File;
8 import java.net.URL;
9
10 import static junit.framework.Assert.assertNotNull;
11
12
13
14
15
16
17
18
19 public class MarcXMLGenerator_UT {
20 @Test
21 public void testGenerateMarcXML() throws Exception {
22 MarcXMLGenerator marcXMLGenerator = new MarcXMLGenerator();
23
24 URL resource = getClass().getResource("duke.mrc");
25 File file = new File(resource.toURI());
26
27 String marcXMLFileName = marcXMLGenerator.convertRawMarcToXML(file);
28 assertNotNull(marcXMLFileName);
29
30 File marcXMLFile = new File(marcXMLFileName);
31 String marcXML = new FileUtil().readFile(marcXMLFile);
32 System.out.println(marcXML);
33
34 FileUtils.deleteQuietly(marcXMLFile);
35
36 }
37
38 @Test
39 public void testGenerateMarcXMLFromRawMarcContent() throws Exception {
40 MarcXMLGenerator marcXMLGenerator = new MarcXMLGenerator();
41 URL resource = getClass().getResource("iu.mrc");
42 File file = new File(resource.toURI());
43
44 String fileContent = new FileUtilForRawMarc().readFile(file);
45
46 String marcContent = marcXMLGenerator.convert(fileContent);
47 assertNotNull(marcContent);
48 System.out.println(marcContent);
49 }
50 }