use of org.drools.compiler.lang.descr.MVELExprDescr in project drools by kiegroup.
the class RuleParserTest method testComplexChainedAcessor.
@Test
public void testComplexChainedAcessor() throws Exception {
final RuleDescr rule = (RuleDescr) parseResource("rule", "test_ComplexChainedCallWithFrom.drl");
assertFalse(parser.getErrors().toString(), parser.hasErrors());
final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get(0);
final FromDescr from = (FromDescr) pattern.getSource();
final MVELExprDescr accessor = (MVELExprDescr) from.getDataSource();
assertEquals("doIt1( foo,bar,42,\"hello\",[ a : \"b\"], [a, \"b\", 42] ).doIt2(bar, [a, \"b\", 42]).field[\"key\"]", accessor.getExpression());
}
use of org.drools.compiler.lang.descr.MVELExprDescr in project drools by kiegroup.
the class RuleParserTest method testSimpleFunctionCallWithFrom.
@Test
public void testSimpleFunctionCallWithFrom() throws Exception {
final RuleDescr rule = (RuleDescr) parseResource("rule", "test_SimpleFunctionCallWithFrom.drl");
assertFalse(parser.getErrors().toString(), parser.hasErrors());
final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get(0);
final FromDescr from = (FromDescr) pattern.getSource();
final MVELExprDescr func = (MVELExprDescr) from.getDataSource();
assertEquals("doIt( foo,bar,42,\"hello\",[ a : \"b\", \"something\" : 42, \"a\" : foo, x : [x:y]],\"end\", [a, \"b\", 42] )", func.getExpression());
}
use of org.drools.compiler.lang.descr.MVELExprDescr in project drools by kiegroup.
the class RuleParserTest method testSimpleAccessorAndArgWithFrom.
@Test
public void testSimpleAccessorAndArgWithFrom() throws Exception {
final RuleDescr rule = (RuleDescr) parseResource("rule", "test_SimpleAccessorArgWithFrom.drl");
assertFalse(parser.getErrors().toString(), parser.hasErrors());
final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get(0);
final FromDescr from = (FromDescr) pattern.getSource();
final MVELExprDescr accessor = (MVELExprDescr) from.getDataSource();
assertEquals("something.doIt[\"key\"]", accessor.getExpression());
}
use of org.drools.compiler.lang.descr.MVELExprDescr in project drools by kiegroup.
the class RuleParserTest method testSimpleAccessorWithFrom.
@Test
public void testSimpleAccessorWithFrom() throws Exception {
final RuleDescr rule = (RuleDescr) parseResource("rule", "test_SimpleAccessorWithFrom.drl");
assertFalse(parser.getErrors().toString(), parser.hasErrors());
final PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get(0);
final FromDescr from = (FromDescr) pattern.getSource();
final MVELExprDescr accessor = (MVELExprDescr) from.getDataSource();
assertEquals("something.doIt", accessor.getExpression());
}
Aggregations