{
@Test
public void addAndDelete()
throws Exception
{
RepositoryGroupService service = getRepositoryGroupService();
WebClient.client( service ).header( "Authorization", authorizationHeader );
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
assertTrue( service.getRepositoriesGroups().isEmpty() );
ManagedRepositoriesService managedRepositoriesService = getManagedRepositoriesService( authorizationHeader );
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
ManagedRepository managedRepository = getTestManagedRepository();
managedRepositoriesService.addManagedRepository( managedRepository );
RepositoryGroup repositoryGroup = new RepositoryGroup( "one", Arrays.asList( managedRepository.getId() ) )
.mergedIndexTtl( 40 );
service.addRepositoryGroup( repositoryGroup );
assertFalse( service.getRepositoriesGroups().isEmpty() );
assertEquals( 1, service.getRepositoriesGroups().size() );
assertEquals( 40, service.getRepositoriesGroups().get(0).getMergedIndexTtl() );
service.deleteRepositoryGroup( "one" );
assertTrue( service.getRepositoriesGroups().isEmpty() );
assertEquals( 0, service.getRepositoriesGroups().size() );
}