Source Code Cross Referenced for TestGraph.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » graph » 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.graph.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:          (c) Copyright 2002, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003:          [See end of file]
004:          $Id: TestGraph.java,v 1.30 2008/01/02 12:05:34 andy_seaborne Exp $
005:         */
006:
007:        package com.hp.hpl.jena.graph.test;
008:
009:        /**
010:         Tests that check GraphMem and WrappedGraph for correctness against the Graph
011:         and reifier test suites.
012:        
013:         @author kers
014:         */
015:
016:        import com.hp.hpl.jena.mem.*;
017:        import com.hp.hpl.jena.shared.ReificationStyle;
018:        import com.hp.hpl.jena.util.CollectionFactory;
019:        import com.hp.hpl.jena.util.iterator.ExtendedIterator;
020:        import com.hp.hpl.jena.graph.*;
021:        import com.hp.hpl.jena.graph.impl.*;
022:
023:        import java.util.*;
024:
025:        import junit.framework.*;
026:
027:        public class TestGraph extends GraphTestBase {
028:            public TestGraph(String name) {
029:                super (name);
030:            }
031:
032:            /**
033:                Answer a test suite that runs the Graph and Reifier tests on GraphMem and on
034:                WrappedGraphMem, the latter standing in for testing WrappedGraph.
035:             */
036:            public static TestSuite suite() {
037:                TestSuite result = new TestSuite(TestGraph.class);
038:                result.addTest(suite(MetaTestGraph.class, GraphMem.class));
039:                result.addTest(suite(TestReifier.class, GraphMem.class));
040:                result.addTest(suite(MetaTestGraph.class, SmallGraphMem.class));
041:                result.addTest(suite(TestReifier.class, SmallGraphMem.class));
042:                result
043:                        .addTest(suite(MetaTestGraph.class,
044:                                WrappedGraphMem.class));
045:                result.addTest(suite(TestReifier.class, WrappedGraphMem.class));
046:                return result;
047:            }
048:
049:            public static TestSuite suite(Class classWithTests, Class graphClass) {
050:                return MetaTestGraph.suite(classWithTests, graphClass);
051:            }
052:
053:            /**
054:                Trivial [incomplete] test that a Wrapped graph pokes through to the underlying
055:                graph. Really want something using mock classes. Will think about it. 
056:             */
057:            public void testWrappedSame() {
058:                Graph m = Factory.createGraphMem();
059:                Graph w = new WrappedGraph(m);
060:                graphAdd(m, "a trumps b; c eats d");
061:                assertIsomorphic(m, w);
062:                graphAdd(w, "i write this; you read that");
063:                assertIsomorphic(w, m);
064:            }
065:
066:            /**
067:                Class to provide a constructor that produces a wrapper round a GraphMem.    
068:            	@author kers
069:             */
070:            public static class WrappedGraphMem extends WrappedGraph {
071:                public WrappedGraphMem(ReificationStyle style) {
072:                    super (Factory.createGraphMem(style));
073:                }
074:            }
075:
076:            public void testListSubjectsDoesntUseFind() {
077:                final boolean[] called = { false };
078:
079:                Graph g = Factory.createGraphMem();
080:
081:                ExtendedIterator subjects = g.queryHandler().subjectsFor(null,
082:                        null);
083:                Set s = CollectionFactory.createHashedSet();
084:                while (subjects.hasNext())
085:                    s.add(subjects.next());
086:                assertFalse("find should not have been called", called[0]);
087:            }
088:
089:            public void testListPredicatesDoesntUseFind() {
090:                final boolean[] called = { false };
091:
092:                Graph g = Factory.createGraphMem();
093:
094:                ExtendedIterator predicates = g.queryHandler().predicatesFor(
095:                        null, null);
096:                Set s = CollectionFactory.createHashedSet();
097:                while (predicates.hasNext())
098:                    s.add(predicates.next());
099:                assertFalse("find should not have been called", called[0]);
100:            }
101:
102:            public void testListObjectsDoesntUseFind() {
103:                final boolean[] called = { false };
104:
105:                Graph g = Factory.createGraphMem();
106:
107:                ExtendedIterator subjects = g.queryHandler().objectsFor(null,
108:                        null);
109:                Set s = CollectionFactory.createHashedSet();
110:                while (subjects.hasNext())
111:                    s.add(subjects.next());
112:                assertFalse("find should not have been called", called[0]);
113:            }
114:        }
115:
116:        /*
117:         (c) Copyright 2002, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
118:         All rights reserved.
119:
120:         Redistribution and use in source and binary forms, with or without
121:         modification, are permitted provided that the following conditions
122:         are met:
123:
124:         1. Redistributions of source code must retain the above copyright
125:         notice, this list of conditions and the following disclaimer.
126:
127:         2. Redistributions in binary form must reproduce the above copyright
128:         notice, this list of conditions and the following disclaimer in the
129:         documentation and/or other materials provided with the distribution.
130:
131:         3. The name of the author may not be used to endorse or promote products
132:         derived from this software without specific prior written permission.
133:
134:         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
135:         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
136:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
137:         IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
138:         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
139:         NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
140:         DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
141:         THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
142:         (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
143:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
144:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.