protected void doTestIgnoreReturnValueAndRead(boolean executeOnPrimaryOwner) throws Exception { final Object key = new MagicKey("ignore-previous-value", cache(0)); final AdvancedCache<Object, Object> c = executeOnPrimaryOwner ? advancedCache(0) : advancedCache(1); final TransactionManager tm = executeOnPrimaryOwner ? tm(0) : tm(1); for (Cache cache : caches()) { assertNull("wrong initial value for " + address(cache) + ".", cache.get(key)); } c.put("k", "init"); tm.begin(); c.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).put("k", "v1"); assertEquals("v1", c.put("k", "v2")); Transaction tx = tm.suspend(); assertEquals("init", c.put("k", "other")); tm.resume(tx); tm.commit(); }
final TransactionManager tm = executeOnPrimaryOwner ? tm(0, PASSIVATION_CACHE) : tm(1, PASSIVATION_CACHE); for (Cache cache : caches(PASSIVATION_CACHE)) { assertNull("wrong initial value for " + address(cache) + ".", cache.get(key)); for (Cache cache : caches(PASSIVATION_CACHE)) { assertEquals("wrong final value for " + address(cache) + ".", finalValue, cache.get(key));
final TransactionManager tm = executeOnPrimaryOwner ? tm(0) : tm(1); for (Cache cache : caches()) { assertNull("wrong initial value for " + address(cache) + ".", cache.get(key)); for (Cache cache : caches()) { assertEquals("wrong intermediate value for " + address(cache) + ".", "v2", cache.get(key)); for (Cache cache : caches()) { assertEquals("wrong final value for " + address(cache) + ".", finalValue, cache.get(key));