use of org.apache.ignite.internal.processors.cache.GridCacheEntryEx in project ignite by apache.
the class GridCacheNearOneNodeSelfTest method testOptimisticTxWriteThrough.
/**
* Test Optimistic repeatable read write-through.
*
* @throws Exception If failed.
*/
@SuppressWarnings({ "ConstantConditions" })
public void testOptimisticTxWriteThrough() throws Exception {
IgniteCache<Object, Object> near = jcache();
GridCacheAdapter<Integer, String> dht = dht();
try (Transaction tx = grid().transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) {
near.put(2, "2");
near.put(3, "3");
assert "2".equals(near.get(2));
assert "3".equals(near.get(3));
GridCacheEntryEx entry = dht.peekEx(2);
assert entry == null || entry.rawGet() == null : "Invalid entry: " + entry;
tx.commit();
}
assert "2".equals(near.get(2));
assert "3".equals(near.get(3));
assert "2".equals(dht.get(2));
assert "3".equals(dht.get(3));
assertEquals(2, near.size());
assertEquals(2, near.size());
assertEquals(2, dht.size());
assertEquals(2, dht.size());
}
Aggregations