summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2009-11-18 03:11:13 +0000
committerMaria Odea B. Ching <oching@apache.org>2009-11-18 03:11:13 +0000
commit2819ac8d303be0c480c8e35a97f379007aec7cc9 (patch)
treeb06dd15927a4a3aa611a7edd23c00121fb54ab1c
parent3724f9749c820f3272937544026f450ef12677f9 (diff)
downloadarchiva-2819ac8d303be0c480c8e35a97f379007aec7cc9.tar.gz
archiva-2819ac8d303be0c480c8e35a97f379007aec7cc9.zip
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
-rw-r--r--archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java b/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java
index af20d0868..a0e90b647 100644
--- a/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java
+++ b/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java
@@ -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 )