public void testValidationOnlyInPrimaryOwner() throws Exception {
final Object key = new MagicKey(cache(1), cache(0));
final DataContainer primaryOwnerDataContainer = TestingUtil.extractComponent(cache(1), InternalDataContainer.class);
final DataContainer backupOwnerDataContainer = TestingUtil.extractComponent(cache(0), InternalDataContainer.class);
final VersionGenerator versionGenerator = TestingUtil.extractComponent(cache(1), VersionGenerator.class);
injectReorderResponseRpcManager(cache(3), cache(0));
cache(1).put(key, 1);
for (Cache cache : caches()) {
assertEquals("Wrong initial value for cache " + address(cache), 1, cache.get(key));
assertVersion("Wrong version for the same key", ice0.getMetadata().version(), ice1.getMetadata().version(), EQUAL);
ControllerInboundInvocationHandler handler = wrapInboundInvocationHandler(cache(0), ControllerInboundInvocationHandler::new);
BackupOwnerInterceptor backupOwnerInterceptor = injectBackupOwnerInterceptor(cache(0));
backupOwnerInterceptor.blockCommit(true);
handler.discardRemoteGet = true;
Future<Boolean> tx1 = fork(() -> {
tm(2).begin();
assertEquals("Wrong value for tx1.", 1, cache(2).get(key));
cache(2).put(key, 2);
tm(2).commit();
return Boolean.TRUE;
});
eventually(() -> {
Integer value = (Integer) cache(3).get(key);
return value != null && value == 2;
});