Source Code Cross Referenced for OntTestBase.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » ontology » impl » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.ontology.impl.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*****************************************************************************
002:         * Source code information
003:         * -----------------------
004:         * Original author    Ian Dickinson, HP Labs Bristol
005:         * Author email       Ian.Dickinson@hp.com
006:         * Package            Jena 2
007:         * Web                http://sourceforge.net/projects/jena/
008:         * Created            23-May-2003
009:         * Filename           $RCSfile: OntTestBase.java,v $
010:         * Revision           $Revision: 1.16 $
011:         * Release status     $State: Exp $
012:         *
013:         * Last modified on   $Date: 2008/01/02 12:08:39 $
014:         *               by   $Author: andy_seaborne $
015:         *
016:         * (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
017:         * (see footer for full conditions)
018:         *****************************************************************************/package com.hp.hpl.jena.ontology.impl.test;
019:
020:        // Imports
021:        ///////////////
022:        import java.util.*;
023:
024:        import com.hp.hpl.jena.ontology.*;
025:        import com.hp.hpl.jena.rdf.model.*;
026:        import com.hp.hpl.jena.reasoner.test.TestUtil;
027:
028:        import junit.framework.*;
029:
030:        /**
031:         * <p>
032:         * Generic test case for ontology unit testing
033:         * </p>
034:         *
035:         * @author Ian Dickinson, HP Labs
036:         *         (<a  href="mailto:Ian.Dickinson@hp.com" >email</a>)
037:         * @version CVS $Id: OntTestBase.java,v 1.16 2008/01/02 12:08:39 andy_seaborne Exp $
038:         */
039:        public abstract class OntTestBase extends TestSuite {
040:            // Constants
041:            //////////////////////////////////
042:
043:            public static final String BASE = "http://jena.hpl.hp.com/testing/ontology";
044:            public static final String NS = BASE + "#";
045:
046:            // Static variables
047:            //////////////////////////////////
048:
049:            // Instance variables
050:            //////////////////////////////////
051:
052:            // Constructors
053:            //////////////////////////////////
054:
055:            public OntTestBase(String name) {
056:                super (name);
057:                TestCase[] tc = getTests();
058:
059:                for (int i = 0; i < tc.length; i++) {
060:                    addTest(tc[i]);
061:                }
062:            }
063:
064:            // External signature methods
065:            //////////////////////////////////
066:
067:            // Internal implementation methods
068:            //////////////////////////////////
069:
070:            /** Return the array of tests for the suite */
071:            protected OntTestCase[] getTests() {
072:                return null;
073:            }
074:
075:            //==============================================================================
076:            // Inner class definitions
077:            //==============================================================================
078:
079:            protected abstract class OntTestCase extends TestCase {
080:                protected boolean m_inOWL;
081:                protected boolean m_inOWLLite;
082:                protected boolean m_inDAML;
083:                protected boolean m_inRDFS;
084:                protected String m_langElement;
085:                protected boolean m_owlLang = true;
086:                protected boolean m_owlLiteLang = false;
087:                protected boolean m_rdfsLang = false;
088:                protected boolean m_damlLang = false;
089:
090:                public OntTestCase(String langElement, boolean inOWL,
091:                        boolean inOWLLite, boolean inDAML, boolean inRDFS) {
092:                    super ("Ontology API test " + langElement);
093:                    m_langElement = langElement;
094:                    m_inOWL = inOWL;
095:                    m_inOWLLite = inOWLLite;
096:                    m_inDAML = inDAML;
097:                    m_inRDFS = inRDFS;
098:                }
099:
100:                public void runTest() throws Exception {
101:                    // we don't want inferencing for these unit tests
102:                    runTest(ModelFactory.createOntologyModel(
103:                            OntModelSpec.OWL_MEM, null), m_inOWL);
104:
105:                    m_owlLiteLang = true;
106:
107:                    runTest(ModelFactory.createOntologyModel(
108:                            OntModelSpec.OWL_LITE_MEM, null), m_inOWLLite);
109:
110:                    // now DAML
111:                    m_owlLang = false;
112:                    m_owlLiteLang = false;
113:                    m_damlLang = true;
114:
115:                    runTest(ModelFactory.createOntologyModel(
116:                            OntModelSpec.DAML_MEM, null), m_inDAML);
117:
118:                    // now RDFS
119:
120:                    m_rdfsLang = true;
121:                    m_damlLang = false;
122:                    runTest(ModelFactory.createOntologyModel(
123:                            OntModelSpec.RDFS_MEM, null), m_inRDFS);
124:                }
125:
126:                protected void runTest(OntModel m, boolean inModel)
127:                        throws Exception {
128:                    boolean profileEx = false;
129:
130:                    try {
131:                        ontTest(m);
132:                    } catch (ProfileException e) {
133:                        profileEx = true;
134:                    }
135:
136:                    assertEquals("language element " + m_langElement + " was "
137:                            + (inModel ? "" : "not") + " expected in model "
138:                            + m.getProfile().getLabel(), inModel, !profileEx);
139:                }
140:
141:                /** Does the work in the test sub-class */
142:                protected abstract void ontTest(OntModel m) throws Exception;
143:
144:                /** Test that an iterator delivers the expected values */
145:                protected void iteratorTest(Iterator i, Object[] expected) {
146:                    TestUtil.assertIteratorValues(this , i, expected);
147:                }
148:
149:                public void setUp() {
150:                    // ensure the ont doc manager is in a consistent state
151:                    OntDocumentManager.getInstance().reset(true);
152:                }
153:
154:                protected boolean owlFull() {
155:                    return m_owlLang && !m_owlLiteLang;
156:                }
157:
158:                /** Answer true if an iterator contains a given value */
159:                protected boolean iteratorContains(Iterator i, Object target) {
160:                    boolean found = false;
161:                    while (i.hasNext()) {
162:                        found = i.next().equals(target) || found;
163:                    }
164:                    return found;
165:                }
166:            }
167:        }
168:
169:        /*
170:         (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
171:         All rights reserved.
172:
173:         Redistribution and use in source and binary forms, with or without
174:         modification, are permitted provided that the following conditions
175:         are met:
176:
177:         1. Redistributions of source code must retain the above copyright
178:         notice, this list of conditions and the following disclaimer.
179:
180:         2. Redistributions in binary form must reproduce the above copyright
181:         notice, this list of conditions and the following disclaimer in the
182:         documentation and/or other materials provided with the distribution.
183:
184:         3. The name of the author may not be used to endorse or promote products
185:         derived from this software without specific prior written permission.
186:
187:         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
188:         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
189:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
190:         IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
191:         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
192:         NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
193:         DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
194:         THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
195:         (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
196:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
197:         */
w_w__w___._j_a_va_2__s__._c_om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.