001: /*
002: (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: All rights reserved - see end of file.
004: $Id: NewRegressionGet.java,v 1.5 2008/01/02 12:07:04 andy_seaborne Exp $
005: */
006:
007: package com.hp.hpl.jena.regression;
008:
009: import junit.framework.*;
010:
011: import com.hp.hpl.jena.rdf.model.*;
012: import com.hp.hpl.jena.rdf.model.test.ModelTestBase;
013: import com.hp.hpl.jena.regression.Regression.ResTestObjF;
014: import com.hp.hpl.jena.vocabulary.RDF;
015:
016: public class NewRegressionGet extends ModelTestBase {
017: public NewRegressionGet(String name) {
018: super (name);
019: }
020:
021: public static TestSuite suite() {
022: return new TestSuite(NewRegressionGet.class);
023: }
024:
025: protected Model getModel() {
026: return ModelFactory.createDefaultModel();
027: }
028:
029: protected Model m;
030: protected Resource S;
031: protected Property P;
032:
033: public void setUp() {
034: m = getModel();
035: S = m.createResource("http://nowhere.man/subject");
036: P = m.createProperty("http://nowhere.man/predicate");
037: }
038:
039: public void tearDown() {
040: m = null;
041: S = null;
042: P = null;
043: }
044:
045: public void testGetResource() {
046: String uri = "http://aldabaran.hpl.hp.com/rdf/test4/a" + 110;
047: Resource r = m.getResource(uri);
048: assertEquals(uri, r.getURI());
049: }
050:
051: public void testGetResourceFactory() {
052: String uri = "http://aldabaran.hpl.hp.com/rdf/test4/a" + 120;
053: Resource r = m.getResource(uri, new ResTestObjF());
054: assertEquals(uri, r.getURI());
055: }
056:
057: public void testGetPropertyOneArg() {
058: String uri = "http://aldabaran.hpl.hp.com/rdf/test4/a" + 130;
059: Property p = m.getProperty(uri);
060: assertEquals(uri, p.getURI());
061: }
062:
063: public void testGetPropertyTwoArgs() {
064: String ns = "http://aldabaran.hpl.hp.com/rdf/test4/a" + 140
065: + "/";
066: Property p = m.getProperty(ns, "foo");
067: assertEquals(ns + "foo", p.getURI());
068: }
069:
070: public void testGetBag() {
071: String uri = "http://aldabaran.hpl.hp.com/rdf/test4/" + 150;
072: m.createBag(uri);
073: Bag b = m.getBag(uri);
074: assertEquals(uri, b.getURI());
075: assertTrue(m.contains(b, RDF.type, RDF.Bag));
076: }
077:
078: public void testGetAlt() {
079: String uri = "http://aldabaran.hpl.hp.com/rdf/test4/" + 160;
080: m.createAlt(uri);
081: Alt a = m.getAlt(uri);
082: assertEquals(uri, a.getURI());
083: assertTrue(m.contains(a, RDF.type, RDF.Alt));
084: }
085:
086: public void testGetSeq() {
087: String uri = "http://aldabaran.hpl.hp.com/rdf/test4/" + 170;
088: m.createSeq(uri);
089: Seq s = m.getSeq(uri);
090: assertEquals(uri, s.getURI());
091: assertTrue(m.contains(s, RDF.type, RDF.Seq));
092: }
093: }
094:
095: /*
096: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
097: * All rights reserved.
098: *
099: * Redistribution and use in source and binary forms, with or without
100: * modification, are permitted provided that the following conditions
101: * are met:
102: * 1. Redistributions of source code must retain the above copyright
103: * notice, this list of conditions and the following disclaimer.
104: * 2. Redistributions in binary form must reproduce the above copyright
105: * notice, this list of conditions and the following disclaimer in the
106: * documentation and/or other materials provided with the distribution.
107: * 3. The name of the author may not be used to endorse or promote products
108: * derived from this software without specific prior written permission.
109: *
110: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
111: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
112: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
113: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
114: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
115: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
116: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
117: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
118: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
119: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
120: */
|