Author: oching
Date: Wed Nov 18 03:11:13 2009
New Revision: 881656

URL: http://svn.apache.org/viewvc?rev=881656&view=rev
Log:
fix unable to delete index IOException in tests when built in windows 

Modified:
    
archiva/trunk/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java

Modified: 
archiva/trunk/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java?rev=881656&r1=881655&r2=881656&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java
 Wed Nov 18 03:11:13 2009
@@ -101,7 +101,8 @@
     protected void tearDown()
         throws Exception
     {
-        context.close( false );
+        context.close( true );
+        indexer.removeIndexingContext( context, true );
 
         // delete created index in the repository
         File indexDir = new File( repositoryConfig.getLocation(), ".indexer" );
@@ -151,6 +152,8 @@
         assertEquals( "org.apache.archiva", artifactInfo.groupId );
         assertEquals( "archiva-index-methods-jar-test", 
artifactInfo.artifactId );
         assertEquals( "test-repo", artifactInfo.repository );
+
+        context.close( true );
     }
 
     public void testUpdateArtifactInIndex()
@@ -173,6 +176,8 @@
         IndexSearcher searcher = new IndexSearcher( 
repositoryConfig.getLocation() + "/.indexer" );
         TopDocs topDocs = searcher.search( q, null, 10 );
 
+        searcher.close();
+
         assertTrue( new File( repositoryConfig.getLocation(), ".indexer" 
).exists() );
         assertFalse( new File( repositoryConfig.getLocation(), ".index" 
).exists() );
 
@@ -206,6 +211,8 @@
         // should return 1 hit
         assertEquals( 1, topDocs.totalHits );
 
+        searcher.close();
+
         context = TaskCreator.createContext( repositoryConfig );
 
         // remove added artifact from index
@@ -230,6 +237,8 @@
         // artifact should have been removed from the index!
         assertEquals( 0, topDocs.totalHits );
 
+        context.close( true );
+        searcher.close();
         // TODO: test it was removed from the packaged index also
     }
 
@@ -278,6 +287,8 @@
         assertEquals( "org.apache.archiva", artifactInfo.groupId );
         assertEquals( "archiva-index-methods-jar-test", 
artifactInfo.artifactId );
         assertEquals( "test-repo", artifactInfo.repository );
+
+        context.close( true );
     }
 
     private void unzipIndex( String indexDir, String destDir )


Reply via email to