Search in sources :

Example 1 with Attribute

use of org.drools.compiler.Attribute in project drools by kiegroup.

the class NullTest method testNullFieldOnCompositeSink.

@Test
public void testNullFieldOnCompositeSink() throws Exception {
    final KieBase kbase = loadKnowledgeBase("test_NullFieldOnCompositeSink.drl");
    KieSession ksession = createKnowledgeSession(kbase);
    final List list = new ArrayList();
    ksession.setGlobal("list", list);
    ksession.insert(new Attribute());
    ksession.insert(new Message());
    ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession(ksession, true);
    ksession.fireAllRules();
    assertEquals(1, ((List) ksession.getGlobal("list")).size());
    assertEquals("X", ((List) ksession.getGlobal("list")).get(0));
}
Also used : Message(org.drools.compiler.Message) Attribute(org.drools.compiler.Attribute) KieBase(org.kie.api.KieBase) ArrayList(java.util.ArrayList) KieSession(org.kie.api.runtime.KieSession) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Attribute (org.drools.compiler.Attribute)1 Message (org.drools.compiler.Message)1 Test (org.junit.Test)1 KieBase (org.kie.api.KieBase)1 KieSession (org.kie.api.runtime.KieSession)1