use of org.drools.core.io.impl.FileSystemResource in project drools by kiegroup.
the class ChangesetUndoTest method testCompilationUndoAfterGoodResults.
@Test
public void testCompilationUndoAfterGoodResults() {
KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add(new FileSystemResource(resources[1]), ResourceType.DRL);
knowledgeBuilder.add(new FileSystemResource(resources[4]), ResourceType.CHANGE_SET);
assertTrue(knowledgeBuilder.hasErrors());
knowledgeBuilder.undo();
assertFalse(knowledgeBuilder.hasErrors());
for (KiePackage kp : knowledgeBuilder.getKnowledgePackages()) {
if ("org.drools.test1".equals(kp.getName())) {
assertEquals(1, kp.getRules().size());
assertEquals(1, kp.getFactTypes().size());
} else {
assertTrue(kp.getRules().isEmpty());
assertTrue(kp.getFactTypes().isEmpty());
}
}
;
}
use of org.drools.core.io.impl.FileSystemResource in project drools by kiegroup.
the class ChangesetUndoTest method testCompilationUndo.
@Test
public void testCompilationUndo() {
KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add(new FileSystemResource(resources[0]), ResourceType.CHANGE_SET);
assertTrue(knowledgeBuilder.hasErrors());
knowledgeBuilder.undo();
assertFalse(knowledgeBuilder.hasErrors());
for (KiePackage kp : knowledgeBuilder.getKnowledgePackages()) {
assertTrue(kp.getRules().isEmpty());
assertTrue(kp.getFactTypes().isEmpty());
}
;
}
Aggregations