[jbosscache-commits] JBoss Cache SVN: r5318 - in core/trunk/src/test/java/org/jboss/cache: marshall and 1 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Feb 6 20:24:19 EST 2008


Author: manik.surtani at jboss.com
Date: 2008-02-06 20:24:19 -0500 (Wed, 06 Feb 2008)
New Revision: 5318

Modified:
   core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
   core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
Log:
Fixed broken tests

Modified: core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java	2008-02-06 16:23:32 UTC (rev 5317)
+++ core/trunk/src/test/java/org/jboss/cache/lock/PessimisticLockTest.java	2008-02-07 01:24:19 UTC (rev 5318)
@@ -5,9 +5,6 @@
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.interceptors.PessimisticLockInterceptor;
-import org.jboss.cache.interceptors.UnlockInterceptor;
-import org.jboss.cache.misc.TestingUtil;
 import org.jboss.cache.transaction.DummyTransactionManagerLookup;
 import static org.testng.AssertJUnit.assertFalse;
 import static org.testng.AssertJUnit.assertTrue;
@@ -16,7 +13,6 @@
 import org.testng.annotations.Test;
 
 import javax.transaction.TransactionManager;
-import java.util.Map;
 
 /**
  * basic locking test
@@ -24,7 +20,7 @@
  * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
  * @since 2.0.0
  */
- at Test(groups = {"functional"})
+ at Test(groups = "functional")
 public class PessimisticLockTest
 {
    private Cache<Object, Object> cache;
@@ -49,18 +45,6 @@
    private void assertNoStaleLocks()
    {
       CacheSPI spi = (CacheSPI) cache;
-      PessimisticLockInterceptor pli = TestingUtil.findInterceptor(spi, PessimisticLockInterceptor.class);
-      UnlockInterceptor ui = TestingUtil.findInterceptor(spi, UnlockInterceptor.class);
-
-      Map lockTablePLI = (Map) TestingUtil.extractField(pli, "lockTable");
-      Map lockTableUI = (Map) TestingUtil.extractField(ui, "lockTable");
-
-      // they should be the SAME!!
-      assert lockTablePLI == lockTableUI : "PessimisticLockInterceptor and UnlockInterceptor should be referring to the same LockTable!!";
-
-      assert lockTablePLI.size() == 0 : "Lock table on pessimistic lock interceptor should be empty";
-      assert lockTableUI.size() == 0 : "Lock table on unlock interceptor should be empty";
-
       assert spi.getNumberOfLocksHeld() == 0 : "Should have no stale locks!";
    }
 

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java	2008-02-06 16:23:32 UTC (rev 5317)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java	2008-02-07 01:24:19 UTC (rev 5318)
@@ -9,6 +9,8 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.RegionManager;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.ComponentRegistry;
+import org.jboss.cache.marshall.io.ObjectStreamPool;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
@@ -37,6 +39,10 @@
       c.setReplVersionString(currentVersion);
       //c.setUseReferenceCounting(true);
       marshaller = createVAM(c, regionManager);
+      ObjectStreamPool pool = new ObjectStreamPool();
+      ComponentRegistry reg = new ComponentRegistry(c);
+      marshaller.injectComponents(reg, pool);
+      pool.start();
    }
 
    @AfterMethod(alwaysRun = true)

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java	2008-02-06 16:23:32 UTC (rev 5317)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java	2008-02-07 01:24:19 UTC (rev 5318)
@@ -46,10 +46,12 @@
    @BeforeMethod
    public void setUp()
    {
-      cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC, false));
-      cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC, false));
+      cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC, false), false);
+      cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC, false), false);
       cache1.getConfiguration().setUseLazyDeserialization(true);
       cache2.getConfiguration().setUseLazyDeserialization(true);
+      cache1.start();
+      cache2.start();
 
       assert TestingUtil.findInterceptor(cache1, MarshalledValueInterceptor.class) != null : "Marshalled value interceptor not in chain!";
       assert TestingUtil.findInterceptor(cache2, MarshalledValueInterceptor.class) != null : "Marshalled value interceptor not in chain!";

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java	2008-02-06 16:23:32 UTC (rev 5317)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java	2008-02-07 01:24:19 UTC (rev 5318)
@@ -631,7 +631,6 @@
       cache.put("/a/b/c/3/a/b/c", null);
 
       assertEquals(0, cache.getNumberOfLocksHeld());
-      assertEquals(0, getLockTable(cache).size());
 
       tx.begin();
       cache.removeNode("/a/b/c");
@@ -652,7 +651,6 @@
       cache.put("/a/b/c/3/a/b/c", null);
 
       assertEquals(0, cache.getNumberOfLocksHeld());
-      assertEquals(0, getLockTable(cache).size());
 
       tx.begin();
       cache.removeNode("/a/b/c");




More information about the jbosscache-commits mailing list