diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java index d173b8bf2..181514a1d 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java @@ -139,9 +139,20 @@ public class ManagedRepositoriesServiceTest assertNotNull( getUserService( authorizationHeader ).createGuestUser() ); } + RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader ); + createAndIndexRepo( testRepoId, new File( System.getProperty( "basedir" ), "src/test/repo-with-osgi" ).getAbsolutePath() ); + repositoriesService.scanRepositoryDirectoriesNow( testRepoId ); + + int timeout = 20000; + while ( timeout > 0 && repositoriesService.alreadyScanning( testRepoId ) ) + { + Thread.sleep( 500 ); + timeout -= 500; + } + ManagedRepositoriesService service = getManagedRepositoriesService( authorizationHeader ); ArchivaRepositoryStatistics archivaRepositoryStatistics =