[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/pojo/collection ...

Manik Surtani manik at jboss.org
Wed May 23 06:28:51 EDT 2007


  User: msurtani
  Date: 07/05/23 06:28:51

  Modified:    tests/functional/org/jboss/cache/pojo/collection      
                        ReplicatedSyncMapTest.java CachedMapTest.java
                        ReplicatedSyncSetTest.java
                        ReplicatedSyncListTest.java CollectionTest.java
                        CachedMapImplTest.java
  Log:
  Initiated a bunch of performance fixes, including replacing CopyOnWriteArraySets with org.jboss.cache.util.concurrent.ConcurrentHashSet.
  Also ran an imports optimiser on the code base - there were a lot of unused imports floating about.
  
  Revision  Changes    Path
  1.3       +8 -7      JBossCache/tests/functional/org/jboss/cache/pojo/collection/ReplicatedSyncMapTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedSyncMapTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/collection/ReplicatedSyncMapTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- ReplicatedSyncMapTest.java	16 Apr 2007 17:37:12 -0000	1.2
  +++ ReplicatedSyncMapTest.java	23 May 2007 10:28:51 -0000	1.3
  @@ -5,15 +5,15 @@
   import junit.framework.TestSuite;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.jboss.aop.proxy.ClassProxy;
  +import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
   import org.jboss.cache.pojo.PojoCache;
  -import org.jboss.cache.pojo.PojoCacheFactory;
   import org.jboss.cache.pojo.PojoCacheException;
  +import org.jboss.cache.pojo.PojoCacheFactory;
   import org.jboss.cache.pojo.test.Address;
   import org.jboss.cache.pojo.test.Person;
  -import org.jboss.cache.Fqn;
  -import org.jboss.aop.proxy.ClassProxy;
   
   import java.util.Collection;
   import java.util.HashMap;
  @@ -101,7 +101,7 @@
         cache1.attach("/map", map1);
         map1 = (Map) cache1.find("/map");
         map1.put("key2", addr2);
  -      map1 = (Map)cache1.detach("/map");
  +      map1 = (Map) cache1.detach("/map");
         assertEquals("Detached map should still be", 2, map1.size());
         map1.put("key3", addr3);
         cache1.attach("/map", map1);
  @@ -268,11 +268,11 @@
         map.put("2", "2");
         cache1.attach("map", map);
   
  -      map = (Map)cache1.find("map");
  +      map = (Map) cache1.find("map");
         map.put("map", map);
   
         assertEquals("size ", 3, map.size());
  -      Map m2 = (Map)map.get("map");
  +      Map m2 = (Map) map.get("map");
         assertTrue("Instance of AopProxy", m2 instanceof ClassProxy);
   //      assertEquals("ClassProxy instance", list, l2);
      }
  @@ -287,7 +287,8 @@
         try
         {
            cache1.attach("map", map);
  -      } catch (PojoCacheException pex)
  +      }
  +      catch (PojoCacheException pex)
         {
            // Expected, we can't do recursive map.
            pex.printStackTrace();
  
  
  
  1.2       +6 -6      JBossCache/tests/functional/org/jboss/cache/pojo/collection/CachedMapTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedMapTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/collection/CachedMapTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CachedMapTest.java	13 Jan 2007 15:55:00 -0000	1.1
  +++ CachedMapTest.java	23 May 2007 10:28:51 -0000	1.2
  @@ -7,8 +7,8 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.aop.proxy.ClassProxy;
   import org.jboss.cache.pojo.PojoCache;
  -import org.jboss.cache.pojo.PojoCacheFactory;
   import org.jboss.cache.pojo.PojoCacheException;
  +import org.jboss.cache.pojo.PojoCacheFactory;
   import org.jboss.cache.pojo.test.Address;
   
   import java.io.Serializable;
  
  
  
  1.3       +2 -3      JBossCache/tests/functional/org/jboss/cache/pojo/collection/ReplicatedSyncSetTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedSyncSetTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/collection/ReplicatedSyncSetTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- ReplicatedSyncSetTest.java	16 Apr 2007 17:37:12 -0000	1.2
  +++ ReplicatedSyncSetTest.java	23 May 2007 10:28:51 -0000	1.3
  @@ -5,13 +5,13 @@
   import junit.framework.TestSuite;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
   import org.jboss.cache.pojo.PojoCache;
   import org.jboss.cache.pojo.PojoCacheFactory;
   import org.jboss.cache.pojo.test.Address;
   import org.jboss.cache.pojo.test.Person;
  -import org.jboss.cache.Fqn;
   
   import java.util.HashSet;
   import java.util.Iterator;
  @@ -95,7 +95,7 @@
         cache1.attach("/set", set1);
         set1 = (Set) cache1.find("/set");
         set1.add(addr2);
  -      set1 = (Set)cache1.detach("/set");
  +      set1 = (Set) cache1.detach("/set");
         assertEquals("Detached set should still be", 2, set1.size());
         set1.add(addr3);
         cache1.attach("/set", set1);
  @@ -200,7 +200,6 @@
         assertFalse("element 2 is removed", set2.contains("element 2"));
      }
   
  -
      /* This test won't pass since the recursive set will fail during replication as well
      because of HashSet that calls out to HashMap hashCode. This causes the recursion.
      public void testRecursion2() throws Exception
  
  
  
  1.3       +8 -8      JBossCache/tests/functional/org/jboss/cache/pojo/collection/ReplicatedSyncListTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedSyncListTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/collection/ReplicatedSyncListTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- ReplicatedSyncListTest.java	16 Apr 2007 17:37:12 -0000	1.2
  +++ ReplicatedSyncListTest.java	23 May 2007 10:28:51 -0000	1.3
  @@ -5,14 +5,14 @@
   import junit.framework.TestSuite;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.jboss.aop.proxy.ClassProxy;
  +import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
   import org.jboss.cache.pojo.PojoCache;
   import org.jboss.cache.pojo.PojoCacheFactory;
   import org.jboss.cache.pojo.test.Address;
   import org.jboss.cache.pojo.test.Person;
  -import org.jboss.cache.Fqn;
  -import org.jboss.aop.proxy.ClassProxy;
   
   import java.util.ArrayList;
   import java.util.List;
  @@ -97,7 +97,7 @@
         list1 = (List) cache1.find("/list");
         list1.add(addr2);
         // The return value is the original reference.
  -      list1 = (List)cache1.detach("/list");
  +      list1 = (List) cache1.detach("/list");
         assertEquals("Detached list should still be", 2, list1.size());
         list1.add(addr3);
         cache1.attach("/list", list1);
  @@ -251,11 +251,11 @@
         list.add("2");
         cache1.attach("list", list);
         
  -      list = (List)cache1.find("list");
  +      list = (List) cache1.find("list");
         list.add(list);
   
         assertEquals("size ", 3, list.size());
  -      List l2 = (List)list.get(2);
  +      List l2 = (List) list.get(2);
         assertTrue("Instance of AopProxy", l2 instanceof ClassProxy);
   //      assertEquals("ClassProxy instance", list, l2);
      }
  @@ -269,7 +269,7 @@
   
         cache1.attach("list", list);
   
  -      list = (List)cache1.find("list");
  +      list = (List) cache1.find("list");
         list.toString();
      }
   
  
  
  
  1.2       +11 -11    JBossCache/tests/functional/org/jboss/cache/pojo/collection/CollectionTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CollectionTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/collection/CollectionTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CollectionTest.java	13 Jan 2007 15:55:00 -0000	1.1
  +++ CollectionTest.java	23 May 2007 10:28:51 -0000	1.2
  @@ -8,9 +8,6 @@
   import org.jboss.cache.pojo.PojoCache;
   import org.jboss.cache.pojo.PojoCacheFactory;
   
  -import java.util.Collection;
  -import java.util.HashMap;
  -import java.util.HashSet;
   import java.util.Iterator;
   import java.util.LinkedHashMap;
   import java.util.LinkedHashSet;
  @@ -66,7 +63,8 @@
            list.add("French");
            list1 = (LinkedList) cache_.find("/aop/list");
            assertEquals("Size of list ", 2, list1.size());
  -      } catch (Exception e)
  +      }
  +      catch (Exception e)
         {
            fail("pubtObject fails");
            throw e;
  @@ -90,7 +88,8 @@
            map.put("2", "French");
            map1 = (LinkedHashMap) cache_.find("/aop/map");
            assertEquals("Size of map ", 2, map1.size());
  -      } catch (Exception e)
  +      }
  +      catch (Exception e)
         {
            fail("pubtObject fails");
            throw e;
  @@ -115,7 +114,8 @@
            set.add("French");
            set1 = (LinkedHashSet) cache_.find("/aop/set");
            assertEquals("Size of set ", 2, set1.size());
  -      } catch (Exception e)
  +      }
  +      catch (Exception e)
         {
            fail("pubtObject fails");
            throw e;
  @@ -255,21 +255,21 @@
            list = (LinkedList) cache_.find("/language/list");
            Object[] values = list.toArray();
   
  -         for (int looper = 0; looper < values.length; looper ++)
  +         for (int looper = 0; looper < values.length; looper++)
            {
               assertTrue("toArray test", list2.contains(values[looper]));
            }
   
            values = new Object[1];
            values = list.toArray(values);  // test with too small of an array
  -         for (int looper = 0; looper < values.length; looper ++)
  +         for (int looper = 0; looper < values.length; looper++)
            {
               assertTrue("toArray test", list2.contains(values[looper]));
            }
   
            values = new Object[10];
            values = list.toArray(values);  // test with too large of an array, result should be null padded
  -         for (int looper = 0; looper < values.length; looper ++)
  +         for (int looper = 0; looper < values.length; looper++)
            {
               assertTrue("toArray test", (values[looper] == null || list2.contains(values[looper])));
            }
  @@ -337,7 +337,7 @@
            assertTrue(list.addAll(list2));
            Object[] values = list.toArray();
   
  -         for (int looper = 0; looper < values.length; looper ++)
  +         for (int looper = 0; looper < values.length; looper++)
            {
               assertTrue("testAddAll", list2.contains(values[looper]));
            }
  
  
  
  1.4       +6 -8      JBossCache/tests/functional/org/jboss/cache/pojo/collection/CachedMapImplTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedMapImplTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/collection/CachedMapImplTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- CachedMapImplTest.java	16 Apr 2007 17:37:12 -0000	1.3
  +++ CachedMapImplTest.java	23 May 2007 10:28:51 -0000	1.4
  @@ -22,21 +22,19 @@
   
   package org.jboss.cache.pojo.collection;
   
  -import junit.framework.TestCase;
   import junit.framework.Test;
  +import junit.framework.TestCase;
   import junit.framework.TestSuite;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
   import org.jboss.cache.pojo.PojoCache;
   import org.jboss.cache.pojo.PojoCacheFactory;
  -import org.jboss.cache.Fqn;
   
  -import java.util.List;
  -import java.util.ArrayList;
  -import java.util.Map;
   import java.util.HashMap;
  +import java.util.Map;
   
   /**
    * List implementation testing.
  @@ -81,13 +79,13 @@
         cache_.attach("map", map);
   
         // Can't use proxy here. JBCACHE-975.
  -      map = (Map)cache_.detach("map");
  +      map = (Map) cache_.detach("map");
   
         // test repl
         cache_.getCache().put(Fqn.fromString("test"), "1", map);
   
  -      Map m1 = (Map)cache1_.getCache().get(Fqn.fromString("test"), "1");
  -      System.out.println(" map : " +m1);
  +      Map m1 = (Map) cache1_.getCache().get(Fqn.fromString("test"), "1");
  +      System.out.println(" map : " + m1);
      }
   
      public static Test suite() throws Exception
  
  
  



More information about the jboss-cvs-commits mailing list