KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > rdf > model > test > TestModelSource


1 /*
2     (c) Copyright 2005 Hewlett-Packard Development Company, LP
3     All rights reserved.
4     [See end of file]
5 */

6
7 package com.hp.hpl.jena.rdf.model.test;
8
9 import com.hp.hpl.jena.rdf.model.*;
10 import com.hp.hpl.jena.rdf.model.ModelSource;
11
12 import junit.framework.TestSuite;
13
14 /**
15      Test cases driving ModelSource
16      @author kers
17 */

18 public class TestModelSource extends ModelTestBase
19     {
20
21
22     public TestModelSource( String JavaDoc name )
23         { super( name ); }
24
25     public static TestSuite suite()
26         { return new TestSuite( TestModelSource.class ); }
27     
28     public ModelSource getModelSource()
29         { return new ModelSourceImpl(); }
30     
31     public void testMethodsExist()
32         {
33         ModelSource s = getModelSource();
34         s.getModel();
35         s.createModel();
36         s.openModel( "spoo" );
37         s.openModelIfPresent( "flarn" );
38         }
39     
40     /**
41         Minimal test implementation of ModelSource. There should be more of
42         these.
43     
44         @author hedgehog
45     */

46     public static class ModelSourceImpl implements ModelSource
47         {
48         public Model openModel( String JavaDoc name )
49             { return ModelFactory.createDefaultModel(); }
50     
51         public Model openModelIfPresent(String JavaDoc name)
52             { return null; }
53     
54         Model theDefaultModel = ModelFactory.createDefaultModel();
55         
56         public Model getModel()
57             { return theDefaultModel; }
58
59         public Model createModel()
60             { return getModel(); }
61         }
62     }
63
64
65 /*
66  * (c) Copyright 2005 Hewlett-Packard Development Company, LP
67  * All rights reserved.
68  *
69  * Redistribution and use in source and binary forms, with or without
70  * modification, are permitted provided that the following conditions
71  * are met:
72  * 1. Redistributions of source code must retain the above copyright
73  * notice, this list of conditions and the following disclaimer.
74  * 2. Redistributions in binary form must reproduce the above copyright
75  * notice, this list of conditions and the following disclaimer in the
76  * documentation and/or other materials provided with the distribution.
77  * 3. The name of the author may not be used to endorse or promote products
78  * derived from this software without specific prior written permission.
79  *
80  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
81  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
82  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
83  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
84  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
85  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
86  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
87  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
88  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
89  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
90 */
Popular Tags