If a key written by a transaction cannot be invalidated the transaction should fail
-----------------------------------------------------------------------------------
Key: ISPN-1702
URL:
https://issues.jboss.org/browse/ISPN-1702
Project: Infinispan
Issue Type: Bug
Reporter: Mircea Markus
Assignee: Mircea Markus
Priority: Critical
UT below:
{code}
package org.infinispan.invalidation;
import org.infinispan.configuration.cache.CacheMode;
import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.container.DataContainer;
import org.infinispan.context.Flag;
import org.infinispan.test.MultipleCacheManagersTest;
import org.infinispan.test.TestingUtil;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
/**
* @author Mircea Markus <mircea.markus(a)jboss.com> (C) 2011 Red Hat Inc.
* @since 5.1
*/
@Test (groups = "functional", testName =
"invalidation.InvalidationTxTest")
public class InvalidationTxTest extends MultipleCacheManagersTest {
@Override
protected void createCacheManagers() throws Throwable {
ConfigurationBuilder config =
getDefaultClusteredCacheConfig(CacheMode.INVALIDATION_SYNC, true);
createCluster(config, 2);
waitForClusterToForm();
}
public void testInvalidationFailsDuringPrepare() throws Exception {
cache(0).put("k","v0");
DataContainer dc0 = getDataContainer(0);
assert dc0.get("k").getValue().equals("v0");
DataContainer dc1 = getDataContainer(1);
assert dc1.get("k") == null;
advancedCache(1).withFlags(Flag.CACHE_MODE_LOCAL).put("k",
"v1");
assert dc0.get("k").getValue().equals("v0");
assertEquals(dc1.get("k").getValue(), "v1");
tm(1).begin();
cache(1).put("k", "v");
tm(1).suspend();
lockManager(1).isLocked("k");
tm(0).begin();
cache(0).put("k", "v2");
try {
tm(0).commit();
assert false : "this fails";
} catch (Exception t) {
//expected
}
}
private DataContainer getDataContainer(int index) {
return TestingUtil.extractComponent(cache(index), DataContainer.class);
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira