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

Manik Surtani msurtani at jboss.com
Tue Oct 31 12:33:36 EST 2006


  User: msurtani
  Date: 06/10/31 12:33:36

  Modified:    tests/functional/org/jboss/cache/eviction 
                        ConcurrentEvictionTest.java
  Log:
  Added file location + cleanup
  
  Revision  Changes    Path
  1.2       +25 -9     JBossCache/tests/functional/org/jboss/cache/eviction/ConcurrentEvictionTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConcurrentEvictionTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/eviction/ConcurrentEvictionTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- ConcurrentEvictionTest.java	26 Oct 2006 18:20:38 -0000	1.1
  +++ ConcurrentEvictionTest.java	31 Oct 2006 17:33:36 -0000	1.2
  @@ -10,16 +10,18 @@
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  -
   import org.jboss.cache.Fqn;
   import org.jboss.cache.TreeCache;
   import org.jboss.cache.factories.XmlConfigurationParser;
  +import org.jboss.cache.loader.FileCacheLoaderConfig;
  +
  +import java.io.File;
   
   /**
    * Tests cache behavior in the presence of concurrent passivation.
    * 
    * @author Brian Stansberry
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class ConcurrentEvictionTest extends TestCase
   {
  @@ -31,7 +33,7 @@
         super(s);
      }
   
  -   public void setUp() throws Exception
  +   protected void setUp() throws Exception
      {
         super.setUp();
         initCaches();
  @@ -43,6 +45,7 @@
   
      void initCaches() throws Exception
      {
  +      removeStaleFiles();
         cache_ = new TreeCache();
         cache_.setConfiguration(new XmlConfigurationParser().parseFile("META-INF/local-eviction-cacheloader-service.xml")); // read in generic local xml
         cache_.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
  @@ -52,7 +55,20 @@
      public void tearDown() throws Exception
      {
         super.tearDown();
  +      removeStaleFiles();
         cache_.stop();
  +      cache_ = null;
  +   }
  +
  +   private void removeStaleFiles()
  +   {
  +      File file = new File(cache_ == null ? "/tmp/JBossCacheFileCacheLoader" : ((FileCacheLoaderConfig) cache_.getCacheLoader().getConfig()).getLocation());
  +      if (file.exists())
  +      {
  +         System.out.println("Deleting file " + file);
  +         file.deleteOnExit();
  +         System.out.println(file.delete());
  +      }
      }
      
      public void testConcurrentEviction() throws Exception
  
  
  



More information about the jboss-cvs-commits mailing list