Author: galder.zamarreno(a)jboss.com
Date: 2010-01-20 08:46:30 -0500 (Wed, 20 Jan 2010)
New Revision: 8327
Modified:
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/ConcurrentRepeatableReadTest.java
Log:
[JBCACHE-1555] (Mvcc node peek could contain stale data) Made test a bit more robust.
Modified:
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/ConcurrentRepeatableReadTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/ConcurrentRepeatableReadTest.java 2010-01-20
11:46:20 UTC (rev 8326)
+++
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/ConcurrentRepeatableReadTest.java 2010-01-20
13:46:30 UTC (rev 8327)
@@ -44,6 +44,7 @@
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestConfigurationFactory;
import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.Test;
/**
@@ -63,14 +64,13 @@
UnitTestCacheFactory factory = new UnitTestCacheFactory();
Configuration cfg =
UnitTestConfigurationFactory.createConfiguration(CacheMode.LOCAL);
cfg.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- CacheSPI cache = (CacheSPI) factory.createCache(cfg, false, getClass());
+ CacheSPI cache = (CacheSPI) factory.createCache(cfg, true, getClass());
return cache;
}
public void testConcurrentUpdatesNoWriteSkew(Method m) throws Exception {
final int nbWriters = 10;
log.debug(m.getName());
- cache.start();
init();
CyclicBarrier barrier = new CyclicBarrier(nbWriters + 1);
List<Future<Void>> futures = new
ArrayList<Future<Void>>(nbWriters);
@@ -114,7 +114,7 @@
log.debug("All threads finished, let's shutdown the executor and check
whether any exceptions were reported");
for (Future<Void> future : futures) future.get();
} finally {
- if (cache != null) cache.stop();
+ if (cache != null) TestingUtil.killCaches(cache);
}
}
@@ -136,13 +136,10 @@
TransactionManager tx = getTm();
tx.begin();
try {
- // cache.put("/foo/mynode", "_lockthisplease_",
"_lockthisplease_");
- // TODO: when testing writeSkew=true, uncomment line before and start commenting
here to make it easier to debug...
cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
int tmp = (Integer) cache.get("/foo/mynode", "scalar");
tmp++;
cache.put("/foo/mynode", "scalar", tmp);
- // TODO: ...and finish commenting here
} catch (Exception e) {
log.error("Unexpected", e);
tx.setRollbackOnly();
@@ -158,12 +155,6 @@
tx.begin();
try {
cache.put("/foo/mynode", "_lockthisplease_",
"_lockthisplease_");
-// // TODO: when testing writeSkew=true, uncomment line before and start
commenting here to make it easier to debug...
-// cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
-// int tmp = (Integer) cache.get("/foo/mynode", "scalar");
-// tmp++;
-// cache.put("/foo/mynode", "scalar", tmp);
-// // TODO: ...and finish commenting here
} catch (Exception e) {
log.error("Unexpected", e);
tx.setRollbackOnly();