this.kbaseUpdated = false;
StatefulKnowledgeSession ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
ksession.setGlobal("list", list);
ksession.insert(new Person());
ksession.fireAllRules();
//The rule should be fired
assertEquals(1, list.size());
assertTrue(list.contains("Rule1"));
list.clear();
ksession.dispose();
Thread.sleep(2000);
//Let's modify the dsl file
f1 = fileManager.newFile("myExpander.dsl");
output = new BufferedWriter(new FileWriter(f1));
output.write(this.createCommonDSL("name == \"John\""));
output.close();
//We need to mark the dslr file as modified (even when it was not) so
//the agent could recreate the rules it contains using the new dsl.
f1 = fileManager.newFile("rules.drl");
output = new BufferedWriter(new FileWriter(f1));
output.write(header);
output.write(this.createCommonDSLRRule("Rule1"));
output.close();
this.waitUntilKBaseUpdate();
//get a new ksession
ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
//A Person without name shouldn't fire any rule now (because it was
//modified)
ksession.setGlobal("list", list);
ksession.insert(new Person());
ksession.fireAllRules();
assertEquals(0, list.size());
//A "John" Person should fire the modified rule
Person p = new Person();
p.setName("John");
ksession.insert(p);
ksession.fireAllRules();
assertEquals(1, list.size());
assertTrue(list.contains("Rule1"));