use of org.drools.drl.ast.descr.PackageDescr in project drools by kiegroup.
the class RuleParserTest method testSoundsLike.
@Test
public void testSoundsLike() throws Exception {
final PackageDescr pkg = (PackageDescr) parseResource("compilationUnit", "soundslike_operator.drl");
RuleDescr rule = (RuleDescr) pkg.getRules().get(0);
PatternDescr pat = (PatternDescr) rule.getLhs().getDescrs().get(0);
pat.getConstraint();
}
use of org.drools.drl.ast.descr.PackageDescr 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());
}
use of org.drools.drl.ast.descr.PackageDescr in project drools by kiegroup.
the class DRLIncompleteCodeTest method testIncompleteCode10.
@Test
@Ignore
public void testIncompleteCode10() throws DroolsParserException, RecognitionException {
String input = "package a.b.c import a.b.c.*" + " rule MyRule xxxxx Class ( property memberOf " + " query MyQuery Class ( property memberOf collection ) end ";
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());
assertEquals(0, descr.getRules().size());
}
use of org.drools.drl.ast.descr.PackageDescr in project drools by kiegroup.
the class DRLIncompleteCodeTest method testIncompleteCode9.
@Test
@Ignore
public void testIncompleteCode9() throws DroolsParserException, RecognitionException {
String input = "package a.b.c import a.b.c.*" + " rule MyRule xxxxx 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);
assertEquals("a.b.c", descr.getNamespace());
assertEquals("a.b.c.*", descr.getImports().get(0).getTarget());
assertEquals(1, descr.getRules().size());
assertEquals("MyQuery", descr.getRules().get(0).getName());
}
use of org.drools.drl.ast.descr.PackageDescr in project drools by kiegroup.
the class DRLIncompleteCodeTest method testIncompleteCode4.
@Test
public void testIncompleteCode4() throws DroolsParserException, RecognitionException {
String input = "package a.b.c import a.b.c.*" + " rule MyRule when Class ( property == collection ) then end " + " query MyQuery Class ( property == collection ) end ";
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());
assertNotNull(descr);
assertEquals("MyQuery", descr.getRules().get(1).getName());
}
Aggregations