01: /*
02: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * All rights reserved.
04: * [See end of file]
05: */
06:
07: package com.hp.hpl.jena.n3.turtle.test;
08:
09: import junit.framework.Test;
10: import junit.framework.TestSuite;
11:
12: import com.hp.hpl.jena.util.junit.TestFactoryManifest;
13: import com.hp.hpl.jena.util.junit.TestUtils;
14: import com.hp.hpl.jena.rdf.model.Resource;
15: import com.hp.hpl.jena.vocabulary.RDF;
16:
17: public class TurtleTestFactory extends TestFactoryManifest {
18:
19: public static TestSuite make(String filename) {
20: return new TurtleTestFactory().process(filename);
21: }
22:
23: public Test makeTest(Resource manifest, Resource item,
24: String testName, Resource action, Resource result) {
25: try {
26: Resource r = TestUtils.getResource(item, RDF.type);
27: Resource input = TestUtils.getResource(action,
28: TurtleTestVocab.input);
29: Resource output = TestUtils.getResource(result,
30: TurtleTestVocab.output);
31: Resource inputIRIr = TestUtils.getResource(action,
32: TurtleTestVocab.inputIRI);
33: String baseIRI = (inputIRIr == null) ? null : inputIRIr
34: .getURI();
35:
36: if (r.equals(TurtleTestVocab.TestInOut)) {
37: return new TestTurtle(testName, input.getURI(), output
38: .getURI(), baseIRI);
39: }
40:
41: if (r.equals(TurtleTestVocab.TestSyntax)) {
42: return new TestSyntax(testName, input.getURI());
43: }
44:
45: if (r.equals(TurtleTestVocab.TestBadSyntax)) {
46: return new TestBadSyntax(testName, input.getURI());
47: }
48:
49: //if ( r.equals(TurtleTestVocab.TestSurpeessed ))
50: // return new TestSupressed(testName, null) ;
51:
52: System.err.println("Unrecognized test : " + testName);
53: return null;
54:
55: } catch (Exception ex) {
56: ex.printStackTrace(System.err);
57: System.err.println("Failed to grok test : " + testName);
58: return null;
59: }
60:
61: }
62: }
63:
64: /*
65: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
66: * All rights reserved.
67: *
68: * Redistribution and use in source and binary forms, with or without
69: * modification, are permitted provided that the following conditions
70: * are met:
71: * 1. Redistributions of source code must retain the above copyright
72: * notice, this list of conditions and the following disclaimer.
73: * 2. Redistributions in binary form must reproduce the above copyright
74: * notice, this list of conditions and the following disclaimer in the
75: * documentation and/or other materials provided with the distribution.
76: * 3. The name of the author may not be used to endorse or promote products
77: * derived from this software without specific prior written permission.
78: *
79: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
80: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
81: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
82: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
83: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
84: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
85: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
86: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
87: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
88: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
89: */
|