Package org.kie.api

Examples of org.kie.api.KieBase.newKieSession()


    @Test
    public void testInsertRetractNoloop() throws Exception {
        // read in the source
        KieBase kbase = loadKnowledgeBase("test_Insert_Retract_Noloop.drl");
        KieSession ksession = kbase.newKieSession();

        ksession.insert( new Cheese( "stilton", 15 ) );

        ksession.fireAllRules();
        assertEquals(0, ksession.getObjects().size());
View Full Code Here


    @Test
    public void testUpdateNoLoop() throws Exception {
        // JBRULES-780, throws a NullPointer or infinite loop if there is an
        // issue
        KieBase kbase = loadKnowledgeBase("test_UpdateNoloop.drl");
        KieSession ksession = kbase.newKieSession();

        Cheese cheese = new Cheese( "stilton", 15 );
        ksession.insert( cheese  );

        ksession.fireAllRules();
View Full Code Here

    @Test
    public void testUpdateActivationCreationNoLoop() throws Exception {
        // JBRULES-787, no-loop blocks all dependant tuples for update
        KieBase kbase = loadKnowledgeBase("test_UpdateActivationCreationNoLoop.drl");
        KieSession ksession = kbase.newKieSession();

        final List created = new ArrayList();
        final List cancelled = new ArrayList();
        final AgendaEventListener l = new DefaultAgendaEventListener() {
            @Override
View Full Code Here

    }

    @Test
    public void testRuleFlowGroup() throws Exception {
        KieBase kbase = loadKnowledgeBase("ruleflowgroup.drl");
        KieSession ksession = kbase.newKieSession();

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

        ksession.insert( "Test" );
View Full Code Here

    @Test
    public void testRuleFlowGroupDeactivate() throws Exception {
        // need to make eager, for cancel to work, (mdp)
        KieBase kbase = loadKnowledgeBase("ruleflowgroup2.drl");
        KieSession ksession = kbase.newKieSession();


        final List list = new ArrayList();
        ksession.setGlobal( "list", list );
View Full Code Here

    }

    @Test(timeout=10000)
    public void testRuleFlowGroupInActiveMode() throws Exception {
        KieBase kbase = loadKnowledgeBase("ruleflowgroup.drl");
        final KieSession ksession = kbase.newKieSession();

        final List list = new ArrayList();
        ksession.setGlobal( "list",
                                 list );
       
View Full Code Here

    @Test
    public void testDateEffective() throws Exception {
        // read in the source
        KieBase kbase = loadKnowledgeBase("test_EffectiveDate.drl");
        KieSession ksession = kbase.newKieSession();


        final List list = new ArrayList();
        ksession.setGlobal( "list", list );
View Full Code Here

                     + "  then \n"
                     + "    modify( $p ) { setAge( 36 ) }; \n"
                     + "end \n";

        KieBase kbase = loadKnowledgeBaseFromString(str);
        KieSession ksession = kbase.newKieSession();

        Person p = new Person( "darth", 36 );
        FactHandle fh = (FactHandle) ksession.insert( p );

        ksession.getAgenda().getAgendaGroup( "g1" ).setFocus();
View Full Code Here

                "then\n" +
                "    ruleList.add(4);\n" +
                "end\n";

        KieBase kbase = loadKnowledgeBaseFromString(str);
        KieSession ksession = kbase.newKieSession();

        ArrayList<String> ruleList = new ArrayList<String>();
        ksession.setGlobal("ruleList", ruleList);

        ksession.insert(new String("r1"));
View Full Code Here

        assertEquals(0, kbuilder.getResults().getMessages().size());

        KieBaseConfiguration conf = ks.newKieBaseConfiguration();
        conf.setOption(RuleEngineOption.RETEOO);
        KieBase kbase = ks.newKieContainer(kbuilder.getKieModule().getReleaseId()).newKieBase(conf);
        KieSession ksession = kbase.newKieSession();
        ksession.fireAllRules();
    }

    @Test
    public void testListnersOnStatlessKieSession() {
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.