Source:
<code>private void testNonOriginatorFailsAfterPrepare(int primaryOwnerIndex, int toKillIndex) throws Exception { Address originator = address(0); Address primaryOwner = address(primaryOwnerIndex); Address toKill = address(toKillIndex); MagicKey key = new MagicKey(cache(primaryOwnerIndex), cache(toKillIndex)); Cache<Object, Object> originatorCache = cache(0); DistributionManager dm0 = advancedCache(0).getDistributionManager(); EmbeddedTransaction dummyTransaction = beginAndSuspendTx(originatorCache, key); prepareTransaction(dummyTransaction); log.debugf("Killing %s, key owners are %s", toKill, dm0.getCacheTopology().getWriteOwners(key)); killMember(toKillIndex); log.debugf("Killed %s, key owners are %s", toKill, dm0.getCacheTopology().getWriteOwners(key)); Address newPrimaryOwner = dm0.getCacheTopology().getDistribution(key).primary(); for (Cache<Object, Object> c : caches()) { if (!address(c).equals(originator)) { TransactionTable nonOwnerTxTable = TestingUtil.extractComponent(c, TransactionTable.class); assertEquals(1, nonOwnerTxTable.getRemoteGlobalTransaction().size()); } boolean expectLocked = newPrimaryOwner.equals(primaryOwner) && address(c).equals(newPrimaryOwner); boolean locked = extractLockManager(c).isLocked(key); log.tracef("On %s, locked = %s", address(c), locked); assertEquals(expectLocked, locked); } log.trace("About to commit. Killed node is: " + toKill); commitTransaction(dummyTransaction); for (Cache<?, ?> c : caches()) { <START> eventuallyEquals(false, () -> extractLockManager(c).isLocked(key)); <END> assertEquals(1, c.keySet().size()); } }</code><technical_language>assertEventuallyNotLocked(c, key)</technical_language>

Target:
private void testNonOriginatorFailsAfterPrepare(int primaryOwnerIndex, int toKillIndex) throws Exception { Address originator = address(0); Address primaryOwner = address(primaryOwnerIndex); Address toKill = address(toKillIndex); MagicKey key = new MagicKey(cache(primaryOwnerIndex), cache(toKillIndex)); Cache<Object, Object> originatorCache = cache(0); DistributionManager dm0 = advancedCache(0).getDistributionManager(); EmbeddedTransaction dummyTransaction = beginAndSuspendTx(originatorCache, key); prepareTransaction(dummyTransaction); log.debugf("Killing %s, key owners are %s", toKill, dm0.getCacheTopology().getWriteOwners(key)); killMember(toKillIndex); log.debugf("Killed %s, key owners are %s", toKill, dm0.getCacheTopology().getWriteOwners(key)); Address newPrimaryOwner = dm0.getCacheTopology().getDistribution(key).primary(); for (Cache<Object, Object> c : caches()) { if (!address(c).equals(originator)) { TransactionTable nonOwnerTxTable = TestingUtil.extractComponent(c, TransactionTable.class); assertEquals(1, nonOwnerTxTable.getRemoteGlobalTransaction().size()); } boolean expectLocked = newPrimaryOwner.equals(primaryOwner) && address(c).equals(newPrimaryOwner); boolean locked = extractLockManager(c).isLocked(key); log.tracef("On %s, locked = %s", address(c), locked); assertEquals(expectLocked, locked); } log.trace("About to commit. Killed node is: " + toKill); commitTransaction(dummyTransaction); for (Cache<?, ?> c : caches()) { assertEventuallyNotLocked(c, key); assertEquals(1, c.keySet().size()); } }