use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.
the class ErrorsParserTest method testErrorMessageForMisplacedParenthesis.
@Test
public void testErrorMessageForMisplacedParenthesis() throws Exception {
final DRLParser parser = parseResource("misplaced_parenthesis.drl");
parser.compilationUnit();
assertTrue("Parser should have raised errors", parser.hasErrors());
assertEquals(1, parser.getErrors().size());
assertEquals("ERR 102", parser.getErrors().get(0).getErrorCode());
}
use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.
the class ErrorsParserTest method testTempleteError.
@Test
public void testTempleteError() throws Exception {
DRLParser parser = parseResource("template_test_error.drl");
parser.compilationUnit();
assertTrue(parser.hasErrors());
}
use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_FROM_ACCUMULATE_INIT_INSIDE.
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_FROM_ACCUMULATE_INIT_INSIDE() {
String input = "rule MyRule \n" + " when \n" + " Class ( property > 0 ) from accumulate( \n" + " $cheese : Cheese( type == $likes ), \n" + " init( ";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_LHS_FROM_ACCUMULATE_INIT_INSIDE, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_FROM_COLLECT1.
/**
* FROM COLLECT
*/
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_FROM_COLLECT1() {
String input = "rule MyRule \n" + " when \n" + " Class ( property > 0 ) from collect ( ";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_LHS_FROM_COLLECT, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_BEGIN_OF_CONDITION_EXISTS1.
/**
* EXISTS
*/
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_BEGIN_OF_CONDITION_EXISTS1() {
String input = "rule MyRule \n" + " when \n" + " exists ";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION_EXISTS, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
Aggregations