use of org.drools.drl.parser.DroolsParserException in project drools by kiegroup.
the class Misc2Test method testEvalConstraintWithMvelOperator.
@Test
public void testEvalConstraintWithMvelOperator() {
String drl = "rule \"yeah\" " + "\tdialect \"mvel\"\n when " + "Foo( eval( field soundslike \"water\" ) )" + " then " + "end";
DrlParser drlParser = new DrlParser();
PackageDescr packageDescr;
try {
packageDescr = drlParser.parse(true, drl);
} catch (DroolsParserException e) {
throw new RuntimeException(e);
}
RuleDescr r = packageDescr.getRules().get(0);
PatternDescr pd = (PatternDescr) r.getLhs().getDescrs().get(0);
assertEquals(1, pd.getConstraint().getDescrs().size());
}
use of org.drools.drl.parser.DroolsParserException in project drools by kiegroup.
the class ErrorsParserTest method testExpanderErrorsAfterExpansion.
@Test
public void testExpanderErrorsAfterExpansion() throws Exception {
String name = "expander_post_errors.dslr";
Expander expander = new DefaultExpander();
String expanded = expander.expand(this.getReader(name));
DRLParser parser = parse(name, expanded);
parser.compilationUnit();
assertTrue(parser.hasErrors());
assertEquals(1, parser.getErrors().size());
DroolsParserException err = (DroolsParserException) parser.getErrors().get(0);
assertEquals(6, err.getLineNumber());
}
use of org.drools.drl.parser.DroolsParserException in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_OPERATORS_AND_COMPLEMENT2.
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_OPERATORS_AND_COMPLEMENT2() throws DroolsParserException, RecognitionException {
String input = "rule MyRule when Class ( property not memberOf collection";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.DroolsParserException in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_OPERATORS_AND_COMPLEMENT1.
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_OPERATORS_AND_COMPLEMENT1() throws DroolsParserException, RecognitionException {
String input = "rule MyRule when Class ( property memberOf collection ";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_END, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.DroolsParserException in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_COMPOSITE_OPERATOR1.
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_COMPOSITE_OPERATOR1() throws DroolsParserException, RecognitionException {
String input = "rule MyRule when Class ( property in ( ";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
Aggregations