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.xkb;
019:
020: import junit.framework.Test;
021: import junit.framework.TestSuite;
022:
023: import org.mandarax.xkb.XKBDriver;
024: import org.mandarax.xkb.framework.XKBDriver_1_0;
025: import org.mandarax.xkb.framework.XKBDriver_1_1;
026: import org.mandarax.xkb.framework.XKBDriver_2_0;
027: import org.mandarax.xkb.framework.XKBDriver_2_1;
028:
029: /**
030: * Test suite for XKB drivers.
031: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
032: * @version 3.4 <7 March 05>
033: * @since 1.6
034: */
035: public class XKBTests {
036:
037: /**
038: * Launch the test suite. See TestRunner for interpretation
039: * of command line parameters.
040: * @see test.org.mandarax.testsupport.TestRunner
041: * @param args parameters
042: */
043: public static void main(String[] args) {
044: org.apache.log4j.BasicConfigurator.configure();
045: test.org.mandarax.testsupport.TestRunner.run(XKBTests.class,
046: args);
047: }
048:
049: /**
050: * Get the test suite.
051: * @return the test suite
052: */
053: public static Test suite() {
054: TestSuite suite = new TestSuite(
055: "Test cases for the mandarax XKB module");
056:
057: addTests(new XKBDriver_1_0(), suite);
058: addTests(new XKBDriver_1_1(), suite);
059: addTests(new XKBDriver_2_0(), suite);
060: addTests(new XKBDriver_2_1(), suite);
061:
062: return suite;
063: }
064:
065: /**
066: * Add tests for a certain driver to a test suite.
067: * @param driver the XKB driver tested
068: * @param suite a test suite
069: */
070: public static void addTests(XKBDriver driver, TestSuite suite) {
071:
072: suite
073: .addTest(new XKBTestCase4SingleClauseSet(
074: driver,
075: TestData.fact1(),
076: "Test case for testing simple predicates and variables (type String), driver is "
077: + driver.getName(), "_xkb_test1.xml"));
078: suite
079: .addTest(new XKBTestCase4SingleClauseSet(
080: driver,
081: TestData.fact2(),
082: "Test case for testing simple predicates and variables (bean type Person), driver is "
083: + driver.getName(), "_xkb_test2.xml"));
084: suite.addTest(new XKBTestCase4SingleClauseSet(driver, TestData
085: .fact3(),
086: "Test case for testing simple predicates and variables (type int), driver is "
087: + driver.getName(), "_xkb_test3.xml"));
088: suite
089: .addTest(new XKBTestCase4SingleClauseSet(
090: driver,
091: TestData.fact4(),
092: "Test case for testing simple predicates and constants (type String), driver is "
093: + driver.getName(), "_xkb_test4.xml"));
094: suite
095: .addTest(new XKBTestCase4SingleClauseSet(
096: driver,
097: TestData.fact5(),
098: "Test case for testing simple predicates and constants (bean type Person), driver is "
099: + driver.getName(), "_xkb_test5.xml"));
100: suite.addTest(new XKBTestCase4SingleClauseSet(driver, TestData
101: .fact6(),
102: "Test case for testing simple predicates and constants (type int), driver is "
103: + driver.getName(), "_xkb_test6.xml"));
104: suite.addTest(new XKBTestCase4SingleClauseSet(driver, TestData
105: .fact7(),
106: "Test case for testing JPredicates and variables, driver is "
107: + driver.getName(), "_xkb_test7.xml"));
108: suite.addTest(new XKBTestCase4SingleClauseSet(driver, TestData
109: .fact8(),
110: "Test case for testing JFunctions, simple predicates and variables, driver is "
111: + driver.getName(), "_xkb_test8.xml"));
112: suite.addTest(new XKBTestCase4SingleClauseSet(driver, TestData
113: .fact9(),
114: "Test case for testing SQLPredicates and variables, driver is "
115: + driver.getName(), "_xkb_test9.xml"));
116: suite
117: .addTest(new XKBTestCase4SingleClauseSet(
118: driver,
119: TestData.fact10(),
120: "Test case for testing SQLFunctions, simple predicates and variables, driver is "
121: + driver.getName(), "_xkb_test10.xml"));
122:
123: suite.addTest(new XKBTestCase4SingleClauseSet(driver, TestData
124: .rule1(),
125: "Test case for testing rules, simple predicates and variables, driver is "
126: + driver.getName(), "_xkb_test11.xml"));
127: suite
128: .addTest(new XKBTestCase4SingleClauseSet(
129: driver,
130: TestData.andRule(),
131: "Test case for testing rules with multiple premisses connected by AND, driver is "
132: + driver.getName(), "_xkb_test12.xml"));
133: suite
134: .addTest(new XKBTestCase4SingleClauseSet(
135: driver,
136: TestData.orRule(),
137: "Test case for testing rules with multiple premisses connected by OR, driver is "
138: + driver.getName(), "_xkb_test13.xml"));
139:
140: suite.addTest(new XKBTestCase4SingleClauseSet(driver, TestData
141: .sqlClauseSet(),
142: "Test case for testing sql clause sets and predicates, driver is "
143: + driver.getName(), "_xkb_test14.xml"));
144:
145: if (driver.supportsQueries()) {
146: suite.addTest(new XKBTestCase4Queries(driver, TestData
147: .query1(),
148: "Test case for testing single simple query, driver is "
149: + driver.getName(), "_xkb_test15.xml"));
150: suite.addTest(new XKBTestCase4Queries(driver, TestData
151: .query2(),
152: "Test case for testing single query with multiple query facts, driver is "
153: + driver.getName(), "_xkb_test16.xml"));
154: suite.addTest(new XKBTestCase4Queries(driver, TestData
155: .query1(), TestData.query2(),
156: "Test case for testing multiple queries, driver is "
157: + driver.getName(), "_xkb_test17.xml"));
158:
159: }
160:
161: if (driver.supportsNegationAsFailure()) {
162: suite.addTest(new XKBTestCase4SingleClauseSet(driver,
163: TestData.negRule(),
164: "Test case for testing rule with negated prerequisites, driver is "
165: + driver.getName(), "_xkb_test18.xml"));
166:
167: }
168:
169: // only new drivers support this
170: suite
171: .addTest(new XKBTestCase4SingleClauseSet(
172: driver,
173: TestData.fact11(),
174: "Test case for testing DynaBeanFunctions, simple predicates and variables, driver is "
175: + driver.getName(), "_xkb_test19.xml"));
176:
177: }
178:
179: }
|