Package org.drools.spi

Examples of org.drools.spi.MockObjectType


                                  DuplicateRuleNameException,
                                  RuleIntegrationException,
                                  RuleSetIntegrationException
    {
        Rule rule1 = new Rule( "test-rule 1" );
        rule1.addParameterDeclaration( "paramVar", new MockObjectType( true ) );

        //add consequence
        rule1.setConsequence( new org.drools.spi.InstrumentedConsequence( ) );

        //add conditions
        rule1.addCondition( new org.drools.spi.InstrumentedCondition( ) );
        rule1.addCondition( new org.drools.spi.InstrumentedCondition( ) );

        rule1.setSalience( 42 );

        Rule rule2 = new Rule( "test-rule 2" );

        rule2.addParameterDeclaration( "paramVar", new MockObjectType( true ) );

        //add consequence
        rule2.setConsequence( new org.drools.spi.InstrumentedConsequence( ) );

        //add conditions
View Full Code Here


{
    public void testAssertObject() throws Exception
    {
        Rule rule = new Rule( getName( ) );

        Declaration decl = rule.addParameterDeclaration( "object", new MockObjectType( Object.class ) );

        ObjectTypeNode objectTypeNode = new ObjectTypeNode( new MockObjectType( String.class ) );

        InstrumentedParameterNode paramNode = new InstrumentedParameterNode( null, decl );
        paramNode.addTupleSink( new InstrumentedTupleSink( ) );

        objectTypeNode.addParameterNode( paramNode );
View Full Code Here

        final Rule rule = new Rule( "test-rule" );
        final Map data = new HashMap( );

        rule.addParameterDeclaration( "paramVar",
                                      new MockObjectType( true ) );

        // add consequence
        rule.setConsequence( new org.drools.spi.Consequence( )
        {
            public void invoke(org.drools.spi.Tuple tuple)
View Full Code Here

        final Scheduler scheduler = Scheduler.getInstance( );

        final Rule rule = new Rule( "test-rule" );

        rule.addParameterDeclaration( "paramVar",
                                      new MockObjectType( true ) );

        // add consequence
        rule.setConsequence( new org.drools.spi.Consequence( )
        {
            public void invoke(org.drools.spi.Tuple tuple) throws ConsequenceException
View Full Code Here

        RuleSet ruleSet = new RuleSet( "test rule-set" );
        Rule rule = new Rule( "test-rule" );

        // rule.addParameterDeclaration( intDecl );
        Declaration stringDecl1 = rule.addParameterDeclaration( "stringVar1",
                                                                new MockObjectType( String.class ) );
        Declaration stringDecl2 = rule.addParameterDeclaration( "stringVar2",
                                                                new MockObjectType( String.class ) );
        Declaration intDecl = rule.addParameterDeclaration( "intVar",
                                                            new MockObjectType( Integer.class ) );

        // add consequence
        rule.setConsequence( new org.drools.spi.Consequence( )
        {
            public void invoke(org.drools.spi.Tuple tuple)
View Full Code Here

    public void testConstruct() throws Exception
    {
        FactHandleImpl handle = new FactHandleImpl( 1 );

        Rule rule = new Rule( "test-rule" );
        Declaration decl = rule.addParameterDeclaration( "paramVar", new MockObjectType( true ) );

        //add consequence
        rule.setConsequence( new org.drools.spi.InstrumentedConsequence( ) );
        //add condition
        rule.addCondition( new org.drools.spi.InstrumentedCondition( ) );
View Full Code Here

    public void testSetTuple() throws Exception
    {
        FactHandleImpl handle = new FactHandleImpl( 1 );
        Rule rule = new Rule( "test-rule" );
        Declaration decl = rule.addParameterDeclaration( "paramVar", new MockObjectType( true ) );

        //add consequence
        rule.setConsequence( new org.drools.spi.InstrumentedConsequence( ) );
        //add condition
        rule.addCondition( new org.drools.spi.InstrumentedCondition( ) );
View Full Code Here

        FactHandleImpl handle = new FactHandleImpl( 1 );

        Rule rule = new Rule( "test-rule" );

        Declaration decl = rule.addParameterDeclaration( "cheese", new MockObjectType( true ) );

        ReteTuple tuple = new ReteTuple( (WorkingMemoryImpl) ruleBase.newWorkingMemory( ), decl, handle );

        InstrumentedConsequence consequence = new InstrumentedConsequence( );
View Full Code Here

        rule.setConsequence( new org.drools.spi.Consequence( )
        {
            public void invoke(org.drools.spi.Tuple tuple)
            {       
                //throw in a different tuple, to check the agenda doesn't stop the rule/tuple combo
                Declaration dec = new Declaration("paramVar", new MockObjectType(true), 1);
                FactHandle fact = new FactHandleImpl(42);
                ReteTuple different = new ReteTuple(workingMemory, dec, fact);
                agenda.addToAgenda( different,
                                    rule );
            }
View Full Code Here

    public void setUp()
    {
        this.rete = new Rete( );

        this.objectTypeNode = new InstrumentedObjectTypeNode( new MockObjectType( Object.class ) );
        this.stringTypeNode = new InstrumentedObjectTypeNode( new MockObjectType( String.class ) );

        this.rete.addObjectTypeNode( this.objectTypeNode );
        this.rete.addObjectTypeNode( this.stringTypeNode );
    }
View Full Code Here

TOP

Related Classes of org.drools.spi.MockObjectType

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.