int idx = 0;
int numEntitiesToBeAdded = 10;
int numEntitiesToBeUpdated = 5;
int numEntitiesToBeDeleted = 2;
IEntityCache cacheA = getInvalidatingEntityCache();
ReferenceInvalidatingEntityCache recA = (ReferenceInvalidatingEntityCache) cacheA;
IEntityCache cacheB = getInvalidatingEntityCache();
ReferenceInvalidatingEntityCache recB = (ReferenceInvalidatingEntityCache) cacheB;
msg = "Adding " + numEntitiesToBeAdded + " entities to FIRST cache.";
print(msg);
for(idx=0; idx<numEntitiesToBeAdded; idx++)
{ cacheA.add(testEntities[idx]); }
assertEquals(msg, recA.size(), numEntitiesToBeAdded);
Thread.sleep(100);
msg = "Updating " + numEntitiesToBeUpdated + " in first cache.";
print(msg);
for(idx=0; idx<numEntitiesToBeUpdated; idx++)
{ cacheA.update( testEntities[idx] ); }
msg = "Adding " + numEntitiesToBeAdded + " entities to SECOND cache.";
print(msg);
for(idx=0; idx<numEntitiesToBeAdded; idx++)
{ cacheB.add(testEntities[idx]); }
assertEquals(msg, recB.size(), numEntitiesToBeAdded);
msg = "Removing " + numEntitiesToBeDeleted + " from second cache.";
print(msg);
for(idx=numEntitiesToBeUpdated; idx<numEntitiesToBeUpdated + numEntitiesToBeDeleted; idx++)
{ cacheB.remove( testEntityKeys[idx] ); }
print("Will now sleep for " + (cacheSweepIntervalSecs + 5) + " seconds.");
Thread.sleep( (cacheSweepIntervalSecs + 5) * 1000);
// Check the caches.