From: Olivier Lamy Date: Sat, 11 Feb 2012 08:07:37 +0000 (+0000) Subject: wait end of first scan before deleting repo should prevent test failure X-Git-Tag: archiva-1.4-M3~1323 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c8e8d8f95b2d92c5c183c5cb4614f6ebce4b8d42;p=archiva.git wait end of first scan before deleting repo should prevent test failure git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1243016 13f79535-47bb-0310-9956-ffa450edef68 --- 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 58e9159be..b4530af8a 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 @@ -50,6 +50,15 @@ public class ManagedRepositoriesServiceTest service.addManagedRepository( repo ); assertNotNull( service.getManagedRepository( repo.getId() ) ); + RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader ); + + int timeout = 20000; + while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) ) + { + Thread.sleep( 500 ); + timeout -= 500; + } + service.deleteManagedRepository( repo.getId(), true ); assertNull( service.getManagedRepository( repo.getId() ) ); } @@ -67,6 +76,16 @@ public class ManagedRepositoriesServiceTest assertNull( service.getManagedRepository( repo.getId() ) ); } service.addManagedRepository( repo ); + + RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader ); + + int timeout = 20000; + while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) ) + { + Thread.sleep( 500 ); + timeout -= 500; + } + repo = service.getManagedRepository( repo.getId() ); assertNotNull( repo ); assertEquals( "test", repo.getName() ); @@ -79,6 +98,13 @@ public class ManagedRepositoriesServiceTest assertNotNull( repo ); assertEquals( "toto", repo.getName() ); + timeout = 20000; + while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) ) + { + Thread.sleep( 500 ); + timeout -= 500; + } + service.deleteManagedRepository( repo.getId(), true ); assertNull( service.getManagedRepository( repo.getId() ) );