Search in sources :

Example 1 with JTMSBeliefSystem

use of org.drools.tms.beliefsystem.jtms.JTMSBeliefSystem in project drools by kiegroup.

the class JTMSTest method testConflictStrict.

@Test(timeout = 10000)
public void testConflictStrict() {
    KieSession kSession = getSessionFromFile("posNegConflict.drl");
    ArrayList list = new ArrayList();
    kSession.setGlobal("list", list);
    NamedEntryPoint ep = (NamedEntryPoint) ((StatefulKnowledgeSessionImpl) kSession).getEntryPoint("DEFAULT");
    JTMSBeliefSystem bs = (JTMSBeliefSystem) ((TruthMaintenanceSystemImpl) TruthMaintenanceSystemFactory.get().getOrCreateTruthMaintenanceSystem(ep)).getBeliefSystem();
    bs.STRICT = true;
    try {
        kSession.fireAllRules();
        fail("A fact and its negation should have been asserted, but no exception was trhown in strict mode");
    } catch (Exception e) {
    } finally {
        bs.STRICT = false;
    }
}
Also used : JTMSBeliefSystem(org.drools.tms.beliefsystem.jtms.JTMSBeliefSystem) NamedEntryPoint(org.drools.kiesession.entrypoints.NamedEntryPoint) ArrayList(java.util.ArrayList) KieSession(org.kie.api.runtime.KieSession) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 NamedEntryPoint (org.drools.kiesession.entrypoints.NamedEntryPoint)1 JTMSBeliefSystem (org.drools.tms.beliefsystem.jtms.JTMSBeliefSystem)1 Test (org.junit.Test)1 KieSession (org.kie.api.runtime.KieSession)1