n2 = cache2.getNode(fqn);
CacheLoaderInvalidationTest.assertHasBeenInvalidated(n2, "Should have been invalidated");
CacheLoaderInvalidationTest.assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
// with tx's
TransactionManager txm = cache2.getTransactionManager();
txm.begin();
cache2.put(fqn, "key", "value");
assertEquals("value", cache2.get(fqn, "key"));
assertEquals("value2", cache1.get(fqn, "key2"));
txm.commit();
n1 = cache1.getNode(fqn);
CacheLoaderInvalidationTest.assertHasBeenInvalidated(n1, "Should have been invalidated");
CacheLoaderInvalidationTest.assertHasBeenInvalidated(cache1.peek(fqn, false, false), "Should have been invalidated");
assertEquals("value", cache2.get(fqn, "key"));
// now test the invalidation again
txm = cache1.getTransactionManager();
txm.begin();
cache1.put(fqn, "key2", "value2");
assertEquals("value", cache2.get(fqn, "key"));
assertEquals("value2", cache1.get(fqn, "key2"));
txm.commit();
assertEquals("value2", cache1.get(fqn, "key2"));
n2 = cache2.getNode(fqn);
CacheLoaderInvalidationTest.assertHasBeenInvalidated(n2, "Should have been invalidated");
CacheLoaderInvalidationTest.assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");
// test a rollback
txm = cache2.getTransactionManager();
txm.begin();
cache2.put(fqn, "key", "value");
assertEquals("value2", cache1.get(fqn, "key2"));
assertEquals("value", cache2.get(fqn, "key"));
txm.rollback();
assertEquals("value2", cache1.get(fqn, "key2"));
n2 = cache2.getNode(fqn);
CacheLoaderInvalidationTest.assertHasBeenInvalidated(n2, "Should have been invalidated");
CacheLoaderInvalidationTest.assertHasBeenInvalidated(cache2.peek(fqn, false, false), "Should have been invalidated");