View Javadoc
1   /*
2    * Copyright 2012 The Kuali Foundation.
3    *
4    * Licensed under the Educational Community License, Version 1.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl1.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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  
22  import java.io.ByteArrayInputStream;
23  
24  import static junit.framework.Assert.assertTrue;
25  
26  public class OleLocationXMLSchemaValidation_UT {
27  
28      private static final Logger LOG = Logger.getLogger(OleLocationXMLSchemaValidation_UT.class);
29      private static final String LOCATION_XML_FILE = "DefaultLibraryLocations.xml";
30  
31      @Test
32      public void testLocationXMLSchemaValidation() throws Exception {
33          byte[] locationByteArray;
34          locationByteArray = IOUtils.toByteArray(getClass().getResourceAsStream(LOCATION_XML_FILE));
35          ByteArrayInputStream locationSchemaByteArray = new ByteArrayInputStream(locationByteArray);
36          OleLocationXMLSchemaValidator oleLocationXMLSchemaValidator = new OleLocationXMLSchemaValidator();
37          boolean schemaFlag = oleLocationXMLSchemaValidator.validateContentsAgainstSchema(locationSchemaByteArray);
38          assertTrue(schemaFlag);
39      }
40  
41  }