Work
This commit is contained in:
parent
0d40acdd39
commit
543772616c
7 changed files with 80 additions and 11 deletions
|
|
@ -1,10 +1,13 @@
|
|||
package droolscours;
|
||||
|
||||
import droolscours.util.OutputDisplay;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.kie.api.runtime.KieContainer;
|
||||
import org.kie.api.runtime.KieSession;
|
||||
import org.kie.api.runtime.StatelessKieSession;
|
||||
import org.kie.api.runtime.rule.FactHandle;
|
||||
import util.DateHelper;
|
||||
import util.KnowledgeSessionHelper;
|
||||
|
||||
|
||||
|
|
@ -19,11 +22,20 @@ public class Testlesson35 {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnFaitSansFait() {
|
||||
public void testAccumulate() throws Exception {
|
||||
sessionStatefull = KnowledgeSessionHelper
|
||||
.getStatefulKnowledgeSession(kieContainer, "lesson1-session");
|
||||
.getStatefulKnowledgeSessionWithCallback(kieContainer, "lesson35-session");
|
||||
OutputDisplay display = new OutputDisplay();
|
||||
sessionStatefull.setGlobal("showResult", display);
|
||||
sessionStatefull.insert(new Account(1, 0));
|
||||
|
||||
FactHandle fa = sessionStatefull.insert(new CashFlow(DateHelper.getDate("2010-01-15"), 1000, CashFlow.CREDIT, 1));
|
||||
sessionStatefull.insert(new CashFlow(DateHelper.getDate("2010-02-15"), 500, CashFlow.DEBIT, 1));
|
||||
sessionStatefull.insert(new CashFlow(DateHelper.getDate("2010-04-15"), 1000, CashFlow.CREDIT, 1));
|
||||
sessionStatefull.insert(new AccountingPeriod(DateHelper.getDate("2010-01-01"), DateHelper.getDate("2010-12-31")));
|
||||
sessionStatefull.fireAllRules();
|
||||
sessionStatefull.delete(fa);
|
||||
sessionStatefull.fireAllRules();
|
||||
System.out.println("Did you see something ?");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue