use of org.drools.compiler.RoutingMessage in project drools by kiegroup.
the class StrEvaluatorTest method testStrLengthEquals.
@Test
public void testStrLengthEquals() throws Exception {
KieBase kbase = readKnowledgeBase();
KieSession ksession = createKnowledgeSession(kbase);
List list = new ArrayList();
ksession.setGlobal("list", list);
RoutingMessage m = new RoutingMessage();
m.setRoutingValue("R1:messageBody:R2");
ksession.insert(m);
ksession.fireAllRules();
assertEquals(6, list.size());
assertTrue(list.contains("Message length is 17"));
}
use of org.drools.compiler.RoutingMessage in project drools by kiegroup.
the class StrEvaluatorTest method testStrLengthNoEquals.
@Test
public void testStrLengthNoEquals() throws Exception {
KieBase kbase = readKnowledgeBase();
KieSession ksession = createKnowledgeSession(kbase);
List list = new ArrayList();
ksession.setGlobal("list", list);
RoutingMessage m = new RoutingMessage();
m.setRoutingValue("messageBody");
ksession.insert(m);
ksession.fireAllRules();
assertTrue(list.size() == 3);
assertTrue(((String) list.get(0)).equals("Message length is not 17"));
assertTrue(((String) list.get(1)).equals("Message does not start with R2"));
assertTrue(((String) list.get(2)).equals("Message does not end with R1"));
}
Aggregations