use of org.drools.compiler.compiler.DrlParser in project drools by kiegroup.
the class DRLIncompleteCodeTest method testIncompleteCode6.
@Test
public void testIncompleteCode6() throws DroolsParserException, RecognitionException {
String input = "packe 1111.111 import a.b.c.*" + " rule MyRule when Class ( property memberOf collection ) then end " + " query MyQuery Class ( property memberOf collection ) end ";
DrlParser parser = new DrlParser(LanguageLevelOption.DRL5);
PackageDescr descr = parser.parse(true, input);
assertNotNull(descr);
}
use of org.drools.compiler.compiler.DrlParser in project drools by kiegroup.
the class DRLIncompleteCodeTest method testIncompleteCode1.
@Test
@Ignore
public void testIncompleteCode1() throws DroolsParserException, RecognitionException {
String input = "package a.b.c import a.b.c.* rule MyRule when Class ( property memberOf collexction ";
DrlParser parser = new DrlParser(LanguageLevelOption.DRL5);
PackageDescr descr = parser.parse(true, input);
System.out.println(parser.getErrors());
assertNotNull(descr);
assertEquals("a.b.c", descr.getNamespace());
assertEquals("a.b.c.*", descr.getImports().get(0).getTarget());
assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_END, getLastIntegerValue(parser.getEditorSentences().get(2).getContent()));
}
use of org.drools.compiler.compiler.DrlParser in project drools by kiegroup.
the class DRLIncompleteCodeTest method testIncompleteCode11.
@Test
public void testIncompleteCode11() throws DroolsParserException, RecognitionException {
String input = "package a.b.c import a.b.c.*" + " rule MyRule when Class ( property memberOf collection ) then end " + " qzzzzuery MyQuery Class ( property ";
DrlParser parser = new DrlParser(LanguageLevelOption.DRL5);
PackageDescr descr = parser.parse(true, input);
assertEquals("a.b.c", descr.getNamespace());
assertEquals("a.b.c.*", descr.getImports().get(0).getTarget());
assertNotNull(descr);
assertEquals("MyRule", descr.getRules().get(0).getName());
}
use of org.drools.compiler.compiler.DrlParser in project drools by kiegroup.
the class DRLIncompleteCodeTest method testIncompleteCode3.
@Test
public void testIncompleteCode3() throws DroolsParserException, RecognitionException {
String input = "rule MyRule when Class ( property > somevalue ) then end query MyQuery Class ( property == collection ) end ";
DrlParser parser = new DrlParser(LanguageLevelOption.DRL5);
PackageDescr descr = parser.parse(true, input);
assertNotNull(descr);
assertEquals("MyRule", descr.getRules().get(0).getName());
assertNotNull(descr);
assertEquals("MyQuery", descr.getRules().get(1).getName());
assertEquals(Location.LOCATION_RHS, getLastIntegerValue(parser.getEditorSentences().get(0).getContent()));
}
use of org.drools.compiler.compiler.DrlParser in project drools by kiegroup.
the class DRLIncompleteCodeTest method testIncompleteCode12.
@Test
public void testIncompleteCode12() throws DroolsParserException, RecognitionException {
String input = "package a.b.c " + "import a.b.c.* " + "rule MyRule" + " when " + " m: Message( ) " + " " + " then" + "end ";
DrlParser parser = new DrlParser(LanguageLevelOption.DRL5);
PackageDescr descr = parser.parse(true, input);
assertNotNull(descr);
assertEquals("a.b.c", descr.getNamespace());
assertEquals("a.b.c.*", descr.getImports().get(0).getTarget());
}
Aggregations