assertEquals( 1, count );
ObjectHashMap equalityMap = ep.getTruthMaintenanceSystem().getEqualityKeyMap();
assertEquals( 1, equalityMap.size() ); // Only Person type is logical
org.drools.core.util.Iterator it = equalityMap.iterator();
EqualityKey key = ( EqualityKey ) (( ObjectEntry ) it.next() ).getValue();
while ( !key.getFactHandle().getObject().equals( new Person( "darth") ) ) {
key = ( EqualityKey ) (( ObjectEntry ) it.next() ).getValue();
}
assertEquals( 3, key.getBeliefSet().size() );
assertEquals( new Integer(1), ((Person)((JTMSBeliefSetImpl)key.getBeliefSet()).getNegativeFactHandle().getObject()).getNotInEqualTestObject() );
kSession.retract( fhGo1 );
kSession.fireAllRules();
it = equalityMap.iterator();
key = ( EqualityKey ) (( ObjectEntry ) it.next() ).getValue();
while ( !key.getFactHandle().getObject().equals( new Person( "darth") ) ) {
key = ( EqualityKey ) (( ObjectEntry ) it.next() ).getValue();
}
assertEquals( 2, key.getBeliefSet().size() );
assertEquals( new Integer(3), ((Person)((JTMSBeliefSetImpl)key.getBeliefSet()).getNegativeFactHandle().getObject()).getNotInEqualTestObject() );
kSession.retract( fhGo3 );
kSession.fireAllRules();
it = equalityMap.iterator();
key = ( EqualityKey ) (( ObjectEntry ) it.next() ).getValue();
while ( !key.getFactHandle().getObject().equals( new Person( "darth") ) ) {
key = ( EqualityKey ) (( ObjectEntry ) it.next() ).getValue();
}
assertEquals( 1, key.getBeliefSet().size() );
assertEquals( new Integer(2), ((Person)((JTMSBeliefSetImpl)key.getBeliefSet()).getNegativeFactHandle().getObject()).getNotInEqualTestObject() );
}