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

Brian Stansberry brian.stansberry at jboss.com
Mon Nov 6 16:14:47 EST 2006


  User: bstansberry
  Date: 06/11/06 16:14:47

  Modified:    tests/functional/org/jboss/cache/api  CacheSPITest.java
  Log:
  Add proper setUp/tearDown
  
  Revision  Changes    Path
  1.2       +35 -3     JBossCache/tests/functional/org/jboss/cache/api/CacheSPITest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheSPITest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/api/CacheSPITest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- CacheSPITest.java	6 Nov 2006 20:08:25 -0000	1.1
  +++ CacheSPITest.java	6 Nov 2006 21:14:47 -0000	1.2
  @@ -1,3 +1,4 @@
  +
   package org.jboss.cache.api;
   
   import java.util.List;
  @@ -11,15 +12,46 @@
   
   public class CacheSPITest extends TestCase
   {
  -   public void testGetMembers() throws Exception
  +   private CacheSPI cache1;
  +   private CacheSPI cache2;
  +   
  +   protected void setUp() throws Exception
      {
  +      super.setUp();
  +      
         XmlConfigurationParser parser = new XmlConfigurationParser();
         Configuration conf1 = parser.parseFile("META-INF/replSync-service.xml");
   
         Configuration conf2 = parser.parseFile("META-INF/replSync-service.xml");
         
  -      CacheSPI cache1 = (CacheSPI) DefaultCacheFactory.createCache(conf1, false);
  -      CacheSPI cache2 = (CacheSPI) DefaultCacheFactory.createCache(conf2, false);
  +      cache1 = (CacheSPI) DefaultCacheFactory.createCache(conf1, false);
  +      cache2 = (CacheSPI) DefaultCacheFactory.createCache(conf2, false);
  +   }
  +
  +   protected void tearDown() throws Exception
  +   {
  +      super.tearDown();
  +      
  +      if (cache1 != null)
  +      {
  +         try
  +         {
  +            cache1.stop();
  +         }
  +         catch (Exception e) {}
  +      }
  +      
  +      if (cache2 != null)
  +      {
  +         try
  +         {
  +            cache2.stop();
  +         }
  +         catch (Exception e) {}
  +      }
  +   }
  +   public void testGetMembers() throws Exception
  +   {
         
         cache1.start();
         List memb1 = cache1.getMembers();
  
  
  



More information about the jboss-cvs-commits mailing list