"p",
new ArrayList(),
false));
sc.getFixtures().addAll(Arrays.asList(facts));
ExecutionTrace executionTrace = new ExecutionTrace();
sc.getRules().add("rule1");
sc.getRules().add("rule2");
sc.setInclusive(true);
sc.getFixtures().add(executionTrace);
Expectation[] assertions = new Expectation[5];
assertions[0] = new VerifyFact("c1",
ls(new VerifyField("type",
"cheddar",
"==")
));
assertions[1] = new VerifyFact("p",
ls(new VerifyField("name",
"rule1",
"=="),
new VerifyField("status",
"rule2",
"=="))
);
assertions[2] = new VerifyRuleFired("rule1",
1,
null);
assertions[3] = new VerifyRuleFired("rule2",
1,
null);
assertions[4] = new VerifyRuleFired("rule3",
0,
null);
sc.getFixtures().addAll(Arrays.asList(assertions));
KieSession ksession = getKieSession("test_rules2.drl");
ScenarioRunner run = new ScenarioRunner(ksession);
run.run(sc);
assertEquals(2,
executionTrace.getNumberOfRulesFired().intValue());
assertTrue(sc.wasSuccessful());
Thread.sleep(50);
assertTrue((new Date()).after(sc.getLastRunResult()));
assertTrue(executionTrace.getExecutionTimeResult() != null);
assertTrue(executionTrace.getRulesFired().length > 0);
}