001/*
002 * Copyright 2012 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 1.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl1.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.ole.ingest;
017
018import org.apache.commons.io.IOUtils;
019import org.apache.log4j.Logger;
020import org.junit.Test;
021
022import java.io.ByteArrayInputStream;
023
024import static junit.framework.Assert.assertTrue;
025
026public class OleLocationXMLSchemaValidation_UT {
027
028    private static final Logger LOG = Logger.getLogger(OleLocationXMLSchemaValidation_UT.class);
029    private static final String LOCATION_XML_FILE = "DefaultLibraryLocations.xml";
030
031    @Test
032    public void testLocationXMLSchemaValidation() throws Exception {
033        byte[] locationByteArray;
034        locationByteArray = IOUtils.toByteArray(getClass().getResourceAsStream(LOCATION_XML_FILE));
035        ByteArrayInputStream locationSchemaByteArray = new ByteArrayInputStream(locationByteArray);
036        OleLocationXMLSchemaValidator oleLocationXMLSchemaValidator = new OleLocationXMLSchemaValidator();
037        boolean schemaFlag = oleLocationXMLSchemaValidator.validateContentsAgainstSchema(locationSchemaByteArray);
038        assertTrue(schemaFlag);
039    }
040
041}