assert mvli.invocationCount == 0 : "Call should not have gone beyond the MarshalledValueInterceptor";
}
public void testReleaseObjectValueReferences() {
Cache cache1 = cache(0, "replSync");
Cache cache2 = cache(1, "replSync");
assert cache1.isEmpty();
Pojo value = new Pojo();
System.out.println(TestingUtil.extractComponent(cache1, InterceptorChain.class).toString());
cache1.put("key", value);
assert cache1.containsKey("key");
assertSerializationCounts(1, 0);
DataContainer dc1 = TestingUtil.extractComponent(cache1, DataContainer.class);
InternalCacheEntry ice = dc1.get("key");
Object o = ice.getValue();
assert o instanceof MarshalledValue;
MarshalledValue mv = (MarshalledValue) o;
assertDeserialized(mv);
assert cache1.get("key").equals(value);
assertDeserialized(mv);
assertSerializationCounts(1, 0);
cache1.compact();
assertSerializationCounts(2, 0);
assertOnlyOneRepresentationExists(mv);
assertSerialized(mv);
// now on cache 2
DataContainer dc2 = TestingUtil.extractComponent(cache2, DataContainer.class);
ice = dc2.get("key");
o = ice.getValue();
assert o instanceof MarshalledValue;
mv = (MarshalledValue) o;
assertSerialized(mv); // this proves that unmarshalling on the recipient cache instance is lazy
assert cache2.get("key").equals(value);
assertDeserialized(mv);
assertSerializationCounts(2, 1);
cache2.compact();
assertSerializationCounts(2, 1);
assertOnlyOneRepresentationExists(mv);
assertSerialized(mv);
}