1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.ingest;
17
18 import org.apache.commons.io.IOUtils;
19 import org.apache.log4j.Logger;
20 import org.junit.Test;
21 import org.kuali.ole.OLEConstants;
22
23 import java.io.ByteArrayInputStream;
24 import java.util.Map;
25
26 import static junit.framework.Assert.assertTrue;
27
28 public class OlePatronXMLSchemaValidation_UT {
29
30 private static final Logger LOG = Logger.getLogger(OlePatronXMLSchemaValidation_UT.class);
31 private static final String PATRON_XML_FILE = "samplePatronRecord.xml";
32
33 @Test
34 public void testPatronXMLSchemaValidation() throws Exception {
35 byte[] patronByteArray;
36 patronByteArray = IOUtils.toByteArray(getClass().getResourceAsStream(PATRON_XML_FILE));
37 ByteArrayInputStream patronSchemaByteArray = new ByteArrayInputStream(patronByteArray);
38 OlePatronXMLSchemaValidator olePatronXMLSchemaValidator = new OlePatronXMLSchemaValidator();
39
40 Map validateResultMap = olePatronXMLSchemaValidator.validateContentsAgainstSchema(patronSchemaByteArray);
41 boolean schemaFlag = (boolean)validateResultMap.get(OLEConstants.OlePatron.PATRON_XML_ISVALID);
42
43 assertTrue(schemaFlag);
44 }
45
46 }