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

Brian Stansberry brian.stansberry at jboss.com
Mon Nov 6 16:13:17 EST 2006


  User: bstansberry
  Date: 06/11/06 16:13:17

  Modified:    tests/functional/org/jboss/cache  Tag:
                        Branch_JBossCache_1_4_0 ViewManagementTest.java
  Log:
  Do a proper setUp/tearDown
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +34 -15    JBossCache/tests/functional/org/jboss/cache/Attic/ViewManagementTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ViewManagementTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/Attic/ViewManagementTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -b -r1.1.2.1 -r1.1.2.2
  --- ViewManagementTest.java	6 Nov 2006 20:24:31 -0000	1.1.2.1
  +++ ViewManagementTest.java	6 Nov 2006 21:13:17 -0000	1.1.2.2
  @@ -6,16 +6,46 @@
   
   public class ViewManagementTest extends TestCase
   {
  -   public void testGetMembers() throws Exception
  +   private TreeCache cache1;
  +   private TreeCache cache2;
  +   
  +   protected void setUp() throws Exception
      {
  +      super.setUp();
         PropertyConfigurator conf = new PropertyConfigurator();
         
  -      TreeCache cache1 = new TreeCache();
  -      TreeCache cache2 = new TreeCache();
  +      cache1 = new TreeCache();
  +      cache2 = new TreeCache();
         
         conf.configure(cache1, "META-INF/replSync-service.xml");
         conf.configure(cache2, "META-INF/replSync-service.xml");
  +   }
  +
  +   protected void tearDown() throws Exception
  +   {
  +      super.tearDown();
  +      
  +      if (cache1 != null)
  +      {
  +         try
  +         {
  +            cache1.stopService();
  +         }
  +         catch (Exception e) {}
  +      }
  +      
  +      if (cache2 != null)
  +      {
  +         try
  +         {
  +            cache2.stopService();
  +         }
  +         catch (Exception e) {}
  +      }
  +   }
         
  +   public void testGetMembers() throws Exception
  +   {
         cache1.startService();
         Thread.currentThread().sleep(500);
         List memb1 = cache1.getMembers();
  @@ -39,25 +69,14 @@
      
      public void testIsCoordinator() throws Exception
      {
  -      PropertyConfigurator conf = new PropertyConfigurator();
  -      
  -      TreeCache cache1 = new TreeCache();
  -      TreeCache cache2 = new TreeCache();
  -      
  -      conf.configure(cache1, "META-INF/replSync-service.xml");
  -      conf.configure(cache2, "META-INF/replSync-service.xml");
  -      
         cache1.startService();
  -      Thread.currentThread().sleep(500);
         assertTrue("Cache1 is coordinator", cache1.isCoordinator());
         
         cache2.startService();
  -      Thread.currentThread().sleep(500);
         assertTrue("Cache1 is still coordinator", cache1.isCoordinator());
         assertFalse("Cache2 is not coordinator", cache2.isCoordinator());
         
         cache1.stopService();
  -      Thread.currentThread().sleep(500);
         assertTrue("Cache2 is coordinator", cache2.isCoordinator());
         
      }
  
  
  



More information about the jboss-cvs-commits mailing list