final ReteooWorkingMemory workingMemory = (ReteooWorkingMemory) ruleBase.newStatefulSession();
final DefaultAgenda agenda = (DefaultAgenda) workingMemory.getAgenda();
// create rule1
final Consequence consequence1 = new Consequence() {
private static final long serialVersionUID = 400L;
public void evaluate(KnowledgeHelper knowledgeHelper,
WorkingMemory workingMemory) {
// do nothing
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
}
public void writeExternal(ObjectOutput out) throws IOException {
}
};
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(),
buildContext );
// create context
final PropagationContext context0 = new PropagationContextImpl( 0,
PropagationContext.ASSERTION,
rule1,
null,
null );
final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ),
null,
true );
// create rule0
final Consequence consequence0 = new Consequence() {
private static final long serialVersionUID = 400L;
public void evaluate(KnowledgeHelper knowledgeHelper,
WorkingMemory w) {
// deactivate rule1