fix unable to delete index IOException in tests when built in windows

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@881656 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2009-11-18 03:11:13 +00:00
parent 3724f9749c
commit 2819ac8d30
1 changed files with 12 additions and 1 deletions

View File

@ -101,7 +101,8 @@ public class ArchivaIndexingTaskExecutorTest
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 @@ public class ArchivaIndexingTaskExecutorTest
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 @@ public class ArchivaIndexingTaskExecutorTest
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 @@ public class ArchivaIndexingTaskExecutorTest
// should return 1 hit
assertEquals( 1, topDocs.totalHits );
searcher.close();
context = TaskCreator.createContext( repositoryConfig );
// remove added artifact from index
@ -230,6 +237,8 @@ public class ArchivaIndexingTaskExecutorTest
// 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 @@ public class ArchivaIndexingTaskExecutorTest
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 )