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

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


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

  Modified:    tests/functional/org/jboss/cache/transaction   
                        TransactionTest.java
                        ConcurrentTransactionalTest.java
                        ConcurrentBankTest.java
  Log:
  Genericised, autoboxed
  
  Revision  Changes    Path
  1.21      +18 -18    JBossCache/tests/functional/org/jboss/cache/transaction/TransactionTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TransactionTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/TransactionTest.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -b -r1.20 -r1.21
  --- TransactionTest.java	30 Dec 2006 17:49:53 -0000	1.20
  +++ TransactionTest.java	30 Dec 2006 19:48:45 -0000	1.21
  @@ -37,7 +37,7 @@
    * Tests transactional access to a local CacheImpl.
    * Note: we use DummpyTranasctionManager to replace jta
    *
  - * @version $Id: TransactionTest.java,v 1.20 2006/12/30 17:49:53 msurtani Exp $
  + * @version $Id: TransactionTest.java,v 1.21 2006/12/30 19:48:45 msurtani Exp $
    */
   public class TransactionTest extends TestCase
   {
  @@ -113,14 +113,14 @@
         tx.begin();
         cache.put("/a/b/c", "age", 38);
         // the tx interceptor should know that we're in the same tx.
  -      assertEquals(cache.get("/a/b/c", "age"), new Integer(38));
  +      assertEquals(cache.get("/a/b/c", "age"), 38);
   
         cache.put("/a/b/c", "age", 39);
         tx.commit();
   
         // This test is done outside the TX, it wouldn't work if someone else
         // modified "age". This works because we're the only TX running.
  -      assertEquals(cache.get("/a/b/c", "age"), new Integer(39));
  +      assertEquals(cache.get("/a/b/c", "age"), 39);
      }
   
   
  @@ -129,8 +129,8 @@
         try
         {
            tx.begin();
  -         cache.put("/a/b/c", "age", new Integer(38));
  -         cache.put("/a/b/c", "age", new Integer(39));
  +         cache.put("/a/b/c", "age", 38);
  +         cache.put("/a/b/c", "age", 39);
            tx.rollback();
   
            // This test is done outside the TX, it wouldn't work if someone else
  @@ -187,7 +187,7 @@
         try
         {
            tx.begin();
  -         cache.put("/a/b/c", "age", new Integer(38));
  +         cache.put("/a/b/c", "age", 38);
            cache.remove("/a/b/c", "age");
            tx.rollback();
   
  @@ -207,7 +207,7 @@
         try
         {
            System.out.println("locks " + cache.printLockInfo());
  -         cache.put("/a/b/c", "age", new Integer(38));
  +         cache.put("/a/b/c", "age", 38);
            System.out.println("locks " + cache.printLockInfo());
            tx.begin();
            cache.remove("/a/b/c", "age");
  @@ -215,7 +215,7 @@
   
            // This test is done outside the TX, it wouldn't work if someone else
            // modified "age". This works because we're the only TX running.
  -         assertEquals(new Integer(38), cache.get("/a/b/c", "age"));
  +         assertEquals(38, cache.get("/a/b/c", "age"));
         }
         catch (Throwable t)
         {
  @@ -229,9 +229,9 @@
         try
         {
            java.util.Map map1 = new java.util.HashMap();
  -         map1.put("age", new Integer(38));
  +         map1.put("age", 38);
            java.util.Map map2 = new java.util.HashMap();
  -         map2.put("age", new Integer(39));
  +         map2.put("age", 39);
            tx.begin();
            cache.put("/a/b/c", map1);
            cache.put("/a/b/c", map2);
  @@ -254,7 +254,7 @@
         try
         {
            Map map = new HashMap();
  -         map.put("age", new Integer(38));
  +         map.put("age", 38);
            tx.begin();
            cache.put("/a/b/c", map);
            cache.remove("/a/b/c");
  @@ -726,7 +726,7 @@
         {
            Map m = new HashMap();
            m.put("name", "Bela");
  -         m.put("id", new Integer(322649));
  +         m.put("id", 322649);
            cache.put("/bela/ban", m);
            tx.begin();
            cache.remove("/bela/ban", "name");
  @@ -766,8 +766,8 @@
         try
         {
            tx.begin();
  -         cache.put("/foo/1", "item", new Integer(1));
  -         assertEquals(cache.get("/foo/1", "item"), new Integer(1));
  +         cache.put("/foo/1", "item", 1);
  +         assertEquals(cache.get("/foo/1", "item"), 1);
            cache.remove("/foo/1");
            assertNull(cache.get("/foo/1", "item"));
            cache.remove("/foo/1");
  @@ -794,7 +794,7 @@
            tx.begin();
            Map m = new HashMap();
            m.put("name", "Bela");
  -         m.put("id", new Integer(322649));
  +         m.put("id", 322649);
            cache.put("/bela/ban", m);
            tx.rollback();
   
  @@ -817,7 +817,7 @@
         Map m1, m2;
         m1 = new HashMap();
         m1.put("name", "Bela");
  -      m1.put("id", new Integer(322649));
  +      m1.put("id", 322649);
         m2 = new HashMap();
         m2.put("other", "bla");
         m2.put("name", "Michelle");
  @@ -831,14 +831,14 @@
            Map tmp = cache.get("/bela/ban").getData();
            assertEquals(3, tmp.size());
            assertEquals("Michelle", tmp.get("name"));
  -         assertEquals(tmp.get("id"), new Integer(322649));
  +         assertEquals(tmp.get("id"), 322649);
            assertEquals("bla", tmp.get("other"));
            tx.rollback();
   
            tmp = cache.get("/bela/ban").getData();
            assertEquals(2, tmp.size());
            assertEquals("Bela", tmp.get("name"));
  -         assertEquals(tmp.get("id"), new Integer(322649));
  +         assertEquals(tmp.get("id"), 322649);
         }
         catch (Throwable t)
         {
  
  
  
  1.7       +2 -2      JBossCache/tests/functional/org/jboss/cache/transaction/ConcurrentTransactionalTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConcurrentTransactionalTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/ConcurrentTransactionalTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- ConcurrentTransactionalTest.java	30 Dec 2006 17:49:53 -0000	1.6
  +++ ConcurrentTransactionalTest.java	30 Dec 2006 19:48:45 -0000	1.7
  @@ -32,7 +32,7 @@
    * Unit test for local CacheImpl. Use locking and multiple threads to test
    * concurrent access to the tree.
    *
  - * @version $Id: ConcurrentTransactionalTest.java,v 1.6 2006/12/30 17:49:53 msurtani Exp $
  + * @version $Id: ConcurrentTransactionalTest.java,v 1.7 2006/12/30 19:48:45 msurtani Exp $
    */
   public class ConcurrentTransactionalTest extends TestCase
   {
  @@ -219,7 +219,7 @@
               {
                  log("adding data i=" + i);
                  tx.begin();
  -               cache.put("/a/b/c", new Integer(i), val);
  +               cache.put("/a/b/c", i, val);
                  tx.commit();
                  yield();
               }
  
  
  
  1.8       +9 -9      JBossCache/tests/functional/org/jboss/cache/transaction/ConcurrentBankTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConcurrentBankTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/ConcurrentBankTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- ConcurrentBankTest.java	30 Dec 2006 17:49:53 -0000	1.7
  +++ ConcurrentBankTest.java	30 Dec 2006 19:48:45 -0000	1.8
  @@ -26,7 +26,7 @@
    *
    * @author <a href="mailto:spohl at users.sourceforge.net">Stefan Pohl</a>
    * @author Ben Wang
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class ConcurrentBankTest extends TestCase
   {
  @@ -95,9 +95,9 @@
         {
            if (cache.get(NODE) == null)
            {
  -            cache.put(NODE, "cu1", new Integer(1000));
  -            cache.put(NODE, "cu2", new Integer(1000));
  -            cache.put(NODE, "cu3", new Integer(1000));
  +            cache.put(NODE, "cu1", 1000);
  +            cache.put(NODE, "cu2", 1000);
  +            cache.put(NODE, "cu3", 1000);
            }
   
            one = new Teller("one", cache);
  @@ -231,8 +231,8 @@
            log("deposit(" + from + ", " + to + ", " + amount + ") called.");
            int act;
            // debit
  -         act = ((Integer) cache.get(NODE, from)).intValue();
  -         cache.put(NODE, from, new Integer(act - amount));
  +         act = (Integer) cache.get(NODE, from);
  +         cache.put(NODE, from, act - amount);
            log("deposit(" + from + ", " + to + ", " + amount + ") debited.");
   
            // eventually rollback the transaction
  @@ -244,8 +244,8 @@
            }
   
            // credit
  -         act = ((Integer) cache.get(NODE, to)).intValue();
  -         cache.put(NODE, to, new Integer(act + amount));
  +         act = (Integer) cache.get(NODE, to);
  +         cache.put(NODE, to, act + amount);
   
            log("deposit(" + from + ", " + to + ", " + amount + ") finished.");
         }
  @@ -280,7 +280,7 @@
            int result = 0;
            while (iter.hasNext())
            {
  -            result += ((Integer) iter.next()).intValue();
  +            result += (Integer) iter.next();
            }
            return result;
         }
  
  
  



More information about the jboss-cvs-commits mailing list