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


001:        /*
002:         * (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP All rights
003:         * reserved.
004:         * 
005:         * Redistribution and use in source and binary forms, with or without
006:         * modification, are permitted provided that the following conditions are met: 1.
007:         * Redistributions of source code must retain the above copyright notice, this
008:         * list of conditions and the following disclaimer. 2. Redistributions in
009:         * binary form must reproduce the above copyright notice, this list of
010:         * conditions and the following disclaimer in the documentation and/or other
011:         * materials provided with the distribution. 3. The name of the author may not
012:         * be used to endorse or promote products derived from this software without
013:         * specific prior written permission.
014:         * 
015:         * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
016:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
017:         * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
018:         * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
019:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
020:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
021:         * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
022:         * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
023:         * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
024:         * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
025:         * 
026:         * $Id: TestCaseBasic.java,v 1.14 2008/01/15 08:19:28 chris-dollin Exp $
027:         */
028:
029:        package com.hp.hpl.jena.regression;
030:
031:        import com.hp.hpl.jena.rdf.model.*;
032:        import com.hp.hpl.jena.test.JenaTestBase;
033:
034:        /**
035:         * <p>
036:         * This is a wrapper class, which implements a set of basic regression tests as
037:         * a set of JUnit tests.
038:         * </p>
039:         * 
040:         * <p>
041:         * This is the first step of reworking the old Regression tests as a JUnit test
042:         * suite. This is a simple wrapper class for the Regression test package. The
043:         * idea is that if time permits (fat chance) the old regression tests will be
044:         * reworked properly into this framework.
045:         * </p>
046:         * 
047:         * <p>
048:         * This class is inteded to be subclassed with setup and teardown methods to
049:         * create models required for the tests.
050:         * </p>
051:         * 
052:         * @author bwm
053:         * @version $Name:  $ $Revision: 1.14 $ $Date: 2008/01/15 08:19:28 $
054:         */
055:        public class TestCaseBasic extends JenaTestBase {
056:
057:            protected Model m1 = null;
058:            protected Model m2 = null;
059:            protected Model m3 = null;
060:            protected Model m4 = null;
061:
062:            public TestCaseBasic(String name) {
063:                super (name);
064:            }
065:
066:            public void test0() {
067:                // empty the test models in case they are persistent
068:                empty(m1);
069:                empty(m2);
070:                empty(m3);
071:                empty(m4);
072:            }
073:
074:            protected void empty(Model m) {
075:                try {
076:                    StmtIterator iter = m.listStatements();
077:                    while (iter.hasNext()) {
078:                        iter.nextStatement();
079:                        iter.remove();
080:                    }
081:                    assertTrue(m.size() == 0);
082:                } catch (Exception e) {
083:                    System.err.println(e);
084:                    assertTrue(false);
085:                }
086:            }
087:
088:            public void test1() {
089:                try {
090:                    Regression test = new Regression();
091:                    test.test1(m1);
092:                    assertTrue(!test.getErrors());
093:                } catch (Exception e) {
094:                    System.out.println(e);
095:                    assertTrue(false);
096:                }
097:            }
098:
099:            public void test2() {
100:                try {
101:                    Regression test = new Regression();
102:                    test.test2(m1);
103:                    assertTrue(!test.getErrors());
104:                } catch (Exception e) {
105:                    System.out.println(e);
106:                    assertTrue(false);
107:                }
108:            }
109:
110:            public void test3() {
111:                try {
112:                    Regression test = new Regression();
113:                    test.test3(m1);
114:                    assertTrue(!test.getErrors());
115:                } catch (Exception e) {
116:                    System.out.println(e);
117:                    assertTrue(false);
118:                }
119:            }
120:
121:            public void test4() {
122:                try {
123:                    Regression test = new Regression();
124:                    test.test4(m1);
125:                    assertTrue(!test.getErrors());
126:                } catch (Exception e) {
127:                    System.out.println(e);
128:                    assertTrue(false);
129:                }
130:            }
131:
132:            public void test5() {
133:                try {
134:                    Regression test = new Regression();
135:                    test.test5(m1);
136:                    assertTrue(!test.getErrors());
137:                } catch (Exception e) {
138:                    System.out.println(e);
139:                    assertTrue(false);
140:                }
141:            }
142:
143:            public void test6() throws Exception {
144:                try {
145:                    Regression test = new Regression();
146:                    test.test6(m1);
147:                    assertTrue(!test.getErrors());
148:                } catch (Exception e) {
149:                    //			System.out.println(e);
150:                    //			assertTrue(false);
151:                    System.err.println("PONGLE");
152:                    throw e;
153:                }
154:            }
155:
156:            public void test7() {
157:                try {
158:                    Regression test = new Regression();
159:                    test.test7(m1, m2);
160:                    assertTrue(!test.getErrors());
161:                } catch (Exception e) {
162:                    System.out.println(e);
163:                    assertTrue(false);
164:                }
165:            }
166:
167:            public void test8() {
168:                try {
169:                    Regression test = new Regression();
170:                    test.test8(m1);
171:                    assertTrue(!test.getErrors());
172:                } catch (Exception e) {
173:                    System.out.println(e);
174:                    assertTrue(false);
175:                }
176:            }
177:
178:            public void test9() {
179:                try {
180:                    Regression test = new Regression();
181:                    test.test9(m2);
182:                    assertTrue(!test.getErrors());
183:                } catch (Exception e) {
184:                    System.out.println(e);
185:                    assertTrue(false);
186:                }
187:            }
188:
189:            public void test10() {
190:                try {
191:                    Regression test = new Regression();
192:                    test.test10(m3);
193:                    assertTrue(!test.getErrors());
194:                } catch (Exception e) {
195:                    System.out.println(e);
196:                    assertTrue(false);
197:                }
198:            }
199:
200:            public void test11() {
201:                try {
202:                    Regression test = new Regression();
203:                    test.test11(m1, m2);
204:                    assertTrue(!test.getErrors());
205:                } catch (Exception e) {
206:                    System.out.println(e);
207:                    assertTrue(false);
208:                }
209:            }
210:
211:            public void test12() {
212:                try {
213:                    Regression test = new Regression();
214:                    test.test12(m1);
215:                    assertTrue(!test.getErrors());
216:                } catch (Exception e) {
217:                    System.out.println(e);
218:                    assertTrue(false);
219:                }
220:            }
221:
222:            public void test13() {
223:                try {
224:                    Regression test = new Regression();
225:                    test.test13(m1);
226:                    assertTrue(!test.getErrors());
227:                } catch (Exception e) {
228:                    System.out.println(e);
229:                    assertTrue(false);
230:                }
231:            }
232:
233:            public void test14() {
234:                try {
235:                    Regression test = new Regression();
236:                    test.test14(m1);
237:                    assertTrue(!test.getErrors());
238:                } catch (Exception e) {
239:                    System.out.println(e);
240:                    assertTrue(false);
241:                }
242:            }
243:
244:            public void test15() {
245:                try {
246:                    Regression test = new Regression();
247:                    test.test15(m1);
248:                    assertTrue(!test.getErrors());
249:                } catch (Exception e) {
250:                    System.out.println(e);
251:                    assertTrue(false);
252:                }
253:            }
254:
255:            public void test16() {
256:                try {
257:                    Regression test = new Regression();
258:                    test.test16(m1);
259:                    assertTrue(!test.getErrors());
260:                } catch (Exception e) {
261:                    System.out.println(e);
262:                    assertTrue(false);
263:                }
264:            }
265:
266:            public void test17() {
267:                try {
268:                    Regression test = new Regression();
269:                    test.test17(m1);
270:                    assertTrue(!test.getErrors());
271:                } catch (Exception e) {
272:                    System.out.println(e);
273:                    assertTrue(false);
274:                }
275:            }
276:
277:            public void test18() {
278:                try {
279:                    Regression test = new Regression();
280:                    test.test18(m4);
281:                    assertTrue(!test.getErrors());
282:                } catch (Exception e) {
283:                    System.out.println(e);
284:                    assertTrue(false);
285:                }
286:            }
287:
288:            public void test19() {
289:                try {
290:                    Regression test = new Regression();
291:                    test.test19(m2, m3);
292:                    assertTrue(!test.getErrors());
293:                } catch (Exception e) {
294:                    System.out.println(e);
295:                    assertTrue(false);
296:                }
297:            }
298:
299:            public void test97() {
300:                try {
301:                    Regression test = new Regression();
302:                    test.test97(m1);
303:                    assertTrue(!test.getErrors());
304:                } catch (Exception e) {
305:                    System.out.println(e);
306:                    assertTrue(false);
307:                }
308:            }
309:
310:            private GetModel getGetModel() {
311:                return new GetModel() {
312:
313:                    Model cache[] = new Model[4];
314:                    int i = 4;
315:
316:                    public Model get() {
317:                        if (i == 4) {
318:                            try {
319:                                tearDown();
320:                                setUp();
321:                            } catch (Exception e) {
322:                                throw new RuntimeException(e.getMessage());
323:                            }
324:                            cache[0] = m1;
325:                            cache[1] = m2;
326:                            cache[2] = m3;
327:                            cache[3] = m4;
328:                            i = 0;
329:                        }
330:                        return cache[i++];
331:                    }
332:                };
333:            }
334:
335:            public void testMatch() {
336:                try {
337:                    testMatch test = new testMatch(0xfab, getGetModel());
338:                    test.test();
339:                    assertTrue(!test.getErrors());
340:                } catch (Exception e) {
341:                    System.out.println(e);
342:                    assertTrue(false);
343:                }
344:            }
345:
346:            /*
347:             * public void testWriterAndReader() { try { testWriterAndReader test = new
348:             * testWriterAndReader(); test.test(m1,m2,m3,m4); assertTrue(!
349:             * test.getErrors()); } catch (Exception e) { System.out.println(e);
350:             * assertTrue(false); } }
351:             */
352:            public void testNTripleReader() {
353:                try {
354:                    testNTripleReader test = new testNTripleReader();
355:                    test.test(m1);
356:                    assertTrue(!test.getErrors());
357:                } catch (Exception e) {
358:                    System.out.println(e);
359:                    assertTrue(false);
360:                }
361:            }
362:
363:            /*
364:             * public void testWriterInterface() { try { testWriterInterface test = new
365:             * testWriterInterface(); test.test(m1); assertTrue(! test.getErrors()); }
366:             * catch (Exception e) { System.out.println(e); assertTrue(false); } }
367:             */
368:            public void testReaderInterface() {
369:                try {
370:                    testReaderInterface test = new testReaderInterface();
371:                    test.test(m1);
372:                    assertTrue(!test.getErrors());
373:                } catch (Exception e) {
374:                    System.out.println(e);
375:                    assertTrue(false);
376:                }
377:            }
378:
379:            public void soaktest() { // a very crude soak test
380:                try {
381:                    int errCount = 0;
382:
383:                    for (int i = 1; i <= 100; i++) {
384:                        Regression test = new Regression();
385:                        test0();
386:                        test.test1(m1);
387:                        test.test2(m1);
388:                        test.test3(m1);
389:                        test.test4(m1);
390:                        test.test5(m1);
391:                        test.test6(m1);
392:                        test.test7(m1, m2);
393:                        test.test8(m1);
394:                        test.test9(m2);
395:                        test.test10(m3);
396:                        test.test11(m1, m2);
397:                        test.test12(m1);
398:                        test.test13(m1);
399:                        test.test14(m1);
400:                        test.test15(m1);
401:                        test.test16(m1);
402:                        test.test17(m1);
403:                        test.test18(m4);
404:                        test.test19(m2, m3);
405:                        test.test97(m1);
406:                        if (test.getErrors())
407:                            errCount++;
408:                        if ((i % 10) == 0) {
409:                            System.out.println("error count = " + errCount
410:                                    + " rounds = " + i);
411:                        }
412:                    }
413:                } catch (Exception e) {
414:                    System.out.println(e);
415:                    assertTrue(false);
416:                }
417:            }
418:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.