Package org.kie.api.runtime

Examples of org.kie.api.runtime.KieSession.update()


        assertEquals( "MAIN", ((InternalAgenda)ksession.getAgenda()).getFocusName()  );
        System.out.println( "--------" );

        // on the seventh day, while God rested, man start killing them all
        cells[0][0].setState( Cell.DEAD );
        ksession.update( handles[0][0], cells[0][0] );
        ksession.getAgenda().getAgendaGroup("calculate").setFocus();
        ksession.fireAllRules( 100 );

        expected = new int[][]{{3, 2, 2}, {2, 2, 2}, {2, 2, 1}};
        assertEqualsMatrix( size, cells, expected );
View Full Code Here


        FactHandle bartHandle = ksession.insert(bart);
        ksession.fireAllRules();
        assertEquals(0, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        bart.setFather(abraham);
        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(100, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        bart.setFather(null);
        ksession.update(bartHandle, bart);
View Full Code Here

        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(100, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        bart.setFather(null);
        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(0, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        bart.setFather(abraham);
        ksession.update(bartHandle, bart);
View Full Code Here

        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(0, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        bart.setFather(abraham);
        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(100, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        FactHandle homerHandle = ksession.insert(homer);
        homer.setFather(abraham);
View Full Code Here

        ksession.fireAllRules();
        assertEquals(100, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());

        FactHandle homerHandle = ksession.insert(homer);
        homer.setFather(abraham);
        ksession.update(homerHandle, homer);
        bart.setFather(homer);
        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(120, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());
    }   
View Full Code Here

        FactHandle homerHandle = ksession.insert(homer);
        homer.setFather(abraham);
        ksession.update(homerHandle, homer);
        bart.setFather(homer);
        ksession.update(bartHandle, bart);
        ksession.fireAllRules();
        assertEquals(120, ((TotalHolder) ksession.getGlobal("totalHolder")).getTotal());
    }   

    public static class Holder {
View Full Code Here

        assertEquals( 3, created.size() );
        assertEquals( 0, cancelled.size() );

        // simulate a modify inside a consequence
        ksession.update( stiltonHandle, stilton );

        // with true modify, no reactivations should be triggered
        assertEquals( 3, created.size() );
        assertEquals( 0, cancelled.size() );
    }
View Full Code Here

        ksession.getAgenda().getAgendaGroup( "g1" ).setFocus();

        ksession.fireAllRules();

        ksession.update( fh, p ); // normally NPE thrown here, for BUG
       
        assertEquals( 36, p.getAge() );
    }

View Full Code Here

        assertEquals( 1,
                      list.size() );

        value.addAndGet(1);
        ksession.update(atomicFH, value);
        ksession.fireAllRules();
       
        assertEquals( 2,
                list.size() );
        String externalForm = atomicFH.toExternalForm();
View Full Code Here

        ksession = InfinispanKnowledgeService.loadStatefulKnowledgeSession(ksession.getId(), kbase, null, env);
       
        atomicFH = ksession.execute(CommandFactory.fromExternalFactHandleCommand(externalForm));
       
        value.addAndGet(1);
        ksession.update(atomicFH, value);
       
        ksession.fireAllRules();
       
        list = (List<?>) ksession.getGlobal("list");
       
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.