001 /*
002 * (c) Copyright 2010 University of Bristol
003 * All rights reserved.
004 * [See end of file]
005 */
006 package net.rootdev.javardfa;
007
008 import org.junit.AfterClass;
009 import org.junit.BeforeClass;
010 import org.junit.Test;
011 import static org.junit.Assert.*;
012
013 /**
014 *
015 * @author pldms
016 */
017 public class SimpleProfileCollectorTest {
018
019 public SimpleProfileCollectorTest() {
020 }
021
022 @BeforeClass
023 public static void setUpClass() throws Exception {
024 }
025
026 @AfterClass
027 public static void tearDownClass() throws Exception {
028 }
029
030 /**
031 * Test of getProfile method, of class SimpleProfileCollector.
032 */
033 @Test
034 public void testGetProfile() {
035 String profileURI = SimpleProfileCollectorTest.class.getResource("/query-tests/profile.xhtml").toExternalForm();
036 // Fix java stupidity -- again
037 profileURI = profileURI.replaceFirst("^file:/(?!/)", "file:///");
038 EvalContext context = new EvalContext("http://example.com/base");
039 ProfileCollector instance = new SimpleProfileCollector();
040 instance.getProfile(profileURI, context);
041 assertEquals("http://xmlns.com/foaf/0.2/", context.getURIForPrefix("foaf2"));
042 assertEquals("http://example.com/Rabbit", context.getURIForTerm("Rabbit"));
043 }
044
045 }
046
047 /*
048 * (c) Copyright 2010 University of Bristol
049 * All rights reserved.
050 *
051 * Redistribution and use in source and binary forms, with or without
052 * modification, are permitted provided that the following conditions
053 * are met:
054 * 1. Redistributions of source code must retain the above copyright
055 * notice, this list of conditions and the following disclaimer.
056 * 2. Redistributions in binary form must reproduce the above copyright
057 * notice, this list of conditions and the following disclaimer in the
058 * documentation and/or other materials provided with the distribution.
059 * 3. The name of the author may not be used to endorse or promote products
060 * derived from this software without specific prior written permission.
061 *
062 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
063 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
064 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
065 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
066 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
067 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
068 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
069 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
070 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
071 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
072 */