/*
* @see JBRULES-356
*/
public void testBasicWorkingMemoryActions() {
final ReteooWorkingMemory workingMemory = (ReteooWorkingMemory) RuleBaseFactory.newRuleBase().newStatefulSession();
final TruthMaintenanceSystem tms = workingMemory.getTruthMaintenanceSystem();
final String string = "test";
FactHandle fd = workingMemory.insert( string );
assertEquals( 1,
tms.getAssertMap().size() );
EqualityKey key = tms.get( string );
assertSame( fd,
key.getFactHandle() );
assertNull( key.getOtherFactHandle() );
workingMemory.update( fd,
string );
assertEquals( 1,
tms.getAssertMap().size() );
key = tms.get( string );
assertSame( fd,
key.getFactHandle() );
assertNull( key.getOtherFactHandle() );
workingMemory.retract( fd );
assertEquals( 0,
tms.getAssertMap().size() );
key = tms.get( string );
assertNull( key );
fd = workingMemory.insert( string );
assertEquals( 1,
tms.getAssertMap().size() );
assertEquals( 1,
tms.getAssertMap().size() );
key = tms.get( string );
assertSame( fd,
key.getFactHandle() );
assertNull( key.getOtherFactHandle() );
}