use of org.drools.drl.parser.lang.DroolsToken in project drools by kiegroup.
the class DRLContextTest method testCheckRuleHeaderLocationDetermination_dialect4.
@Test(timeout = 10 * 1000)
public void testCheckRuleHeaderLocationDetermination_dialect4() {
String input = "rule MyRule \n" + " dialect \"";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
DroolsToken token = getLastTokenOnList(parser.getEditorInterface().get(0).getContent());
assertEquals("dialect", token.getText().toLowerCase());
assertEquals(DroolsEditorType.KEYWORD, token.getEditorType());
assertEquals(Location.LOCATION_RULE_HEADER_KEYWORD, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.lang.DroolsToken in project drools by kiegroup.
the class DRLContextTest method testCheckRuleHeaderLocationDetermination2.
@Test(timeout = 10 * 1000)
public void testCheckRuleHeaderLocationDetermination2() {
String input = "rule MyRule \n" + " salience 12 activation-group \"my";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
DroolsToken token = getLastTokenOnList(parser.getEditorInterface().get(0).getContent());
assertEquals("group", token.getText().toLowerCase());
assertEquals(DroolsEditorType.KEYWORD, token.getEditorType());
assertEquals(Location.LOCATION_RULE_HEADER_KEYWORD, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.lang.DroolsToken in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_BEGIN_OF_CONDITION_AND_OR4.
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_BEGIN_OF_CONDITION_AND_OR4() {
String input = "rule MyRule \n" + " when \n" + " name : Class ( name: property ) and ";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
DroolsToken token = (DroolsToken) parser.getEditorInterface().get(0).getContent().get(12);
assertEquals(DroolsEditorType.IDENTIFIER_VARIABLE, token.getEditorType());
}
use of org.drools.drl.parser.lang.DroolsToken in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_INSIDE_CONDITION_START8.
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_INSIDE_CONDITION_START8() {
String input = "rule MyRule \n" + " when \n" + " Class ( c: condition, \n" + " ";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
DroolsToken token = (DroolsToken) parser.getEditorInterface().get(0).getContent().get(11);
assertEquals("c", token.getText());
assertEquals(DroolsEditorType.IDENTIFIER_VARIABLE, token.getEditorType());
assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_START, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.lang.DroolsToken in project drools by kiegroup.
the class DRLContextTest method testCheckRuleHeaderLocationDetermination_dialect3.
@Test(timeout = 10 * 1000)
public void testCheckRuleHeaderLocationDetermination_dialect3() {
String input = "rule MyRule \n" + " dialect ";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
DroolsToken token = getLastTokenOnList(parser.getEditorInterface().get(0).getContent());
assertEquals("dialect", token.getText().toLowerCase());
assertEquals(DroolsEditorType.KEYWORD, token.getEditorType());
assertEquals(Location.LOCATION_RULE_HEADER_KEYWORD, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
Aggregations