Author: mircea.markus
Date: 2009-02-06 09:42:45 -0500 (Fri, 06 Feb 2009)
New Revision: 7658
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java
Log:
added test name and better cleanup in case of failure
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-06
12:27:16 UTC (rev 7657)
+++
core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java 2009-02-06
14:42:45 UTC (rev 7658)
@@ -15,6 +15,8 @@
import java.io.Serializable;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.List;
+import java.util.ArrayList;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheSPI;
@@ -25,8 +27,9 @@
import org.jboss.cache.factories.UnitTestConfigurationFactory;
import org.jboss.cache.util.TestingUtil;
import org.testng.annotations.Test;
+import org.testng.annotations.AfterMethod;
-@Test(groups="functional")
+@Test(groups="functional", testName =
"statetransfer.NonBlockingStateTransferTest")
public class NonBlockingStateTransferTest
{
public static final Fqn A = Fqn.fromString("/a");
@@ -43,6 +46,18 @@
public static final Integer TWENTY = 20;
public static final Integer FORTY = 40;
+ private List<Cache> createdCaches = new ArrayList<Cache>();
+
+ @AfterMethod
+ public void clearCaches()
+ {
+ for (Cache c : createdCaches)
+ {
+ TestingUtil.killCaches(c);
+ }
+ createdCaches.clear();
+ }
+
public static class DelayTransfer implements Serializable
{
private transient int count;
@@ -128,7 +143,9 @@
cache.create();
cache.start();
+ createdCaches.add(cache);
return cache;
+
}
public void testInitialStateTransfer() throws Exception
@@ -143,8 +160,6 @@
TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
verifyInitialData(cache2);
-
- TestingUtil.killCaches(cache1, cache2);
}
@@ -197,8 +212,6 @@
for (int c = 0; c < count; c++)
assertEquals(c, cache2.get("/test" + c, "test"));
-
- TestingUtil.killCaches(cache1, cache2, cache3);
}
private void verifyInitialData(CacheSPI<Object, Object> cache2)
@@ -244,7 +257,5 @@
for (int c = 0; c < count; c++)
assertEquals(c, cache2.get("/test" + c, "test"));
-
- TestingUtil.killCaches(cache1, cache2);
}
}
Show replies by date