01: /*
02: (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: All rights reserved - see end of file.
04: $Id: TestRDBModelAssembler.java,v 1.10 2008/01/03 15:18:54 chris-dollin Exp $
05: */
06:
07: package com.hp.hpl.jena.assembler.test;
08:
09: import com.hp.hpl.jena.assembler.*;
10: import com.hp.hpl.jena.assembler.assemblers.RDBModelAssembler;
11: import com.hp.hpl.jena.rdf.model.*;
12: import com.hp.hpl.jena.shared.ReificationStyle;
13:
14: public class TestRDBModelAssembler extends AssemblerTestBase {
15: public TestRDBModelAssembler(String name) {
16: super (name);
17: }
18:
19: protected Class getAssemblerClass() {
20: return RDBModelAssembler.class;
21: }
22:
23: public void testRDBModelAssemblerType() {
24: testDemandsMinimalType(new RDBModelAssembler(), JA.RDBModel);
25: }
26:
27: public void testRDBModelVocabulary() {
28: Model m = model("x rdf:type ja:Connectable; x rdf:type ja:NamedModel");
29: Model answer = ModelExpansion.withSchema(m, JA.getSchema());
30: assertTrue("should infer x rdf:type ja:RDBModel", answer
31: .contains(statement("x rdf:type ja:RDBModel")));
32: }
33:
34: public void testInvokesCreateModel() {
35: Resource root = resourceInModel("x rdf:type ja:RDBModel; x ja:modelName 'spoo'; x ja:connection C");
36: final ConnectionDescription C = ConnectionDescription.create(
37: "eh:/x", "A", "B", "C", "D");
38: final Model fake = ModelFactory.createDefaultModel();
39: final Mode theMode = new Mode(true, true);
40: Assembler a = new RDBModelAssembler() {
41: public Model openModel(Resource root,
42: ConnectionDescription c, String name,
43: ReificationStyle style, Content initial, Mode mode) {
44: assertSame(C, c);
45: assertSame(theMode, mode);
46: return fake;
47: }
48: };
49: Assembler foo = new NamedObjectAssembler(resource("C"), C);
50: assertSame(fake, a.open(foo, root, theMode));
51: }
52: }
53:
54: /*
55: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
56: * All rights reserved.
57: *
58: * Redistribution and use in source and binary forms, with or without
59: * modification, are permitted provided that the following conditions
60: * are met:
61: * 1. Redistributions of source code must retain the above copyright
62: * notice, this list of conditions and the following disclaimer.
63: * 2. Redistributions in binary form must reproduce the above copyright
64: * notice, this list of conditions and the following disclaimer in the
65: * documentation and/or other materials provided with the distribution.
66: * 3. The name of the author may not be used to endorse or promote products
67: * derived from this software without specific prior written permission.
68: *
69: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
70: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
71: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
72: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
73: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
74: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
75: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
76: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
77: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
78: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
79: */
|