001/*
002 * Copyright (c) 2004-2012, Willem Cazander
003 * All rights reserved.
004 *
005 * Redistribution and use in source and binary forms, with or without modification, are permitted provided
006 * that the following conditions are met:
007 * 
008 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the
009 *   following disclaimer.
010 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
011 *   the following disclaimer in the documentation and/or other materials provided with the distribution.
012 * 
013 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
014 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
015 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
016 * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
018 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
019 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
020 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
021 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
022 */
023
024package org.x4o.xml.impl;
025
026import org.x4o.xml.impl.config.DefaultX4OLanguageLoader;
027import org.x4o.xml.test.TestParser;
028
029import junit.framework.TestCase;
030
031/**
032 * Tests a simple x4o language loader
033 * 
034 * @author Willem Cazander
035 * @version 1.0 Jan 20, 2012
036 */
037public class DefaultX4OLanguageLoaderTest extends TestCase {
038
039        TestParser parser;
040        DefaultX4OLanguageLoader loader;
041        
042        public void setUp() throws Exception {
043                parser = new TestParser();
044                parser.parseResource("tests/namespace/uri-simple.xml");
045                loader = new DefaultX4OLanguageLoader();
046        }
047
048        public void testLanguageURINameSpaceTest() throws Exception {
049                loader.loadLanguage(parser.getElementLanguage(), "test", "1.0");
050        }
051        
052        /*
053        public void testLanguageURINameSpaceTest() throws Exception {
054                Map<String,String> languageMap = loader.loadLanguageModules(parser.getElementLanguage(), "test");
055                assertTrue("No uri for test.eld", languageMap.containsKey("eld.http://test.x4o.org/eld/test.eld"));
056                assertEquals("test.eld", languageMap.get("eld.http://test.x4o.org/eld/test.eld"));
057        }
058        
059        public void testLanguageURINameSpaceX4O() throws Exception {
060                Map<String,String> languageMap = loader.loadLanguageModules(parser.getElementLanguage(), "x4o");
061                assertTrue("No uri for x4o-lang.eld", languageMap.containsKey("eld.http://eld.x4o.org/eld/x4o-lang.eld"));
062                assertEquals("x4o-lang.eld", languageMap.get("eld.http://eld.x4o.org/eld/x4o-lang.eld"));
063        }
064        
065        public void testLanguageURINameSpaceELD() throws Exception {
066                Map<String,String> languageMap = loader.loadLanguageModules(parser.getElementLanguage(), "eld");
067                assertTrue("No uri for eld-lang.eld", languageMap.containsKey("eld.http://eld.x4o.org/eld/eld-lang.eld"));
068                assertEquals("eld-lang.eld", languageMap.get("eld.http://eld.x4o.org/eld/eld-lang.eld"));
069        }
070        */
071}