From 2819ac8d303be0c480c8e35a97f379007aec7cc9 Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Wed, 18 Nov 2009 03:11:13 +0000 Subject: [PATCH] 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 --- .../executors/ArchivaIndexingTaskExecutorTest.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 ) -- 2.39.5