⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xkbtests.java

📁 Mandarax是一个规则引擎的纯Java实现。它支持多类型的事实和基于反映的规则
💻 JAVA
字号:
/*
 * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package test.org.mandarax.xkb;

import junit.framework.Test;
import junit.framework.TestSuite;

import org.mandarax.xkb.XKBDriver;
import org.mandarax.xkb.framework.XKBDriver_1_0;
import org.mandarax.xkb.framework.XKBDriver_1_1;
import org.mandarax.xkb.framework.XKBDriver_2_0;
import org.mandarax.xkb.framework.XKBDriver_2_1;

/**
 * Test suite for XKB drivers.
 * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
 * @version 3.4 <7 March 05>
 * @since 1.6
 */
public class XKBTests {

    /**
     * Launch the test suite. See TestRunner for interpretation
     * of command line parameters.
     * @see test.org.mandarax.testsupport.TestRunner
     * @param args parameters
     */
    public static void main(String[] args) {
        org.apache.log4j.BasicConfigurator.configure ();
        test.org.mandarax.testsupport.TestRunner.run (XKBTests.class, args);
    }

    /**
     * Get the test suite.
     * @return the test suite
     */
    public static Test suite() {
        TestSuite suite = new TestSuite ("Test cases for the mandarax XKB module");

		addTests(new XKBDriver_1_0 (),suite);
		addTests(new XKBDriver_1_1 (),suite);
		addTests(new XKBDriver_2_0 (),suite);
		addTests(new XKBDriver_2_1 (),suite);
		
        return suite;
    }
    /**
     * Add tests for a certain driver to a test suite.
     * @param driver the XKB driver tested
     * @param suite a test suite
     */
    public static void addTests(XKBDriver driver,TestSuite suite) {
       
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.fact1 (),
                "Test case for testing simple predicates and variables (type String), driver is " + driver.getName(),
                "_xkb_test1.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.fact2 (),
                "Test case for testing simple predicates and variables (bean type Person), driver is " + driver.getName(),
                "_xkb_test2.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.fact3 (),
                "Test case for testing simple predicates and variables (type int), driver is " + driver.getName(),
                "_xkb_test3.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.fact4 (),
                "Test case for testing simple predicates and constants (type String), driver is " + driver.getName(),
                "_xkb_test4.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.fact5 (),
                "Test case for testing simple predicates and constants (bean type Person), driver is " + driver.getName(),
                "_xkb_test5.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.fact6 (),
                "Test case for testing simple predicates and constants (type int), driver is " + driver.getName(),
                "_xkb_test6.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.fact7 (),
                "Test case for testing JPredicates and variables, driver is " + driver.getName(),
                "_xkb_test7.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.fact8 (),
                "Test case for testing JFunctions, simple predicates and variables, driver is " + driver.getName(),
                "_xkb_test8.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.fact9 (),
                "Test case for testing SQLPredicates and variables, driver is " + driver.getName(),
                "_xkb_test9.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.fact10 (),
                "Test case for testing SQLFunctions, simple predicates and variables, driver is " + driver.getName(),
                "_xkb_test10.xml"));
        
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.rule1 (),
                "Test case for testing rules, simple predicates and variables, driver is " + driver.getName(),
                "_xkb_test11.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.andRule (),
                "Test case for testing rules with multiple premisses connected by AND, driver is " + driver.getName(),
                "_xkb_test12.xml"));
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.orRule (),
                "Test case for testing rules with multiple premisses connected by OR, driver is " + driver.getName(),
                "_xkb_test13.xml"));
        
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
                TestData.sqlClauseSet (),
                "Test case for testing sql clause sets and predicates, driver is " + driver.getName(),
                "_xkb_test14.xml"));  
                
        if (driver.supportsQueries()) {
 			    suite.addTest (new XKBTestCase4Queries (driver,
	                TestData.query1(),
	                "Test case for testing single simple query, driver is " + driver.getName(),
	                "_xkb_test15.xml"));
	            suite.addTest (new XKBTestCase4Queries (driver,
	                TestData.query2(),
	                "Test case for testing single query with multiple query facts, driver is " + driver.getName(),
	                "_xkb_test16.xml")); 
	            suite.addTest (new XKBTestCase4Queries (driver,
	                TestData.query1(),
	                TestData.query2(),
	                "Test case for testing multiple queries, driver is " + driver.getName(),
	                "_xkb_test17.xml"));                 	
         
        }
        
        if (driver.supportsNegationAsFailure()) {
 			    suite.addTest (new XKBTestCase4SingleClauseSet (driver,
	                TestData.negRule(),
	                "Test case for testing rule with negated prerequisites, driver is " + driver.getName(),
	                "_xkb_test18.xml"));          	
         
        }      
        
        // only new drivers support this
        suite.addTest (new XKBTestCase4SingleClauseSet (driver,
	                TestData.fact11 (),
	                "Test case for testing DynaBeanFunctions, simple predicates and variables, driver is " + driver.getName(),
	                "_xkb_test19.xml"));                  

         
    } 
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -