CVS update: JGroups/tests/junit-functional/org/jgroups/tests CreditMapTest.java

"Bela Ban" <[email protected]>
Newsgroups gmane.comp.java.javagroups.cvs
Message-ID <[email protected]>
  User: belaban 
  Date: 10/09/07 14:00:50

  Modified:    tests/junit-functional/org/jgroups/tests CreditMapTest.java
  Log:
  ns
  
  Revision  Changes    Path
  1.2       +28 -1     JGroups/tests/junit-functional/org/jgroups/tests/CreditMapTest.java
  
  Index: CreditMapTest.java
  ===================================================================
  RCS file: /cvsroot/javagroups/JGroups/tests/junit-functional/org/jgroups/tests/CreditMapTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CreditMapTest.java	7 Sep 2010 13:24:43 -0000	1.1
  +++ CreditMapTest.java	7 Sep 2010 14:00:50 -0000	1.2
  @@ -13,7 +13,7 @@
   /**
    * Tests CreditMap
    * @author Bela Ban
  - * @version $Id: CreditMapTest.java,v 1.1 2010/09/07 13:24:43 belaban Exp $
  + * @version $Id: CreditMapTest.java,v 1.2 2010/09/07 14:00:50 belaban Exp $
    */
   @Test(groups=Global.FUNCTIONAL,sequential=true)
   public class CreditMapTest {
  @@ -97,6 +97,33 @@
           assert map.getAccumulatedCredits() == 0;
       }
   
  +    public void testDecrementAndReplenish2() {
  +        map.putIfAbsent(a);
  +        map.decrement(200, 100);
  +
  +        map.putIfAbsent(b);
  +        map.decrement(200, 100);
  +
  +        map.putIfAbsent(c);
  +        map.decrement(200, 100);
  +
  +        map.putIfAbsent(d);
  +        map.decrement(200, 100);
  +
  +        // A: 200, B: 400, C: 600, D: 800
  +        System.out.println("map = " + map);
  +
  +        assert map.getAccumulatedCredits() == 200;
  +        assert map.getMinCredits() == 200;
  +
  +        map.replenish(d, 100);
  +        map.replenish(c, 100);
  +        map.replenish(a, 100);
  +        map.replenish(b, 100);
  +
  +        assert map.getMinCredits() == 300;
  +    }
  +
       public void testBlockingDecrementAndReplenishment() throws Exception {
           final CyclicBarrier barrier=new CyclicBarrier(2);
   
  
  
  

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.