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

Manik Surtani msurtani at jboss.com
Sat Dec 30 14:48:47 EST 2006


  User: msurtani
  Date: 06/12/30 14:48:47

  Modified:    tests/functional/org/jboss/cache/passivation   
                        ConcurrentPassivationTest.java
                        PassivationTestsBase.java
                        PassivationToFileCacheLoaderTest.java
  Log:
  Genericised, autoboxed
  
  Revision  Changes    Path
  1.9       +4 -4      JBossCache/tests/functional/org/jboss/cache/passivation/ConcurrentPassivationTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConcurrentPassivationTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/ConcurrentPassivationTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- ConcurrentPassivationTest.java	30 Dec 2006 17:49:59 -0000	1.8
  +++ ConcurrentPassivationTest.java	30 Dec 2006 19:48:47 -0000	1.9
  @@ -21,7 +21,7 @@
    * Tests cache behavior in the presence of concurrent passivation.
    *
    * @author Brian Stansberry
  - * @version $Revision: 1.8 $
  + * @version $Revision: 1.9 $
    */
   public class ConcurrentPassivationTest extends TestCase
   {
  @@ -80,7 +80,7 @@
         // region's maxNodes so we know eviction will kick in
         for (int i = 0; i < 35000; i++)
         {
  -         cache_.put(new Fqn(base, new Integer(i / 100)), new Integer(i), "value");
  +         cache_.put(new Fqn(base, i / 100), new Integer(i), "value");
         }
   
         // Loop for long enough to have 5 runs of the eviction thread
  @@ -90,8 +90,8 @@
            // If any get returns null, that's a failure
            for (int i = 0; i < 35000; i++)
            {
  -            Fqn fqn = new Fqn(base, new Integer(i / 100));
  -            Integer key = new Integer(i);
  +            Fqn fqn = new Fqn(base, i / 100);
  +            Integer key = i;
               assertNotNull("found value under Fqn " + fqn + " and key " + key,
                       cache_.get(fqn, key));
            }
  
  
  
  1.23      +25 -25    JBossCache/tests/functional/org/jboss/cache/passivation/PassivationTestsBase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PassivationTestsBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/PassivationTestsBase.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -b -r1.22 -r1.23
  --- PassivationTestsBase.java	30 Dec 2006 17:49:59 -0000	1.22
  +++ PassivationTestsBase.java	30 Dec 2006 19:48:47 -0000	1.23
  @@ -38,7 +38,7 @@
    * Base tests for passivation using any of the cache loaders
    *
    * @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
  - * @version $Id: PassivationTestsBase.java,v 1.22 2006/12/30 17:49:59 msurtani Exp $
  + * @version $Id: PassivationTestsBase.java,v 1.23 2006/12/30 19:48:47 msurtani Exp $
    */
   abstract public class PassivationTestsBase extends TestCase
   {
  @@ -138,17 +138,17 @@
         Object retval = null;
         cache.remove(NODE); // nothing to remove
         addDelay();
  -      retval = cache.put(NODE, KEY, new Integer(10)); // put in memory
  +      retval = cache.put(NODE, KEY, 10); // put in memory
         assertNull(retval);
  -      retval = cache.put(NODE, KEY, new Integer(20)); // put in memory
  +      retval = cache.put(NODE, KEY, 20); // put in memory
         addDelay();
  -      assertEquals(new Integer(10), retval); // get from memory
  +      assertEquals(10, retval); // get from memory
         cache.evict(Fqn.fromString(NODE)); // passivate node
         addDelay();
         log.debug("______________");
  -      retval = cache.put(NODE, KEY, new Integer(30)); // activate node then does put in memory
  +      retval = cache.put(NODE, KEY, 30); // activate node then does put in memory
         assertFalse(loader.exists(Fqn.fromString(NODE)));
  -      assertEquals(new Integer(20), retval);
  +      assertEquals(20, retval);
      }
   
      public void testPut2Passivation() throws CacheException
  @@ -158,11 +158,11 @@
         Object retval = null;
         cache.remove(NODE); // nothing to remove
         addDelay();
  -      retval = cache.put(NODE, KEY, new Integer(10)); // put in memory
  +      retval = cache.put(NODE, KEY, 10); // put in memory
         assertNull(retval);
         addDelay();
  -      retval = cache.put(NODE, KEY, new Integer(20)); // put in memory
  -      assertEquals(new Integer(10), retval);
  +      retval = cache.put(NODE, KEY, 20); // put in memory
  +      assertEquals(10, retval);
         cache.evict(Fqn.fromString(NODE)); // passivate node
         cache.evict(Fqn.fromString("/a/b")); // passivate parent node
         cache.evict(Fqn.fromString("/a")); // passivate parent node
  @@ -175,7 +175,7 @@
         {
            fail(e.toString());
         }
  -      retval = cache.put(NODE, KEY, new Integer(30)); // activate node, put in memory new value
  +      retval = cache.put(NODE, KEY, 30); // activate node, put in memory new value
         try
         {
            assertFalse(loader.exists(Fqn.fromString(NODE)));
  @@ -184,7 +184,7 @@
         {
            fail(e.toString());
         }
  -      assertEquals(new Integer(20), retval);
  +      assertEquals(20, retval);
      }
   
   
  @@ -194,9 +194,9 @@
         pojo.getHobbies().add("Running");
         pojo.getHobbies().add("Beerathlon");
         pojo.getHobbies().add("Triathlon");
  -      cache.put("/mypojo", new Integer(322649), pojo); // put in memory
  +      cache.put("/mypojo", 322649, pojo); // put in memory
         addDelay();
  -      assertNotNull(cache.get("/mypojo", new Integer(322649))); // get from memory
  +      assertNotNull(cache.get("/mypojo", 322649)); // get from memory
         cache.evict(Fqn.fromString("/mypojo")); // passivate node
         try
         {
  @@ -206,7 +206,7 @@
         {
            fail(e.toString());
         }
  -      SamplePojo pojo2 = (SamplePojo) cache.get("/mypojo", new Integer(322649)); // activate node
  +      SamplePojo pojo2 = (SamplePojo) cache.get("/mypojo", 322649); // activate node
         try
         {
            assertFalse(loader.exists(Fqn.fromString("/mypojo")));
  @@ -676,11 +676,11 @@
         final String KEY = "key";
         Object retval = null;
         cache.remove(NODE);
  -      retval = cache.put(NODE, KEY, new Integer(10));
  +      retval = cache.put(NODE, KEY, 10);
         assertNull(retval);
         addDelay();
         retval = cache.remove(NODE, KEY);
  -      assertEquals(new Integer(10), retval);
  +      assertEquals(10, retval);
         addDelay();
         retval = cache.remove(NODE, KEY);
         assertNull(retval);
  @@ -692,15 +692,15 @@
         final String KEY = "key";
         Object retval = null;
         cache.remove(NODE);
  -      retval = cache.put(NODE, KEY, new Integer(10));
  +      retval = cache.put(NODE, KEY, 10);
         assertNull(retval);
   
         cache.evict(Fqn.fromString(NODE)); // passivate node
         addDelay();
         assertTrue(loader.exists(Fqn.fromString(NODE)));
  -      assertEquals(new Integer(10), loader.get(Fqn.fromString(NODE)).get(KEY));
  +      assertEquals(10, loader.get(Fqn.fromString(NODE)).get(KEY));
         retval = cache.remove(NODE, KEY); // activate node
  -      assertEquals(new Integer(10), retval);
  +      assertEquals(10, retval);
         assertFalse(loader.exists(Fqn.fromString(NODE)));
   
         cache.evict(Fqn.fromString(NODE)); // passiave node
  @@ -1557,11 +1557,11 @@
         Complex c2 = new Complex(c1);
   
         /* Add objects. */
  -      loader.put(FQN, new Integer(1), c1);
  -      loader.put(FQN, new Integer(2), c2);
  +      loader.put(FQN, 1, c1);
  +      loader.put(FQN, 2, c2);
         addDelay();
  -      assertEquals(c1, loader.get(FQN).get(new Integer(1)));
  -      assertEquals(c2, loader.get(FQN).get(new Integer(2)));
  +      assertEquals(c1, loader.get(FQN).get(1));
  +      assertEquals(c2, loader.get(FQN).get(2));
         assertEquals(2, loader.get(FQN).size());
   
         /* Save state. */
  @@ -1581,8 +1581,8 @@
         is.close();
   
         addDelay();
  -      assertEquals(c1, loader.get(FQN).get(new Integer(1)));
  -      assertEquals(c2, loader.get(FQN).get(new Integer(2)));
  +      assertEquals(c1, loader.get(FQN).get(1));
  +      assertEquals(c2, loader.get(FQN).get(2));
         assertEquals(2, loader.get(FQN).size());
      }
   
  
  
  
  1.8       +38 -32    JBossCache/tests/functional/org/jboss/cache/passivation/PassivationToFileCacheLoaderTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PassivationToFileCacheLoaderTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/passivation/PassivationToFileCacheLoaderTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- PassivationToFileCacheLoaderTest.java	25 Oct 2006 04:50:20 -0000	1.7
  +++ PassivationToFileCacheLoaderTest.java	30 Dec 2006 19:48:47 -0000	1.8
  @@ -2,7 +2,6 @@
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
  -
   import org.jboss.cache.config.CacheLoaderConfig;
   import org.jboss.cache.factories.XmlConfigurationParser;
   import org.jboss.cache.xml.XmlHelper;
  @@ -12,19 +11,24 @@
    * tests passivation using file cache loader
    * 
    * @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
  - * @version $Id: PassivationToFileCacheLoaderTest.java,v 1.7 2006/10/25 04:50:20 bstansberry Exp $
  + * @version $Id: PassivationToFileCacheLoaderTest.java,v 1.8 2006/12/30 19:48:47 msurtani Exp $
    */
  -public class PassivationToFileCacheLoaderTest extends PassivationTestsBase {
  +public class PassivationToFileCacheLoaderTest extends PassivationTestsBase
  +{
   
   
  -   protected void configureCache() throws Exception {
  +   protected void configureCache() throws Exception
  +   {
   
         String tmp_location = null;
         String OS = System.getProperty("os.name").toLowerCase();
  -      if(OS.indexOf("win") > -1 || OS.indexOf("nt") > -1) {
  -         tmp_location=System.getProperty("java.io.tmpdir", "c:\\tmp");
  -      } else {
  -         tmp_location=System.getProperty("jva.io.tmpdir", "/tmp");
  +      if (OS.contains("win") || OS.contains("nt"))
  +      {
  +         tmp_location = System.getProperty("java.io.tmpdir", "c:\\tmp");
  +      }
  +      else
  +      {
  +         tmp_location = System.getProperty("jva.io.tmpdir", "/tmp");
         }
   
          cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(tmp_location));
  @@ -52,12 +56,14 @@
       }
   
   
  -   public static Test suite() {
  +   public static Test suite()
  +   {
         return new TestSuite(PassivationToFileCacheLoaderTest.class);
      }
   
   
  -   public static void main(String[] args) {
  +   public static void main(String[] args)
  +   {
         junit.textui.TestRunner.run(suite());
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list