Package org.kie.runtime

Examples of org.kie.runtime.StatefulKnowledgeSession.fireAllRules()


        applicant.setResidenceState("AP");
        applicant.setOccupation("TEACHER");
        applicant.setAge(20);
        applicant.setValidLicense(true);
        session.insert( applicant );
        session.fireAllRules();
        session.dispose();
        //occupation = +10, age = +40, state = -10, validLicense = 1, initialScore=100
        assertEquals(141.0,applicant.getTotalScore());
    }
View Full Code Here


        StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
        Applicant applicant = new Applicant();
        applicant.setAge(10);
        session.insert(applicant);
        //session.addEventListener(new DebugWorkingMemoryEventListener());
        session.fireAllRules();
        session.dispose();
        //occupation = 0, age = 30, validLicence -1, initialScore=100
        assertEquals(129.0,applicant.getTotalScore());
        assertTrue(applicant.getReasonCodes().size() > 0);
View Full Code Here

        session = kbase.newStatefulKnowledgeSession();
        applicant = new Applicant();
        applicant.setOccupation("SKYDIVER");
        applicant.setAge(0);
        session.insert( applicant );
        session.fireAllRules();
        session.dispose();
        //occupation = -10, age = +10, validLicense = -1, initialScore=100;
        assertEquals(99.0, applicant.getTotalScore());

        session = kbase.newStatefulKnowledgeSession();
View Full Code Here

        applicant.setResidenceState("AP");
        applicant.setOccupation("TEACHER");
        applicant.setAge(20);
        applicant.setValidLicense(true);
        session.insert( applicant );
        session.fireAllRules();
        session.dispose();
        //occupation = +10, age = +40, state = -10, validLicense = 1, initialScore=100
        assertEquals(141.0,applicant.getTotalScore());
    }
}
View Full Code Here

        FactType scorecardType = kbase.getFactType( "org.drools.scorecards.example","SampleScore" );

        DroolsScorecard scorecard = (DroolsScorecard) scorecardType.newInstance();
        scorecardType.set(scorecard, "age", 10);
        session.insert(scorecard);
        session.fireAllRules();
        session.dispose();
        //age = 30, validLicence -1
        assertTrue(29 == scorecard.getCalculatedScore());
        //age-reasoncode=AGE02, license-reasoncode=VL002
        assertEquals(2, scorecard.getReasonCodes().size());
View Full Code Here

        session = kbase.newStatefulKnowledgeSession();
        scorecard = (DroolsScorecard) scorecardType.newInstance();
        scorecardType.set(scorecard, "age", 0);
        scorecardType.set(scorecard, "occupation", "SKYDIVER");
        session.insert(scorecard);
        session.fireAllRules();
        session.dispose();
        //occupation = -10, age = +10, validLicense = -1;
        assertTrue(-1 == scorecard.getCalculatedScore());
        assertEquals(3, scorecard.getReasonCodes().size());
        //[AGE01, VL002, OCC01]
View Full Code Here

        scorecardType.set(scorecard, "age", 20);
        scorecardType.set(scorecard, "occupation", "TEACHER");
        scorecardType.set(scorecard, "residenceState", "AP");
        scorecardType.set(scorecard, "validLicense", true);
        session.insert( scorecard );
        session.fireAllRules();
        session.dispose();
        //occupation = +10, age = +40, state = -10, validLicense = 1
        assertEquals(41.0,scorecard.getCalculatedScore());
        //[OCC02, AGE03, VL001, RS001]
        assertEquals(4, scorecard.getReasonCodes().size());
View Full Code Here

        FactType scorecardType = kbase.getFactType( "org.drools.scorecards.example","SampleScore" );

        DroolsScorecard scorecard = (DroolsScorecard) scorecardType.newInstance();
        scorecardType.set(scorecard, "age", 10);
        session.insert(scorecard);
        session.fireAllRules();
        session.dispose();
        //age = 30, validLicence -1, initialScore = 100;
        assertTrue(129 == scorecard.getCalculatedScore());
        //age-reasoncode=AGE02, license-reasoncode=VL002
        assertEquals(2, scorecard.getReasonCodes().size());
View Full Code Here

        session = kbase.newStatefulKnowledgeSession();
        scorecard = (DroolsScorecard) scorecardType.newInstance();
        scorecardType.set(scorecard, "age", 0);
        scorecardType.set(scorecard, "occupation", "SKYDIVER");
        session.insert(scorecard);
        session.fireAllRules();
        session.dispose();
        //occupation = -10, age = +10, validLicense = -1, initialScore = 100;
        assertEquals(99.0, scorecard.getCalculatedScore());

        assertEquals(3, scorecard.getReasonCodes().size());
View Full Code Here

        scorecardType.set(scorecard, "age", 20);
        scorecardType.set(scorecard, "occupation", "TEACHER");
        scorecardType.set(scorecard, "residenceState", "AP");
        scorecardType.set(scorecard, "validLicense", true);
        session.insert( scorecard );
        session.fireAllRules();
        session.dispose();
        //occupation = +10, age = +40, state = -10, validLicense = 1, initialScore = 100;
        assertEquals(141.0,scorecard.getCalculatedScore());
        //[OCC02, AGE03, VL001, RS001]
        assertEquals(4, scorecard.getReasonCodes().size());
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.