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.OleBaseTestCase;
22 import java.io.ByteArrayInputStream;
23 import java.io.InputStream;
24
25 import static junit.framework.Assert.assertTrue;
26
27 public class OlePatronXMLSchemaValidation_UT extends OleBaseTestCase {
28
29 private static final Logger LOG = Logger.getLogger(OlePatronXMLSchemaValidation_UT.class);
30 private static final String PATRON_XML_FILE = "samplePatronRecord.xml";
31
32 @Test
33 public void testPatronXMLSchemaValidation() throws Exception {
34 byte[] patronByteArray;
35 patronByteArray = IOUtils.toByteArray(getClass().getResourceAsStream(PATRON_XML_FILE));
36 ByteArrayInputStream patronSchemaByteArray = new ByteArrayInputStream(patronByteArray);
37 OlePatronXMLSchemaValidator olePatronXMLSchemaValidator = new OlePatronXMLSchemaValidator();
38 boolean schemaFlag=olePatronXMLSchemaValidator.validateContentsAgainstSchema(patronSchemaByteArray);
39 assertTrue(schemaFlag);
40 }
41
42 }