Package org.drools.reteoo

Examples of org.drools.reteoo.ReteooRuleBase


     * doesn't need any requiredDeclarations
     *
     * @throws IntrospectionException
     */
    public void testLiteralConstraint() throws IntrospectionException {
        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        final InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newStatefulSession();

        final ClassFieldExtractor extractor = cache.getExtractor( Cheese.class,
                                                                  "type",
                                                                  getClass().getClassLoader() );

View Full Code Here


     * </pre>
     *
     * @throws IntrospectionException
     */
    public void testPrimitiveLiteralConstraint() throws IntrospectionException {
        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        final InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newStatefulSession();

        final ClassFieldExtractor extractor = cache.getExtractor( Cheese.class,
                                                                  "price",
                                                                  getClass().getClassLoader() );

View Full Code Here

     * </pre>
     *
     * @throws IntrospectionException
     */
    public void testPredicateConstraint() throws IntrospectionException {
        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        final InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newStatefulSession();

        final FieldExtractor priceExtractor = cache.getExtractor( Cheese.class,
                                                                  "price",
                                                                  getClass().getClassLoader() );

View Full Code Here

     * </pre>
     *
     * @throws IntrospectionException
     */
    public void testReturnValueConstraint() throws IntrospectionException {
        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        final InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newStatefulSession();

        final FieldExtractor priceExtractor = cache.getExtractor( Cheese.class,
                                                                  "price",
                                                                  getClass().getClassLoader() );

View Full Code Here

     * used when nested inside other field constraints, as the top level AND is implicit
     *
     * @throws IntrospectionException
     */
    public void testCompositeAndConstraint() {
        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        final InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newStatefulSession();

        final ClassFieldExtractor extractor = cache.getExtractor( Cheese.class,
                                                                  "type",
                                                                  getClass().getClassLoader() );

View Full Code Here

     * Test the use of the composite OR constraint.
     *
     * @throws IntrospectionException
     */
    public void testCompositeOrConstraint() {
        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        final InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newStatefulSession();

        final ClassFieldExtractor extractor = cache.getExtractor( Cheese.class,
                                                                  "type",
                                                                  getClass().getClassLoader() );

View Full Code Here

     * Test the use of the composite OR constraint.
     *
     * @throws IntrospectionException
     */
    public void testNestedCompositeConstraints() {
        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        final InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newStatefulSession();

        final ClassFieldExtractor typeExtractor = cache.getExtractor( Cheese.class,
                                                                      "type",
                                                                      getClass().getClassLoader() );

View Full Code Here

     */
    protected void setUp() throws Exception {
        super.setUp();

        this.builder = new ReteooRuleBuilder();
        this.rulebase = new ReteooRuleBase( "default" );
    }
View Full Code Here

        Rule rule = pkg.getRule( "rule-1" );

        assertLength( 0,
                      builder.getErrors().getErrors() );

        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        ruleBase.getGlobals().put( "map",
                                   Map.class );
        final WorkingMemory workingMemory = ruleBase.newStatefulSession();

        final HashMap map = new HashMap();
        workingMemory.setGlobal( "map",
                                 map );
View Full Code Here

                      builder.getErrors().getErrors() );

        final Package newPkg = SerializationHelper.serializeObject( pkg );
        final Rule newRule = newPkg.getRule( "rule-1" );

        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();

        // It's been serialised so we have to simulate the re-wiring process
        newPkg.getDialectRuntimeRegistry().onAdd( ruleBase.getRootClassLoader() );
        newPkg.getDialectRuntimeRegistry().onBeforeExecute();

        ruleBase.getGlobals().put( "map",
                                   Map.class );
        final WorkingMemory workingMemory = ruleBase.newStatefulSession();

        final HashMap map = new HashMap();

        workingMemory.setGlobal( "map",
                                 map );
View Full Code Here

TOP

Related Classes of org.drools.reteoo.ReteooRuleBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.