use of org.drools.modelcompiler.domain.Address in project drools by kiegroup.
the class CompilerTest method testChainFieldAccessorsAndMethodCall.
@Test
public void testChainFieldAccessorsAndMethodCall() {
String str = "import " + Person.class.getCanonicalName() + ";" + "rule R when\n" + " $p : Person( address.getCity().length == 5 )\n" + "then\n" + " insert(\"matched\");\n" + "end";
KieSession ksession = getKieSession(str);
Person john = new Person("John", 47);
Address a = new Address("Italy");
john.setAddress(a);
ksession.insert(john);
ksession.fireAllRules();
Collection<String> results = getObjectsIntoList(ksession, String.class);
assertEquals(1, results.size());
}
use of org.drools.modelcompiler.domain.Address in project drools by kiegroup.
the class CompilerTest method testChainOfMethodCallInConstraint.
@Test
public void testChainOfMethodCallInConstraint() {
String str = "import " + Person.class.getCanonicalName() + ";" + "rule R when\n" + " $p : Person( getAddress().getCity().length() == 5 )\n" + "then\n" + " insert(\"matched\");\n" + "end";
KieSession ksession = getKieSession(str);
Person john = new Person("John", 47);
Address a = new Address("Italy");
john.setAddress(a);
ksession.insert(john);
ksession.fireAllRules();
Collection<String> results = getObjectsIntoList(ksession, String.class);
assertEquals(1, results.size());
}
Aggregations