Package org.drools.runtime

Examples of org.drools.runtime.StatelessKnowledgeSession.execute()


        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

        kbase    = SerializationHelper.serializeObject( kbase );
        StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
       
        ksession.execute( new Message( "help" ) );
    }
   
    @Test
    public void testEvents() throws Exception {
        String str = "";
View Full Code Here


                list.add( event );
            }
           
        });
       
        ksession.execute( new Message( "help" ) );
       
        assertEquals( 4, list.size() );
    }
   
View Full Code Here

        final List list = new ArrayList();
        ksession.setGlobal( "list",
                           list );

        ksession.execute(new Person("pob"));

        kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add( ResourceFactory.newClassPathResource( "test_Dynamic3.drl", DynamicRulesTest.class ), ResourceType.DRL );

        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
View Full Code Here

        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
        ksession = kbase.newStatelessKnowledgeSession();
        ksession.setGlobal( "list",
                           list );
        Person  person  = new Person("bop");
        ksession.execute(person);

        assertEquals( 7,
                      list.size() );

        assertEquals( "rule 3", list.get( 0 ));
View Full Code Here

        StatelessKnowledgeSession session = getSession2( "literal_rule_test.drl" );

        final Cheese stilton = new Cheese( "stilton",
                                           5 );

        session.execute( stilton );

        assertEquals( "stilton",
                      list.get( 0 ) );
    }
View Full Code Here

        StatelessKnowledgeSession session = getSession2( "literal_rule_test.drl" );

        final Cheese stilton = new Cheese( "stilton",
                                           5 );

        session.execute( Arrays.asList( new Object[]{stilton} ) );

        assertEquals( "stilton",
                      list.get( 0 ) );
    }
View Full Code Here

        final Cheese stilton = new Cheese( "stilton",
                                           5 );

        List collection = new ArrayList();
        collection.add( stilton );
        session.execute( collection );

        assertEquals( "stilton",
                      list.get( 0 ) );
    }
   
View Full Code Here

       
        StatelessKnowledgeSession ksession = getSession2( ResourceFactory.newByteArrayResource( str.getBytes() ) );
        GenericCommand cmd = ( GenericCommand ) CommandFactory.newInsert( stilton, "outStilton" );
        BatchExecutionCommandImpl batch = new BatchExecutionCommandImplArrays.asList( new GenericCommand<?>[] { cmd } ) );
       
        ExecutionResults result = ( ExecutionResults ) ksession.execute( batch );
        stilton = ( Cheese ) result.getValue( "outStilton" );
        assertEquals( 30,
                      stilton.getPrice() );
    }
   
View Full Code Here

        cmds.add( setGlobal1 );
        cmds.add( setGlobal2 );
        cmds.add( setGlobal3 );
        cmds.addinsert );
       
        ExecutionResults result = ( ExecutionResults ) ksession.execute( CommandFactory.newBatchExecution( cmds ) );
       
        assertEquals( 30,
                      stilton.getPrice() );
       
        assertNull( result.getValue( "list1" ) );
View Full Code Here

        cmds.add( CommandFactory.newInsert( cheddar2 ) );
        cmds.add( CommandFactory.newInsert( cheddar3 ) );
       
        cmds.addCommandFactory.newQuery( "cheeses", "cheeses" ) );
       
        ExecutionResults batchResult = (ExecutionResults) ksession.execute( CommandFactory.newBatchExecution( cmds ) );
       
        org.drools.runtime.rule.QueryResults results = ( org.drools.runtime.rule.QueryResults) batchResult.getValue( "cheeses" );
        assertEquals( 3, results.size() );
        assertEquals( 2, results.getIdentifiers().length );
        Set newSet = new HashSet();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.