use of org.drools.drl.parser.MessageImpl in project drools by kiegroup.
the class KieModuleIncrementalCompilationTest method checkIncrementalCompilationWithMultipleKieBases.
@Test
public void checkIncrementalCompilationWithMultipleKieBases() throws Exception {
String rule = "package org.kie.scanner\n" + "rule R1 when\n" + "then\n" + "end\n";
String invalidRule = "package org.kie.scanner\n" + "rule R2 when\n" + // missing import
" Cheese()\n" + "then\n" + "end\n";
KieServices ks = KieServices.Factory.get();
KieFileSystem kfs = createKieFileSystemWithTwoKBases(ks);
kfs.write("src/main/resources/org/kie/scanner/rule.drl", rule);
KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll();
assertEquals(0, kieBuilder.getResults().getMessages().size());
kfs.write("src/main/resources/org/kie/scanner/invalidRule.drl", invalidRule);
IncrementalResults addResults = ((InternalKieBuilder) kieBuilder).createFileSet("src/main/resources/org/kie/scanner/invalidRule.drl").build();
assertEquals(2, addResults.getAddedMessages().size());
addResults.getAddedMessages().stream().map(m -> (MessageImpl) m).forEach(m -> assertNotNull(m.getKieBaseName()));
}
use of org.drools.drl.parser.MessageImpl in project drools by kiegroup.
the class ResultsImpl method addMessage.
public InternalMessage addMessage(Level level, String path, String text) {
InternalMessage message = new MessageImpl(idGenerator++, level, path, text);
messages.add(message);
return message;
}
Aggregations