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

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


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

  Modified:    tests/functional/org/jboss/cache/pojo          
                        ReplicatedByteTest.java ArrayTest.java
                        ReplicatedCircularGraphTest.java TxUndoTest.java
                        LocalTxTest.java NewReplicatedTest.java
                        RecursiveRefTest.java CachedTypeTest.java
                        EnumTest.java TestingUtil.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       +2 -2      JBossCache/tests/functional/org/jboss/cache/pojo/ReplicatedByteTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedByteTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/ReplicatedByteTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- ReplicatedByteTest.java	16 Apr 2007 17:37:10 -0000	1.2
  +++ ReplicatedByteTest.java	23 May 2007 10:28:49 -0000	1.3
  @@ -22,8 +22,8 @@
   
   package org.jboss.cache.pojo;
   
  -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;
  @@ -79,7 +79,7 @@
   
         cache.attach("resource", res);
   
  -      Resource res1 = (Resource)cache1.find("resource");
  +      Resource res1 = (Resource) cache1.find("resource");
         assertEquals("Name ", res.getName(), res1.getName());
   
         assertEquals("byte ", res.getByte()[0], res1.getByte()[0]);
  
  
  
  1.2       +2 -2      JBossCache/tests/functional/org/jboss/cache/pojo/ArrayTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ArrayTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/ArrayTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- ArrayTest.java	13 Jan 2007 15:55:01 -0000	1.1
  +++ ArrayTest.java	23 May 2007 10:28:49 -0000	1.2
  @@ -7,13 +7,13 @@
   
   package org.jboss.cache.pojo;
   
  -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.pojo.test.Person;
   import org.jboss.cache.pojo.test.ArrayObject;
  +import org.jboss.cache.pojo.test.Person;
   
   /**
    * Basic PojoCache test case.
  
  
  
  1.3       +4 -4      JBossCache/tests/functional/org/jboss/cache/pojo/ReplicatedCircularGraphTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ReplicatedCircularGraphTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/ReplicatedCircularGraphTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- ReplicatedCircularGraphTest.java	16 Apr 2007 17:37:10 -0000	1.2
  +++ ReplicatedCircularGraphTest.java	23 May 2007 10:28:49 -0000	1.3
  @@ -7,20 +7,20 @@
   
   package org.jboss.cache.pojo;
   
  -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.test.Person;
   import org.jboss.cache.pojo.test.Link;
   import org.jboss.cache.pojo.test.NodeManager;
  -import org.jboss.cache.Fqn;
  +import org.jboss.cache.pojo.test.Person;
   
  -import java.util.List;
   import java.util.ArrayList;
  +import java.util.List;
   
   /**
    * Test object graph handling in aop, e.g., circular reference, multiple reference, link, etc.
  
  
  
  1.2       +11 -9     JBossCache/tests/functional/org/jboss/cache/pojo/TxUndoTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TxUndoTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/TxUndoTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- TxUndoTest.java	13 Jan 2007 15:55:01 -0000	1.1
  +++ TxUndoTest.java	23 May 2007 10:28:49 -0000	1.2
  @@ -7,16 +7,16 @@
   
   package org.jboss.cache.pojo;
   
  -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.pojo.test.Person;
  -import org.jboss.cache.pojo.interceptors.dynamic.CacheFieldInterceptor;
  -import org.jboss.cache.transaction.DummyTransactionManager;
   import org.jboss.aop.Advised;
   import org.jboss.aop.advice.Interceptor;
  +import org.jboss.cache.pojo.interceptors.dynamic.CacheFieldInterceptor;
  +import org.jboss.cache.pojo.test.Person;
  +import org.jboss.cache.transaction.DummyTransactionManager;
   
   import javax.transaction.TransactionManager;
   
  @@ -73,16 +73,18 @@
      private boolean hasCacheInterceptor(Object pojo)
      {
         Interceptor[] interceptors = null;
  -      try {
  -         interceptors = ((Advised)pojo)._getInstanceAdvisor().getInterceptors();
  -      } catch (Exception ex)
  +      try
  +      {
  +         interceptors = ((Advised) pojo)._getInstanceAdvisor().getInterceptors();
  +      }
  +      catch (Exception ex)
         {
            return false;
         }
   
  -      for(int i=0; i < interceptors.length; i++)
  +      for (int i = 0; i < interceptors.length; i++)
         {
  -         if(interceptors[i] instanceof CacheFieldInterceptor)
  +         if (interceptors[i] instanceof CacheFieldInterceptor)
               return true;
         }
         return false;
  
  
  
  1.2       +33 -27    JBossCache/tests/functional/org/jboss/cache/pojo/LocalTxTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LocalTxTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/LocalTxTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- LocalTxTest.java	13 Jan 2007 15:55:01 -0000	1.1
  +++ LocalTxTest.java	23 May 2007 10:28:49 -0000	1.2
  @@ -7,26 +7,26 @@
   
   package org.jboss.cache.pojo;
   
  -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.transaction.DummyTransactionManager;
  -import org.jboss.cache.pojo.test.Person;
   import org.jboss.cache.pojo.test.Address;
  +import org.jboss.cache.pojo.test.Person;
  +import org.jboss.cache.transaction.DummyTransactionManager;
   
   import javax.naming.Context;
  -import javax.naming.NamingException;
   import javax.naming.InitialContext;
  -import javax.transaction.UserTransaction;
  -import javax.transaction.SystemException;
  +import javax.naming.NamingException;
   import javax.transaction.NotSupportedException;
  -import javax.transaction.Transaction;
   import javax.transaction.RollbackException;
  -import java.util.Properties;
  -import java.util.List;
  +import javax.transaction.SystemException;
  +import javax.transaction.Transaction;
  +import javax.transaction.UserTransaction;
   import java.util.ArrayList;
  +import java.util.List;
  +import java.util.Properties;
   
   /**
    */
  @@ -188,12 +188,13 @@
               catch (Exception ex)
               {
   //               t2_ex = ex;
  -               if(tx != null)
  +               if (tx != null)
                  {
                     try
                     {
                        tx.rollback();
  -                  } catch (SystemException e)
  +                  }
  +                  catch (SystemException e)
                     {
                        e.printStackTrace();
                        t2_ex = e;
  @@ -276,12 +277,13 @@
               }
               catch (Exception ex)
               {
  -               if(tx != null)
  +               if (tx != null)
                  {
                     try
                     {
                        tx.rollback();
  -                  } catch (SystemException e)
  +                  }
  +                  catch (SystemException e)
                     {
                        e.printStackTrace();
                        t2_ex = e;
  @@ -325,7 +327,7 @@
            {
               try
               {
  -               for(int i=0; i< 100; i++)
  +               for (int i = 0; i < 100; i++)
                  {
                     String id = "/p1/test7";
                     Person p = createPerson(id, "p6", 50);
  @@ -336,9 +338,11 @@
                     tx.begin();
                     lang.add("German");
                     lang.add("English");
  -                  try {
  +                  try
  +                  {
                       p.setLanguages(lang);
  -                  } catch (PojoCacheException ex)
  +                  }
  +                  catch (PojoCacheException ex)
                     {
                        ex.printStackTrace();
                     }
  @@ -369,7 +373,7 @@
            {
               try
               {
  -               for(int i=0; i< 100; i++)
  +               for (int i = 0; i < 100; i++)
                  {
                     String id = "/p1/test8";
                     Person p = createPerson(id, "p6", 50);
  @@ -380,9 +384,11 @@
                     tx.begin();
                     lang.add("German");
                     lang.add("English");
  -                     try {
  +                  try
  +                  {
                          p.setLanguages(lang);
  -                     } catch (PojoCacheException ex)
  +                  }
  +                  catch (PojoCacheException ex)
                        {
                           ex.printStackTrace();
                        }
  
  
  
  1.5       +8 -9      JBossCache/tests/functional/org/jboss/cache/pojo/NewReplicatedTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NewReplicatedTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/NewReplicatedTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- NewReplicatedTest.java	24 Apr 2007 13:16:09 -0000	1.4
  +++ NewReplicatedTest.java	23 May 2007 10:28:49 -0000	1.5
  @@ -8,13 +8,12 @@
   import org.jboss.cache.Fqn;
   import org.jboss.cache.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
  +import org.jboss.cache.pojo.test.Address;
   import org.jboss.cache.pojo.test.Person;
   import org.jboss.cache.pojo.test.SpecialSerializedAddress;
   import org.jboss.cache.pojo.test.Student;
  -import org.jboss.cache.pojo.test.Address;
   
   import javax.naming.Context;
  -
   import java.io.Serializable;
   import java.util.Properties;
   
  @@ -103,12 +102,12 @@
         addr.setZip(106);
         test.setAddress(addr);
         cache_.attach("/a", test);
  -      Student result = (Student)cache_.find("/a");
  +      Student result = (Student) cache_.find("/a");
         assertEquals(" ", test, result);
   
  -      Student remote = (Student)cache1_.find("/a");
  -      System.out.println("Output on cache1: "+ result);
  -      System.out.println("Output on cache2: "+ remote);
  +      Student remote = (Student) cache1_.find("/a");
  +      System.out.println("Output on cache1: " + result);
  +      System.out.println("Output on cache2: " + remote);
         assertEquals("Age should be ", 10, remote.getAge());
      }
   
  
  
  
  1.2       +5 -5      JBossCache/tests/functional/org/jboss/cache/pojo/RecursiveRefTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RecursiveRefTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/RecursiveRefTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- RecursiveRefTest.java	13 Jan 2007 15:55:01 -0000	1.1
  +++ RecursiveRefTest.java	23 May 2007 10:28:49 -0000	1.2
  @@ -6,10 +6,10 @@
   import org.jboss.cache.pojo.test.IdObject;
   import org.jboss.cache.pojo.test.ValueObject;
   
  -import java.util.HashMap;
  -import java.util.Map;
   import java.util.ArrayList;
  +import java.util.HashMap;
   import java.util.HashSet;
  +import java.util.Map;
   
   public class RecursiveRefTest extends TestCase
   {
  @@ -69,7 +69,7 @@
         ArrayList list = new ArrayList();
         list.add("1");
         cache.attach("list", list);
  -      list = (ArrayList)cache.find("list");
  +      list = (ArrayList) cache.find("list");
         list.add(list);
         System.out.println(list.toString());
      }
  @@ -79,7 +79,7 @@
         HashSet set = new HashSet();
         set.add("1");
         cache.attach("set", set);
  -      set = (HashSet)cache.find("set");
  +      set = (HashSet) cache.find("set");
         set.add(set);
         System.out.println(set.toString());
      }
  @@ -89,7 +89,7 @@
         HashMap map = new HashMap();
         map.put("1", "1");
         cache.attach("map", map);
  -      map = (HashMap)cache.find("map");
  +      map = (HashMap) cache.find("map");
         map.put("2", map);
         System.out.println(map.toString());
      }
  
  
  
  1.2       +1 -12     JBossCache/tests/functional/org/jboss/cache/pojo/CachedTypeTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CachedTypeTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/CachedTypeTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CachedTypeTest.java	13 Jan 2007 15:55:01 -0000	1.1
  +++ CachedTypeTest.java	23 May 2007 10:28:49 -0000	1.2
  @@ -22,22 +22,11 @@
   
   package org.jboss.cache.pojo;
   
  -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.pojo.test.Person;
  -import org.jboss.cache.pojo.test.Address;
  -import org.jboss.cache.pojo.test.Student;
  -import org.jboss.aop.proxy.ClassProxy;
  -
  -import java.util.List;
  -import java.util.Map;
  -import java.util.HashMap;
  -import java.util.ArrayList;
  -import java.util.Set;
  -import java.util.HashSet;
   
   /**
    * Basic CachedType test case.
  
  
  
  1.3       +2 -4      JBossCache/tests/functional/org/jboss/cache/pojo/EnumTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: EnumTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/EnumTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- EnumTest.java	16 Apr 2007 17:37:10 -0000	1.2
  +++ EnumTest.java	23 May 2007 10:28:49 -0000	1.3
  @@ -22,15 +22,13 @@
   
   package org.jboss.cache.pojo;
   
  -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.config.Configuration.CacheMode;
   import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
  -import org.jboss.cache.pojo.test.ArrayObject;
  -import org.jboss.cache.pojo.test.Person;
   import org.jboss.cache.pojo.test.EnumPlanet;
   
   /**
  @@ -74,7 +72,7 @@
   
         cache_.attach("enum", EnumPlanet.EARTH);
   
  -      EnumPlanet ep = (EnumPlanet)cache1_.find("enum");
  +      EnumPlanet ep = (EnumPlanet) cache1_.find("enum");
   
         EnumPlanet.EARTH.setMass(7.0e+24);
   
  
  
  
  1.3       +1 -2      JBossCache/tests/functional/org/jboss/cache/pojo/TestingUtil.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TestingUtil.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/TestingUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- TestingUtil.java	17 Jan 2007 01:31:08 -0000	1.2
  +++ TestingUtil.java	23 May 2007 10:28:49 -0000	1.3
  @@ -10,13 +10,12 @@
   import org.jboss.cache.CacheImpl;
   
   import java.util.List;
  -import java.util.Vector;
   
   /**
    * Utilities for unit testing JBossCache.
    *
    * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class TestingUtil
   {
  
  
  



More information about the jboss-cvs-commits mailing list