JBoss Cache SVN: r7808 - core/trunk/src/test/java/org/jboss/cache/statetransfer.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-27 19:39:42 -0500 (Fri, 27 Feb 2009)
New Revision: 7808
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/NBSTCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java
Log:
Fixed NBST + CL test
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/NBSTCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/NBSTCacheLoaderTest.java 2009-02-27 17:41:15 UTC (rev 7807)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/NBSTCacheLoaderTest.java 2009-02-28 00:39:42 UTC (rev 7808)
@@ -12,7 +12,7 @@
import java.io.IOException;
-@Test(groups = "functional", testName = "statetransfer.NBSTCacheLoaderTest", enabled = false)
+@Test(groups = "functional", testName = "statetransfer.NBSTCacheLoaderTest", enabled = true)
public class NBSTCacheLoaderTest extends NonBlockingStateTransferTest
{
int id;
@@ -83,18 +83,26 @@
public void testSharedLoader() throws Exception
{
sharedCacheLoader.set(true);
- CacheSPI<Object, Object> c1 = createCache("testSharedLoader", true);
- writeInitialData(c1);
+ CacheSPI<Object, Object> c1=null, c2= null;
+ try
+ {
+ c1 = createCache("testSharedLoader", true);
+ writeInitialData(c1);
- // starting the second cache would initialize an in-memory state transfer but not a persistent one since the loader is shared
- CacheSPI<Object, Object> c2 = createCache("testSharedLoader", true);
+ // starting the second cache would initialize an in-memory state transfer but not a persistent one since the loader is shared
+ c2 = createCache("testSharedLoader", true);
- TestingUtil.blockUntilViewsReceived(60000, c1, c2);
+ TestingUtil.blockUntilViewsReceived(60000, c1, c2);
- verifyInitialDataOnLoader(c1);
- verifyInitialData(c1);
+ verifyInitialDataOnLoader(c1);
+ verifyInitialData(c1);
- verifyNoDataOnLoader(c2);
- verifyNoData(c2);
+ verifyNoDataOnLoader(c2);
+ verifyNoData(c2);
+ }
+ finally
+ {
+ TestingUtil.killCaches(c1, c2);
+ }
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java 2009-02-27 17:41:15 UTC (rev 7807)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java 2009-02-28 00:39:42 UTC (rev 7808)
@@ -116,6 +116,10 @@
commitTxIfNeeded();
}
}
+ catch (InterruptedException ie)
+ {
+ stop = true;
+ }
catch (Exception e)
{
e.printStackTrace();
@@ -338,9 +342,10 @@
cache2 = createCache(name);
// Pause to give caches time to see each other
- TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2, cache3 }, 60000);
+ TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2, cache3 }, 120000); // this could take a while since WritingRunner is creating a lot of stuff
writer.stop();
+ writerThread.interrupt();
writerThread.join();
verifyInitialData(cache2);
@@ -395,6 +400,7 @@
TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2 }, 60000);
writer.stop();
+ writerThread.interrupt();
writerThread.join();
verifyInitialData(cache2);
@@ -406,7 +412,7 @@
}
finally
{
- TestingUtil.killCaches(cache1, cache2);
+ TestingUtil.killCaches(cache1, cache2);
}
}
}