// Create first justifier
rule1.setConsequence( consequence );
final DefaultFactHandle handle1 = new DefaultFactHandle( 1,
"cheese" );
final RuleTerminalNodeLeftTuple tuple1 = new RuleTerminalNodeLeftTuple( handle1,
node,
true );
final PropagationContext context1 = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, new DefaultFactHandle());
// get the activation onto the agenda
node.assertLeftTuple( tuple1,
context1,
ksession );
// Create the second justifier
final RuleImpl rule2 = new RuleImpl( "test-rule2" );
final RuleTerminalNode node2 = new RuleTerminalNode( idGenerator.getNextId(),
new MockTupleSource( idGenerator.getNextId() ),
rule2,
rule2.getLhs(),
0,
buildContext );
rule2.setConsequence( consequence );
final DefaultFactHandle handle2 = new DefaultFactHandle( 2,
"cheese" );
final RuleTerminalNodeLeftTuple tuple2 = new RuleTerminalNodeLeftTuple( handle2,
node2,
true );
final PropagationContext context2 = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, new DefaultFactHandle());
// get the activations onto the agenda
node2.assertLeftTuple( tuple2,
context2,
ksession );
// Create the first justifieable relationship
final String logicalString1 = new String( "logical" );
final InternalFactHandle logicalHandle1 = (InternalFactHandle) ksession.insert( logicalString1,
"value1",
false,
true,
rule1,
(Activation) tuple1.getObject() );
new RightTuple( logicalHandle1,
sink );
// Create the second justifieable relationship
final String logicalString2 = new String( "logical" );
final InternalFactHandle logicalHandle2 = (InternalFactHandle) ksession.insert( logicalString2,
"value2",
false,
true,
rule2,
(Activation) tuple2.getObject() );
assertSame( logicalHandle1, logicalHandle2 );
TruthMaintenanceSystem tms = ((NamedEntryPoint)ksession.getWorkingMemoryEntryPoint( EntryPointId.DEFAULT.getEntryPointId() ) ).getTruthMaintenanceSystem();