@Test
public void updateManagedRepo()
throws Exception
{
ManagedRepositoriesService service = getManagedRepositoriesService( authorizationHeader );
ManagedRepository repo = getTestManagedRepository();
if ( service.getManagedRepository( repo.getId() ) != null )
{
service.deleteManagedRepository( repo.getId(), true );
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() );
// toto is foo in French :-)
repo.setName( "toto" );
service.updateManagedRepository( repo );
repo = service.getManagedRepository( repo.getId() );
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() ) );
}