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

Manik Surtani msurtani at belmont.prod.atl2.jboss.com
Wed Aug 30 13:08:19 EDT 2006


  User: msurtani
  Date: 06/08/30 13:08:19

  Modified:    tests/functional/org/jboss/cache/buddyreplication 
                        BuddyManagerTest.java
  Log:
  Java5 optimisations
  
  Revision  Changes    Path
  1.6       +158 -154  JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyManagerTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BuddyManagerTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyManagerTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- BuddyManagerTest.java	25 Aug 2006 14:10:10 -0000	1.5
  +++ BuddyManagerTest.java	30 Aug 2006 17:08:19 -0000	1.6
  @@ -8,10 +8,10 @@
   
   import junit.framework.TestCase;
   import org.jboss.cache.Fqn;
  +import org.jboss.cache.marshall.MethodCall;
   import org.jboss.cache.marshall.MethodCallFactory;
   import org.jboss.cache.marshall.MethodDeclarations;
   import org.jboss.cache.xml.XmlHelper;
  -import org.jboss.cache.marshall.MethodCall;
   import org.w3c.dom.Element;
   
   import java.util.ArrayList;
  @@ -26,6 +26,7 @@
   {
       /**
        * Constructs a buddy manager using the default buddy locator but with some specific properties.
  +    *
        * @throws Exception
        */
       public void testConstruction1() throws Exception
  @@ -39,12 +40,13 @@
           assertTrue(mgr.isEnabled());
           assertEquals("groupOne", mgr.getBuddyPoolName());
           assertEquals(NextMemberBuddyLocator.class, mgr.buddyLocator.getClass());
  -        assertEquals(3, ((NextMemberBuddyLocator)mgr.buddyLocator).numBuddies);
  -        assertTrue(((NextMemberBuddyLocator)mgr.buddyLocator).ignoreColocatedBuddies);
  +      assertEquals(3, ((NextMemberBuddyLocator) mgr.buddyLocator).numBuddies);
  +      assertTrue(((NextMemberBuddyLocator) mgr.buddyLocator).ignoreColocatedBuddies);
       }
   
       /**
        * Constructs a buddy manager using a nonexistent buddy locator but with some specific properties.
  +    *
        * @throws Exception
        */
       public void testConstruction2() throws Exception
  @@ -61,12 +63,13 @@
           assertEquals(NextMemberBuddyLocator.class, mgr.buddyLocator.getClass());
   
           // since the properties are not passed on to the next member buddy locator - they were obviously meant for a different impl.
  -        assertEquals(1, ((NextMemberBuddyLocator)mgr.buddyLocator).numBuddies);
  -        assertTrue(((NextMemberBuddyLocator)mgr.buddyLocator).ignoreColocatedBuddies);
  +      assertEquals(1, ((NextMemberBuddyLocator) mgr.buddyLocator).numBuddies);
  +      assertTrue(((NextMemberBuddyLocator) mgr.buddyLocator).ignoreColocatedBuddies);
       }
   
       /**
        * Constructs a disabled buddy manager
  +    *
        * @throws Exception
        */
       public void testConstruction3() throws Exception
  @@ -80,6 +83,7 @@
   
       /**
        * Constructs a buddy manager using a minimal config set
  +    *
        * @throws Exception
        */
       public void testConstruction4() throws Exception
  @@ -91,8 +95,8 @@
           assertTrue(mgr.isEnabled());
           assertNull(mgr.getBuddyPoolName());
           assertEquals(NextMemberBuddyLocator.class, mgr.buddyLocator.getClass());
  -        assertEquals(1, ((NextMemberBuddyLocator)mgr.buddyLocator).numBuddies);
  -        assertTrue(((NextMemberBuddyLocator)mgr.buddyLocator).ignoreColocatedBuddies);
  +      assertEquals(1, ((NextMemberBuddyLocator) mgr.buddyLocator).numBuddies);
  +      assertTrue(((NextMemberBuddyLocator) mgr.buddyLocator).ignoreColocatedBuddies);
       }
   
       private BuddyManager createBasicBuddyManager()
  @@ -113,8 +117,8 @@
       {
           Fqn fqn1 = Fqn.fromString("/hello/world");
   
  -        MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, new Object[]{fqn1, "key", "value"});
  -        MethodCall call2 = MethodCallFactory.create(MethodDeclarations.replicateMethod, new Object[]{call1});
  +      MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn1, "key", "value");
  +      MethodCall call2 = MethodCallFactory.create(MethodDeclarations.replicateMethod, call1);
   
           BuddyManager bm = createBasicBuddyManager();
   
  @@ -131,8 +135,8 @@
       {
           Fqn fqn1 = Fqn.ROOT;
   
  -        MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, new Object[]{fqn1, "key", "value"});
  -        MethodCall call2 = MethodCallFactory.create(MethodDeclarations.replicateMethod, new Object[]{call1});
  +      MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn1, "key", "value");
  +      MethodCall call2 = MethodCallFactory.create(MethodDeclarations.replicateMethod, call1);
   
           BuddyManager bm = createBasicBuddyManager();
   
  @@ -151,17 +155,17 @@
           Fqn fqn3 = Fqn.fromString("/hello/again");
           Fqn fqn4 = Fqn.fromString("/buddy/replication");
   
  -        MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, new Object[]{fqn1, "key", "value"});
  -        MethodCall call2 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, new Object[]{fqn2, "key", "value"});
  -        MethodCall call3 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, new Object[]{fqn3, "key", "value"});
  -        MethodCall call4 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, new Object[]{fqn4, "key", "value"});
  +      MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn1, "key", "value");
  +      MethodCall call2 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn2, "key", "value");
  +      MethodCall call3 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn3, "key", "value");
  +      MethodCall call4 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn4, "key", "value");
           List list = new ArrayList();
           list.add(call1);
           list.add(call2);
           list.add(call3);
           list.add(call4);
   
  -        MethodCall call5 = MethodCallFactory.create(MethodDeclarations.replicateAllMethod, new Object[]{list});
  +      MethodCall call5 = MethodCallFactory.create(MethodDeclarations.replicateAllMethod, list);
   
           BuddyManager bm = createBasicBuddyManager();
   
  @@ -171,10 +175,10 @@
           // should use object refs to transform the original MethodCall.
           String expected = "/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/null";
   
  -        int i=0;
  -        assertEquals(expected, ((MethodCall)l.get(i++)).getArgs()[0].toString());
  -        assertEquals(expected + "/hello/world", ((MethodCall)l.get(i++)).getArgs()[0].toString());
  -        assertEquals(expected + "/hello/again", ((MethodCall)l.get(i++)).getArgs()[0].toString());
  -        assertEquals(expected + "/buddy/replication", ((MethodCall)l.get(i)).getArgs()[0].toString());
  +      int i = 0;
  +      assertEquals(expected, ((MethodCall) l.get(i++)).getArgs()[0].toString());
  +      assertEquals(expected + "/hello/world", ((MethodCall) l.get(i++)).getArgs()[0].toString());
  +      assertEquals(expected + "/hello/again", ((MethodCall) l.get(i++)).getArgs()[0].toString());
  +      assertEquals(expected + "/buddy/replication", ((MethodCall) l.get(i)).getArgs()[0].toString());
       }
   }
  
  
  



More information about the jboss-cvs-commits mailing list