[jboss-cvs] JBossCache/tests/compat/org/jboss/cache/compat ...

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


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

  Modified:    tests/compat/org/jboss/cache/compat 
                        SerialVersionUIDUnitTestCase.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.4       +33 -34    JBossCache/tests/compat/org/jboss/cache/compat/SerialVersionUIDUnitTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SerialVersionUIDUnitTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/compat/org/jboss/cache/compat/SerialVersionUIDUnitTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- SerialVersionUIDUnitTestCase.java	3 Jan 2007 14:43:12 -0000	1.3
  +++ SerialVersionUIDUnitTestCase.java	23 May 2007 10:28:57 -0000	1.4
  @@ -6,23 +6,21 @@
    */
   package org.jboss.cache.compat;
   
  +import junit.framework.Test;
  +import junit.framework.TestCase;
  +import junit.framework.TestSuite;
  +import org.jboss.tools.ClassVersionInfo;
  +import org.jboss.tools.SerialVersionUID;
  +
   import java.beans.XMLDecoder;
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.FileWriter;
   import java.io.IOException;
  -import java.io.ObjectInputStream;
   import java.util.Iterator;
   import java.util.Map;
   import java.util.TreeMap;
   
  -import junit.framework.Test;
  -import junit.framework.TestCase;
  -import junit.framework.TestSuite;
  -
  -import org.jboss.tools.ClassVersionInfo;
  -import org.jboss.tools.SerialVersionUID;
  -
   /** 
    * Tests of serial version uid compatibility across jboss versions. The
    * testsuite/etc/serialVersionUID/xxx.ser is created using the
  @@ -107,46 +105,47 @@
               // No more data
               doQuit = true;
            }
  -      } while (doQuit == false);
  +      }
  +      while (doQuit == false);
   
         return db;
      }
   
      /**
  -    Compare two sets of classes for serialVersionUID compatibility.
  -
  -    @param classInfoMap - the legacy version classes
  -    @param currentClassInfoMap - the current build classes
  -    @param versionName - the legacy version name
  -    @param badPackages - a list of package prefixes to ignore for errors
  -    @return the number of serial version mismatches
  +    * Compare two sets of classes for serialVersionUID compatibility.
  +    *
  +    * @param classInfoMap        - the legacy version classes
  +    * @param currentClassInfoMap - the current build classes
  +    * @param versionName         - the legacy version name
  +    * @param badPackages         - a list of package prefixes to ignore for errors
  +    * @return the number of serial version mismatches
       */
      private int compare(Map classInfoMap, Map currentClassInfoMap,
         String versionName, String[] badPackages, StringBuffer bufferMessages)
         throws IOException
      {
  -      File out = new File(versionName+".errors");
  -      System.out.println("Writing errors to: "+out.getAbsolutePath());
  +      File out = new File(versionName + ".errors");
  +      System.out.println("Writing errors to: " + out.getAbsolutePath());
         FileWriter errors = new FileWriter(out);
         int mismatchCount = 0;
         Iterator iter = currentClassInfoMap.values().iterator();
  -      while( iter.hasNext() )
  +      while (iter.hasNext())
         {
            ClassVersionInfo cvi = (ClassVersionInfo) iter.next();
            String name = cvi.getName();
            ClassVersionInfo cviLegacy = (ClassVersionInfo) classInfoMap.get(name);
  -         if( cviLegacy != null && cvi.getSerialVersion() != cviLegacy.getSerialVersion() )
  +         if (cviLegacy != null && cvi.getSerialVersion() != cviLegacy.getSerialVersion())
            {
  -            String msg = "serialVersionUID error for "+name
  -               +", " + versionName + ": " + cviLegacy.getSerialVersion()
  -               +", current: "+cvi.getSerialVersion();
  +            String msg = "serialVersionUID error for " + name
  +                         + ", " + versionName + ": " + cviLegacy.getSerialVersion()
  +                         + ", current: " + cvi.getSerialVersion();
   
               // Don't count classes from badPackages
               boolean isInBadPkg = false;
  -            for(int n = 0; n < badPackages.length; n ++)
  +            for (int n = 0; n < badPackages.length; n++)
               {
                  String pkg = badPackages[n];
  -               if( name.startsWith(pkg) )
  +               if (name.startsWith(pkg))
                  {
                     isInBadPkg = true;
                     break;
  @@ -156,12 +155,12 @@
               if (isInBadPkg)
                  continue;
   
  -            if (mismatchCount>0)
  +            if (mismatchCount > 0)
               {
                  bufferMessages.append(",\n");
               }
               bufferMessages.append(name);
  -            mismatchCount ++;
  +            mismatchCount++;
               System.err.println(msg);
               errors.write(msg);
               errors.write('\n');
  @@ -169,7 +168,7 @@
         }
         errors.close();
         // If the mismatchCount is 0 remove the error file
  -      if( mismatchCount == 0 )
  +      if (mismatchCount == 0)
            out.delete();
   
         return mismatchCount;
  
  
  



More information about the jboss-cvs-commits mailing list