public void testSyncTxReplMap() throws Exception { Integer age; TransactionManager tm = TestingUtil.getTransactionManager(cache1); tm.begin(); Transaction tx = tm.getTransaction(); LocalListener lis = new LocalListener(); cache1.put("age", 38); lis.put("name", "Ben"); assert cache1.get("age").equals(38); tm.suspend(); assertNull( "age on cache2 must be null as the TX has not yet been committed", cache2.get("age")); assertNull("age on cache1 must be null as the TX has been resumed", cache1.get("age")); tm.resume(tx); assertNotNull("age on cache1 must be not be null", cache1.get("age")); tm.commit(); assertNotNull("age on cache1 must be not be null", cache1.get("age")); System.out.println(" ********************** "); // value on cache2 must be 38 age = (Integer) cache2.get("age"); assertNotNull("\"age\" obtained from cache2 must be non-null ", age); assertTrue("\"age\" must be 38", age == 38); }
public void testSyncRepl() throws Exception { Integer age; LocalListener lis = new LocalListener(); cache1.addListener(lis); lis.put("age", 38); // value on cache2 must be 38 age = (Integer) cache2.get("age"); assertNotNull("\"age\" obtained from cache2 must be non-null ", age); assertTrue("\"age\" must be 38", age == 38); }
public void testSyncReplMap() throws Exception { Integer age; LockManager lm1 = TestingUtil.extractComponent(cache1, LockManager.class); assert lm1.getOwner("age") == null : "lock info is " + lm1.printLockInfo(); LocalListener lis = new LocalListener(); cache1.addListener(lis); lis.put("age", 38); assert lm1.getOwner("age") == null : "lock info is " + lm1.printLockInfo(); cache1.put("name", "Ben"); // value on cache2 must be 38 age = (Integer) cache2.get("age"); assertNotNull("\"age\" obtained from cache2 must be non-null ", age); assertTrue("\"age\" must be 38", age == 38); assert lm1.getOwner("age") == null : "lock info is " + lm1.printLockInfo(); }