public void tesMultiNodeSegmentDifferentInitialisationPoints() {
setUp( JOIN_NODE );
// Initialise from n3
KieBaseConfiguration kconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kconf.setOption( RuleEngineOption.PHREAK );
AbstractWorkingMemory wm = new AbstractWorkingMemory( 1, (ReteooRuleBase) RuleBaseFactory.newRuleBase((RuleBaseConfiguration) kconf) );
createSegmentMemory( n3, wm );
BetaMemory bm = (BetaMemory) wm.getNodeMemory( n1 );
assertNull( bm.getSegmentMemory() );
bm = (BetaMemory) wm.getNodeMemory( n3 );
assertEquals( 1, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n4 );
assertEquals( 2, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n5 );
assertEquals( 4, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n6 );
assertEquals( 8, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
// Initialise from n4
wm = new AbstractWorkingMemory( 1, (ReteooRuleBase) RuleBaseFactory.newRuleBase((RuleBaseConfiguration)kconf) );
bm = createSegmentMemory( n4, wm );
bm = (BetaMemory) wm.getNodeMemory( n1 );
assertNull( bm.getSegmentMemory() );
bm = (BetaMemory) wm.getNodeMemory( n3 );
assertEquals( 1, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n4 );
assertEquals( 2, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n5 );
assertEquals( 4, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n6 );
assertEquals( 8, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
// Initialise from n5
wm = new AbstractWorkingMemory( 1, (ReteooRuleBase) RuleBaseFactory.newRuleBase((RuleBaseConfiguration)kconf) );
createSegmentMemory( n5, wm );
bm = (BetaMemory) wm.getNodeMemory( n1 );
assertNull( bm.getSegmentMemory() );
bm = (BetaMemory) wm.getNodeMemory( n3 );
assertEquals( 1, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n4 );
assertEquals( 2, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n5 );
assertEquals( 4, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n6 );
assertEquals( 8, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
// Initialise from n6
wm = new AbstractWorkingMemory( 1, (ReteooRuleBase) RuleBaseFactory.newRuleBase((RuleBaseConfiguration)kconf) );
createSegmentMemory( n6, wm );
bm = (BetaMemory) wm.getNodeMemory( n1 );
assertNull( bm.getSegmentMemory() );
bm = (BetaMemory) wm.getNodeMemory( n3 );
assertEquals( 1, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n4 );
assertEquals( 2, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n5 );
assertEquals( 4, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
bm = (BetaMemory) wm.getNodeMemory( n6 );
assertEquals( 8, bm.getNodePosMaskBit() );
assertEquals( 15, bm.getSegmentMemory().getAllLinkedMaskTest() );
}