final ReteooWorkingMemory workingMemory = (ReteooWorkingMemory) ruleBase.newStatefulSession();
final DefaultAgenda agenda = (DefaultAgenda) workingMemory.getAgenda();
// create rule1
final Consequence consequence1 = new Consequence() {
private static final long serialVersionUID = 510l;
public void evaluate(KnowledgeHelper knowledgeHelper,
WorkingMemory workingMemory) {
// do nothing
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
}
public void writeExternal(ObjectOutput out) throws IOException {
}
public String getName() {
return "default";
}
};
final Rule rule1 = new Rule( "test-rule1" );
rule1.setRuleFlowGroup( "rule-flow-group-0" );
rule1.setConsequence( consequence1 );
final RuleTerminalNode node1 = new RuleTerminalNode( 4,
new MockTupleSource( 2 ),
rule1,
rule1.getLhs(),
0,
buildContext );
// create context
final PropagationContext context0 = new PropagationContextImpl( 0,
PropagationContext.INSERTION,
rule1,
null,
new DefaultFactHandle() );
final LeftTupleImpl tuple1 = new LeftTupleImpl( new DefaultFactHandle( 1,
"cheese" ),
null,
true );
// create rule0
final Consequence consequence0 = new Consequence() {
private static final long serialVersionUID = 510l;
public void evaluate(KnowledgeHelper knowledgeHelper,
WorkingMemory w) {
// deactivate rule1