use of org.kie.api.builder.Results in project drools by kiegroup.
the class PMMLUsageDemoTest method invokePmmlWithTraitMissing.
@Test
public void invokePmmlWithTraitMissing() {
KieServices ks = KieServices.Factory.get();
KieFileSystem kfs = ks.newKieFileSystem();
kfs.write(ResourceFactory.newClassPathResource(pmmlSource).setResourceType(ResourceType.PMML));
Results res = ks.newKieBuilder(kfs).buildAll().getResults();
if (res.hasMessages(Message.Level.ERROR)) {
System.out.println(res.getMessages(Message.Level.ERROR));
}
assertEquals(0, res.getMessages(Message.Level.ERROR).size());
KieSession kSession = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newKieSession();
kSession.insert("trigger");
kSession.fireAllRules();
System.out.println(reportWMObjects(kSession));
}
use of org.kie.api.builder.Results in project drools by kiegroup.
the class KModuleWithDecisionTablesTest method testNonEmptyKieBaseWithWrongCSV.
@Test
public void testNonEmptyKieBaseWithWrongCSV() throws Exception {
String csv = "\"RuleSet\",\"org.jboss.qa.brms.bre.functional.expert.decisiontable\",,,\n" + "\"Import\",\"org.jboss.qa.brms.domain.Message\",,,\n" + ",,,,\n" + "\"RuleTable TimerCalendarRule\",,,,\n" + "\"NAME\",\"TIMER\",\"CALENDARS\",\"ACTION\",\"Description\"\n" + ",,,,\n" + ",,,\"insert(new Message(\\\"$param\\\"));\",\n" + "\"Rule name\",\"Timer value\",\"Calendar value\",\"Inserted message text\",\"Note\"\n" + "\"Weekend rule\",,\"weekend\",\"Weekend rule\",\n" + "\"Every 100 ms weekday rule\",\"int: 0 100ms\",\"weekday\",\"Every 100 ms weekday rule\",\n" + "\"Delayed Tuesday rule\",\"int: 1000 0\",\"tuesday\",\"Delayed Tuesday rule\",\n" + "\"Delayed repetitive Friday rule\",\"int: 500ms 1s\",\"friday\",\"Delayed repetitive Friday rule\",\n" + "\"Delayed rule\",\"int: 1s 0ms\",,\"Delayed rule\",\n" + "\"Repetitive rule\",\"int: 0ms 100\",,\"Repetitive rule\",\n" + "\"Repetitive delayed rule\",\"int: 1s 100ms\",,\"Repetitive delayed rule\",\n" + "\"Cron rule\",\"cron: */1 * * * * ?\",,\"Cron rule\",\n";
KieServices ks = KieServices.Factory.get();
KieFileSystem kfs = ks.newKieFileSystem().write("src/main/resources/r1.csv", csv);
Results results = ks.newKieBuilder(kfs).buildAll().getResults();
assertFalse(results.getMessages().isEmpty());
}
use of org.kie.api.builder.Results in project drools by kiegroup.
the class CompilationFailuresTest method testNonQuotedStringComapre.
@Test
public void testNonQuotedStringComapre() {
String drl = "declare Fact\n" + " field : String\n" + "end\n" + "rule R when\n" + " Fact( field == someString )\n" + "then\n" + "end\n";
Results results = getCompilationResults(drl);
assertFalse(results.getMessages(Message.Level.ERROR).isEmpty());
}
use of org.kie.api.builder.Results in project drools by kiegroup.
the class CompilationFailuresTest method testBadQueryArg.
@Test
public void testBadQueryArg() {
String drl = "import " + Person.class.getCanonicalName() + "\n" + "query queryWithParamWithoutType( tname , tage)\n" + " person : Person(name == tname, age < tage )\n" + "end\n";
Results results = getCompilationResults(drl);
assertFalse(results.getMessages(Message.Level.ERROR).isEmpty());
}
use of org.kie.api.builder.Results in project drools by kiegroup.
the class OOPathTest method testInvalid.
private void testInvalid(final String drl) {
final KieServices ks = KieServices.Factory.get();
final KieFileSystem kfs = ks.newKieFileSystem().write("src/main/resources/r1.drl", drl);
final Results results = ks.newKieBuilder(kfs).buildAll().getResults();
assertTrue(results.hasMessages(Message.Level.ERROR));
}
Aggregations