Source Code Cross Referenced for ZKBTests.java in  » Rule-Engine » Mandarax » test » org » mandarax » zkb » 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 » Rule Engine » Mandarax » test.org.mandarax.zkb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:        package test.org.mandarax.zkb;
019:
020:        import junit.framework.Test;
021:        import junit.framework.TestSuite;
022:        import org.mandarax.zkb.*;
023:        import org.mandarax.zkb.framework.*;
024:        import org.mandarax.util.comparators.*;
025:        import java.util.*;
026:
027:        /**
028:         * Test suite for ZKB.
029:         * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
030:         * @version 3.4 <7 March 05>
031:         * @since 2.2
032:         */
033:        public class ZKBTests {
034:
035:            /**
036:             * Launch the test suite. See TestRunner for interpretation
037:             * of command line parameters.
038:             * @see test.org.mandarax.testsupport.TestRunner
039:             * @param args parameters
040:             */
041:            public static void main(String[] args) {
042:                org.apache.log4j.BasicConfigurator.configure();
043:                test.org.mandarax.testsupport.TestRunner.run(ZKBTests.class,
044:                        args);
045:            }
046:
047:            /**
048:             * Get the test suite.
049:             * @return the test suite
050:             */
051:            public static Test suite() {
052:                TestSuite suite = new TestSuite(
053:                        "Test cases for the mandarax ZKB module");
054:
055:                addTests(new ZKBDriver_1_0(), suite);
056:                addTests(new ZKBDriver_1_1(), suite);
057:                addTests(new ZKBDriver_2_0(), suite);
058:
059:                return suite;
060:            }
061:
062:            /**
063:             * Add tests for a certain driver to a test suite.
064:             * @param driver the ZKB driver tested
065:             * @param suite a test suite
066:             */
067:            private static void addTests(ZKBDriver driver, TestSuite suite) {
068:                addTests(driver, BinarySerializationOPS.class, suite, true);
069:                addTests(driver, XMLSerializationOPS.class, suite, true);
070:                addTests(driver, BinarySerializationOPS.class, suite, false);
071:                addTests(driver, XMLSerializationOPS.class, suite, false);
072:            }
073:
074:            /**
075:             * Add tests for a certain driver / OPS combination to a test suite.
076:             * @param driver the ZKB driver tested
077:             * @param ops the object persistency service class
078:             * @param suite a test suite
079:             * @param zipOrFolder whether the zkb is stored in a zip file or folder true - zip, false - folder
080:             */
081:            private static void addTests(ZKBDriver driver, Class opsClass,
082:                    TestSuite suite, boolean zipOrFolder) {
083:                try {
084:
085:                    // 1 clause set     
086:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
087:                            (ObjectPersistencyService) opsClass.newInstance(),
088:                            TestData.fact1(), "tc1", zipOrFolder));
089:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
090:                            (ObjectPersistencyService) opsClass.newInstance(),
091:                            TestData.fact2(), "tc2", zipOrFolder));
092:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
093:                            (ObjectPersistencyService) opsClass.newInstance(),
094:                            TestData.fact3(), "tc3", zipOrFolder));
095:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
096:                            (ObjectPersistencyService) opsClass.newInstance(),
097:                            TestData.fact4(), "tc4", zipOrFolder));
098:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
099:                            (ObjectPersistencyService) opsClass.newInstance(),
100:                            TestData.fact5(), "tc5", zipOrFolder));
101:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
102:                            (ObjectPersistencyService) opsClass.newInstance(),
103:                            TestData.fact6(), "tc6", zipOrFolder));
104:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
105:                            (ObjectPersistencyService) opsClass.newInstance(),
106:                            TestData.fact7(), "tc7", zipOrFolder));
107:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
108:                            (ObjectPersistencyService) opsClass.newInstance(),
109:                            TestData.fact8(), "tc8", zipOrFolder));
110:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
111:                            (ObjectPersistencyService) opsClass.newInstance(),
112:                            TestData.fact9(), "tc9", zipOrFolder));
113:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
114:                            (ObjectPersistencyService) opsClass.newInstance(),
115:                            TestData.fact10(), "tc10", zipOrFolder));
116:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
117:                            (ObjectPersistencyService) opsClass.newInstance(),
118:                            TestData.rule1(), "tc11", zipOrFolder));
119:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
120:                            (ObjectPersistencyService) opsClass.newInstance(),
121:                            TestData.andRule(), "tc12", zipOrFolder));
122:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
123:                            (ObjectPersistencyService) opsClass.newInstance(),
124:                            TestData.orRule(), "tc13", zipOrFolder));
125:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
126:                            (ObjectPersistencyService) opsClass.newInstance(),
127:                            TestData.sqlClauseSet(), "tc14", zipOrFolder));
128:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
129:                            (ObjectPersistencyService) opsClass.newInstance(),
130:                            TestData.negRule(), "tc15", zipOrFolder));
131:
132:                    // attachment
133:                    Object attachment = new java.util.Date();
134:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
135:                            (ObjectPersistencyService) opsClass.newInstance(),
136:                            TestData.fact1(), attachment, "tc16", zipOrFolder));
137:
138:                    // 1 query
139:                    suite.addTest(new ZKBTestCase4Queries(driver,
140:                            (ObjectPersistencyService) opsClass.newInstance(),
141:                            TestData.query1(), "tc17", zipOrFolder));
142:                    suite.addTest(new ZKBTestCase4Queries(driver,
143:                            (ObjectPersistencyService) opsClass.newInstance(),
144:                            TestData.query2(), "tc18", zipOrFolder));
145:                    suite.addTest(new ZKBTestCase4Queries(driver,
146:                            (ObjectPersistencyService) opsClass.newInstance(),
147:                            TestData.query3(), "tc19", zipOrFolder));
148:
149:                    // 2 clause sets/ 2 queries - check whether order is maintained
150:                    suite.addTest(new ZKBTestCase4ClauseSets(driver,
151:                            (ObjectPersistencyService) opsClass.newInstance(),
152:                            TestData.fact1(), TestData.fact2(), "tc20",
153:                            zipOrFolder));
154:                    suite.addTest(new ZKBTestCase4Queries(driver,
155:                            (ObjectPersistencyService) opsClass.newInstance(),
156:                            TestData.query1(), TestData.query2(), "tc21",
157:                            zipOrFolder));
158:
159:                    // comparator
160:                    DefaultClauseSetComparator comp = new DefaultClauseSetComparator();
161:                    suite.addTest(new ZKBTestCase4Comparators(driver,
162:                            (ObjectPersistencyService) opsClass.newInstance(),
163:                            comp, "tc22", zipOrFolder));
164:
165:                    // comparator with non default top level order
166:                    comp = new DefaultClauseSetComparator();
167:                    comp.setTopLevelOrder(new String[] { comp.RULES,
168:                            comp.FACTS, comp.SQL_CLAUSE_SETS, comp.OTHERS });
169:                    suite.addTest(new ZKBTestCase4Comparators(driver,
170:                            (ObjectPersistencyService) opsClass.newInstance(),
171:                            comp, "tc23", zipOrFolder));
172:
173:                    // comparator with non default comp order for rules
174:                    comp = new DefaultClauseSetComparator();
175:                    comp
176:                            .setComparators4Rules(new Comparator[] {
177:                                    new PreferRulesWithLessNegatedPrerequisites(),
178:                                    new PreferRulesWithMorePrerequisites(),
179:                                    new PreferRulesWithLessVariablesInPrerequisites() });
180:                    suite.addTest(new ZKBTestCase4Comparators(driver,
181:                            (ObjectPersistencyService) opsClass.newInstance(),
182:                            comp, "tc24", zipOrFolder));
183:
184:                    // test cases - not supported by older drivers
185:                    if (!(driver instanceof  ZKBDriver_1_0)
186:                            && !(driver instanceof  ZKBDriver_1_1)) {
187:                        suite.addTest(new ZKBTestCase4Testcases(driver,
188:                                (ObjectPersistencyService) opsClass
189:                                        .newInstance(), TestData.testCase1(),
190:                                "tc25", zipOrFolder));
191:                        suite.addTest(new ZKBTestCase4Testcases(driver,
192:                                (ObjectPersistencyService) opsClass
193:                                        .newInstance(), TestData.testCase2(),
194:                                "tc26", zipOrFolder));
195:                        suite.addTest(new ZKBTestCase4Testcases(driver,
196:                                (ObjectPersistencyService) opsClass
197:                                        .newInstance(), TestData.testCase3(),
198:                                "tc27", zipOrFolder));
199:                        suite.addTest(new ZKBTestCase4Testcases(driver,
200:                                (ObjectPersistencyService) opsClass
201:                                        .newInstance(), TestData.testCase4(),
202:                                "tc28", zipOrFolder));
203:                        suite.addTest(new ZKBTestCase4Testcases(driver,
204:                                (ObjectPersistencyService) opsClass
205:                                        .newInstance(), TestData.testCase5(),
206:                                "tc29", zipOrFolder));
207:                        suite.addTest(new ZKBTestCase4Testcases(driver,
208:                                (ObjectPersistencyService) opsClass
209:                                        .newInstance(), TestData.testCase5(),
210:                                "tc30", zipOrFolder));
211:                    }
212:                } catch (Exception x) {
213:                    x.printStackTrace();
214:                }
215:
216:            }
217:
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.