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
This commit is contained in:
Olivier Lamy 2012-02-11 08:07:37 +00:00
parent 0182f1892b
commit c8e8d8f95b
1 changed files with 26 additions and 0 deletions

View File

@ -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() ) );