Package org.kie.internal.runtime

Examples of org.kie.internal.runtime.StatelessKnowledgeSession.execute()


        commands.add(CommandFactory.newInsert(new Cheese("stilton")));
        FireAllRulesCommand farc = (FireAllRulesCommand) CommandFactory.newFireAllRules(10);
        farc.setOutIdentifier("num-rules-fired");
        commands.add(farc);

        ExecutionResults results = ksession.execute(CommandFactory.newBatchExecution(commands));
        int fired = Integer.parseInt(results.getValue("num-rules-fired").toString());

        assertEquals(10, fired);
    }
View Full Code Here


                                           15 );
        final Cheese cheddar = new Cheese( "cheddar",
                                           15 );


        ksession.execute( CommandFactory.newInsertElements(Arrays.asList( new Object[]{p1, stilton, p2, cheddar, p3} )) );

        assertEquals( 3,
                      list.size() );
    }
   
View Full Code Here

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

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

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

        str +="end\n";

        KnowledgeBase kbase = loadKnowledgeBaseFromString(kconf, str);
        StatelessKnowledgeSession ksession = createStatelessKnowledgeSession( kbase );
       
        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

        StatelessKnowledgeSession ksession = createStatelessKnowledgeSession( kbase );

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

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

        kbase.addKnowledgePackages(loadKnowledgePackagesFromString( new String( IoUtils.readBytesFromInputStream( DynamicRulesTest.class.getResource("test_Dynamic3.drl").openStream() ) ) ) );

        ksession = kbase.newStatelessKnowledgeSession();
        ksession.setGlobal( "list", list );
View Full Code Here

        kbase.addKnowledgePackages(loadKnowledgePackagesFromString( new String( IoUtils.readBytesFromInputStream( DynamicRulesTest.class.getResource("test_Dynamic3.drl").openStream() ) ) ) );

        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 ));
        assertEquals( "rule 2", list.get( 1 ));
View Full Code Here

        }

        if ( timetoMeasureIterations == 0 ) {
            //one shot measure
            long start = System.currentTimeMillis();
            ksession.execute( CommandFactory.newInsertElements(Arrays.asList(data)));
            System.out.println( "Time for " + message + ":" + (System.currentTimeMillis() - start) );
            assertTrue( list.size() > 0 );

        } else {
            //lots of shots
View Full Code Here

                StatelessKnowledgeSession sess2 = createStatelessKnowledgeSession( kbase );
                List list2 = new ArrayList();
                sess2.setGlobal( "list",
                                 list2 );

                sess2.execute( CommandFactory.newInsertElements(Arrays.asList(data)));
                //session.execute( data );
                count++;
            }
            System.out.println( "Iterations in for " + message + " : " + count );
View Full Code Here

         StatelessKnowledgeSession session = createStatelessKnowledgeSession( kbase );

         List list = new ArrayList();
         session.setGlobal( "list",
                            list );
         session.execute( "not integer" );
         assertEquals( "not integer",
                       list.get( 0 ) );
     }

     @Test
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.