[infinispan-commits] Infinispan SVN: r1588 - trunk/tree/src/test/java/org/infinispan/api/tree.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Wed Mar 10 12:01:15 EST 2010


Author: galder.zamarreno at jboss.com
Date: 2010-03-10 12:01:14 -0500 (Wed, 10 Mar 2010)
New Revision: 1588

Modified:
   trunk/tree/src/test/java/org/infinispan/api/tree/NodeAPITest.java
   trunk/tree/src/test/java/org/infinispan/api/tree/TreeCacheAPITest.java
Log:
Fixed failing unit tests because cache managers were not being shutdown.

Modified: trunk/tree/src/test/java/org/infinispan/api/tree/NodeAPITest.java
===================================================================
--- trunk/tree/src/test/java/org/infinispan/api/tree/NodeAPITest.java	2010-03-10 16:47:28 UTC (rev 1587)
+++ trunk/tree/src/test/java/org/infinispan/api/tree/NodeAPITest.java	2010-03-10 17:01:14 UTC (rev 1588)
@@ -2,6 +2,7 @@
 
 import org.infinispan.config.Configuration;
 import org.infinispan.manager.CacheManager;
+import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.tree.Fqn;
@@ -26,28 +27,24 @@
  * @author <a href="mailto:manik AT jboss DOT org">Manik Surtani</a>
  */
 @Test(groups = "functional", testName = "api.tree.NodeAPITest")
-public class NodeAPITest {
+public class NodeAPITest extends SingleCacheManagerTest {
    static final Fqn A = Fqn.fromString("/a"), B = Fqn.fromString("/b"), C = Fqn.fromString("/c"), D = Fqn.fromString("/d");
    Fqn A_B = Fqn.fromRelativeFqn(A, B);
    Fqn A_C = Fqn.fromRelativeFqn(A, C);
    TransactionManager tm;
    TreeCache cache;
 
-   @BeforeMethod(alwaysRun = true)
-   public void setUp() throws Exception {
+   @Override
+   protected CacheManager createCacheManager() throws Exception {
       // start a single cache instance
-      Configuration c = new Configuration();
+      Configuration c = getDefaultStandaloneConfig(true);
       c.setInvocationBatchingEnabled(true);
       CacheManager cm = TestCacheManagerFactory.createCacheManager(c, true);
       cache = new TreeCacheImpl(cm.getCache());
       tm = TestingUtil.getTransactionManager(cache.getCache());
+      return cm;
    }
 
-   @AfterMethod
-   public void tearDown() {
-      TestingUtil.killCaches(cache.getCache());
-   }
-
    public void testAddingData() {
       Node<Object, Object> rootNode = cache.getRoot();
       Node<Object, Object> nodeA = rootNode.addChild(A);

Modified: trunk/tree/src/test/java/org/infinispan/api/tree/TreeCacheAPITest.java
===================================================================
--- trunk/tree/src/test/java/org/infinispan/api/tree/TreeCacheAPITest.java	2010-03-10 16:47:28 UTC (rev 1587)
+++ trunk/tree/src/test/java/org/infinispan/api/tree/TreeCacheAPITest.java	2010-03-10 17:01:14 UTC (rev 1588)
@@ -5,6 +5,7 @@
 import org.infinispan.atomic.AtomicMapLookup;
 import org.infinispan.config.Configuration;
 import org.infinispan.manager.CacheManager;
+import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.infinispan.test.fwk.TransactionSetup;
@@ -31,13 +32,13 @@
  */
 
 @Test(groups = "functional", testName = "api.tree.TreeCacheAPITest")
-public class TreeCacheAPITest {
+public class TreeCacheAPITest extends SingleCacheManagerTest {
    private TreeCache<String, String> cache;
    private TransactionManager tm;
    private Log log = LogFactory.getLog(TreeCacheAPITest.class);
 
-   @BeforeMethod(alwaysRun = true)
-   public void setUp() throws Exception {
+   @Override
+   protected CacheManager createCacheManager() throws Exception {
       // start a single cache instance
       Configuration c = new Configuration();
       c.setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
@@ -48,14 +49,9 @@
       cache = new TreeCacheImpl(flatcache);
 
       tm = TestingUtil.getTransactionManager(flatcache);
+      return cm;
    }
 
-   @AfterMethod(alwaysRun = true)
-   public void tearDown() {
-//      TestingUtil.killTreeCaches(cache);
-      cache = null;
-   }
-
    public void testConvenienceMethods() {
       Fqn fqn = Fqn.fromString("/test/fqn");
       String key = "key", value = "value";



More information about the infinispan-commits mailing list