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

Manik Surtani manik at jboss.org
Tue Jun 19 22:10:41 EDT 2007


  User: msurtani
  Date: 07/06/19 22:10:41

  Modified:    tests/functional/org/jboss/cache/buddyreplication  
                        BuddyPoolBroadcastTest.java
                        BuddyReplicationTestsBase.java
  Log:
  optimised for speed for unit tests
  
  Revision  Changes    Path
  1.22      +15 -3     JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BuddyPoolBroadcastTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyPoolBroadcastTest.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -b -r1.21 -r1.22
  --- BuddyPoolBroadcastTest.java	18 Jun 2007 16:01:32 -0000	1.21
  +++ BuddyPoolBroadcastTest.java	20 Jun 2007 02:10:41 -0000	1.22
  @@ -50,6 +50,13 @@
         log.debug("Finishing setUp()");
      }
   
  +   protected void tearDown() throws Exception
  +   {
  +      long st = System.currentTimeMillis();
  +      super.tearDown();
  +      System.out.println("Teardown: " + (System.currentTimeMillis() - st));
  +   }
  +
      public void test2CachesWithPoolNames() throws Exception
      {
         log.error("Running test2CachesWithPoolNames");
  @@ -66,7 +73,10 @@
      public void test3CachesWithPoolNames() throws Exception
      {
         log.debug("Running test3CachesWithPoolNames");
  +      long st = System.currentTimeMillis();
         caches = createCaches(3, true);
  +      System.out.println("Setup: " + (System.currentTimeMillis() - st));
  +      st = System.currentTimeMillis();
   
         BuddyManager m = caches[0].getBuddyManager();
         Map groupMap = m.buddyPool;
  @@ -74,6 +84,7 @@
         assertEquals("A", groupMap.get(caches[0].getLocalAddress()));
         assertEquals("B", groupMap.get(caches[1].getLocalAddress()));
         assertEquals("C", groupMap.get(caches[2].getLocalAddress()));
  +      System.out.println("Test: " + (System.currentTimeMillis() - st));
      }
   
      public void testBuddyPoolSync() throws Exception
  @@ -133,12 +144,12 @@
         for (int i = 0; i < numCaches; i++)
         {
            caches[i] = createCache(1, new String(new char[]{(char) ('A' + i)}), false, false);
  -         starters[i] = new CacheStarter(latch, caches[i]);
  +         starters[i] = new CacheStarter("CacheStarter-" + i, latch, caches[i]);
            starters[i].start();
         }
   
         // now have the lot start simultaneously
  -      TestingUtil.sleepThread(500);
  +//      TestingUtil.sleepThread(500);
         latch.countDown();
   
         // allow a generous sleep time
  @@ -161,8 +172,9 @@
         private CountDownLatch latch;
         private CacheImpl cache;
   
  -      public CacheStarter(CountDownLatch latch, CacheImpl cache)
  +      public CacheStarter(String name, CountDownLatch latch, CacheImpl cache)
         {
  +         super(name);
            this.latch = latch;
            this.cache = cache;
         }
  
  
  
  1.51      +21 -14    JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BuddyReplicationTestsBase.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -b -r1.50 -r1.51
  --- BuddyReplicationTestsBase.java	18 Jun 2007 16:01:32 -0000	1.50
  +++ BuddyReplicationTestsBase.java	20 Jun 2007 02:10:41 -0000	1.51
  @@ -42,6 +42,13 @@
         System.setProperty("org.jboss.cache.shutdown.force", "true");
         if (caches != null)
         {
  +         // an optimisation to aid the progress of unit tests, especially in the case of TCP connections.  Note that this
  +         // is NOT necessary in live systems since each cache would typically be in a separate JVM.
  +         for (CacheImpl c : caches)
  +         {
  +            c.getBuddyManager().stop();
  +         }
  +
            for (CacheImpl c : caches)
            {
               if (c != null)
  @@ -221,11 +228,11 @@
                          "<cacheloader>\n" +
                          "<class>org.jboss.cache.loader.DummyInMemoryCacheLoader</class>\n" +
   //              "<properties>location=" + (location) + "</properties>\n" +
  -"<async>false</async>\n" +
  -"<shared>false</shared>\n" +
  -"<fetchPersistentState>" + fetchPersistent + "</fetchPersistentState>\n" +
  -"</cacheloader>\n" +
  -"</config>";
  +              "<async>false</async>\n" +
  +              "<shared>false</shared>\n" +
  +              "<fetchPersistentState>" + fetchPersistent + "</fetchPersistentState>\n" +
  +              "</cacheloader>\n" +
  +              "</config>";
   
         Element element = XmlHelper.stringToElement(cloader);
         CacheLoaderConfig cfg = XmlConfigurationParser.parseCacheLoaderConfig(element);
  
  
  



More information about the jboss-cvs-commits mailing list