public void testExistenceOfTombstonesWithChildren()
{
Cache<String, String> observer = observerTL.get();
Cache<String, String> modifier = modifierTL.get();
CacheSPI modifierImpl = (CacheSPI) modifier;
CacheSPI observerImpl = (CacheSPI) observer;
modifier.put(child, K, V);
modifier.removeNode(parent);
if (isOptimistic() && invalidation)
{
// if we are using optimistic invalidation then we should see tombstones. NOT otherwise.
NodeSPI modifierParentTombstone = modifierImpl.peek(parent, true, true);
NodeSPI observerParentTombstone = observerImpl.peek(parent, true, true);
NodeSPI modifierChildTombstone = modifierImpl.peek(child, true, true);
NodeSPI observerChildTombstone = observerImpl.peek(child, true, true);
assert modifierParentTombstone != null : "Modifier parent tombstone should not be null";
assert observerParentTombstone != null : "Observer parent tombstone should not be null";
assert modifierChildTombstone != null : "Modifier child tombstone should not be null";
assert observerChildTombstone != null : "Observer child tombstone should not be null";
assert !modifierParentTombstone.isValid() : "Should not be valid";
assert !observerParentTombstone.isValid() : "Should not be valid";
assert !modifierChildTombstone.isValid() : "Should not be valid";
assert !observerChildTombstone.isValid() : "Should not be valid";
assert ((DefaultDataVersion) modifierParentTombstone.getVersion()).getRawVersion() == 1 : "Tombstone should be versioned";
assert ((DefaultDataVersion) observerParentTombstone.getVersion()).getRawVersion() == 1 : "Tombstone should be versioned";
// note that versions on children cannot be incremented/updated since the remove operation was
// performed on the parent.
assert ((DefaultDataVersion) modifierChildTombstone.getVersion()).getRawVersion() == 1 : "Tombstone should be versioned";
assert ((DefaultDataVersion) observerChildTombstone.getVersion()).getRawVersion() == 1 : "Tombstone should be versioned";
}
else
{
// if we are using pess locking there should be NO tombstones, regardless of replication/invalidation!
assert modifierImpl.peek(parent, true, true) == null : "Tombstone should not exist";
assert observerImpl.peek(parent, true, true) == null : "Tombstone should not exist";
assert modifierImpl.peek(child, true, true) == null : "Tombstone should not exist";
assert observerImpl.peek(child, true, true) == null : "Tombstone should not exist";
}
}