managedRepositoriesService.deleteManagedRepository( id, false );
}
getManagedRepositoriesService().addManagedRepository( managedRepository );
RepositoriesService repositoriesService = getRepositoriesService();
repositoriesService.scanRepositoryNow( id, true );
// wait a bit to ensure index is finished
int timeout = 20000;
while ( timeout > 0 && repositoriesService.alreadyScanning( id ) )
{
Thread.sleep( 500 );
timeout -= 500;
}
RepositoryGroupService repositoryGroupService = getRepositoryGroupService();
RepositoryGroup repositoryGroup = new RepositoryGroup();
repositoryGroup.setId( "test-group" );
repositoryGroup.setRepositories( Arrays.asList( id ) );
repositoryGroupService.addRepositoryGroup( repositoryGroup );
// create a repo with a remote on the one with index
id = Long.toString( System.currentTimeMillis() );
managedRepository = new ManagedRepository();
managedRepository.setId( id );
managedRepository.setName( "name of " + id );
managedRepository.setLocation( "src/test/repositories/test-repo" );
managedRepository.setIndexDirectory( "target/tmpIndex/" + id );
if ( managedRepositoriesService.getManagedRepository( id ) != null )
{
managedRepositoriesService.deleteManagedRepository( id, false );
}
getManagedRepositoriesService().addManagedRepository( managedRepository );
RemoteRepository remoteRepository = new RemoteRepository();
remoteRepository.setId( "all-merged" );
remoteRepository.setName( "all-merged" );
remoteRepository.setDownloadRemoteIndex( true );
remoteRepository.setUrl( "http://localhost:" + port + "/repository/test-group" );
remoteRepository.setRemoteIndexUrl( "http://localhost:" + port + "/repository/test-group/.indexer" );
remoteRepository.setUserName( RedbackRoleConstants.ADMINISTRATOR_ACCOUNT_NAME );
remoteRepository.setPassword( FakeCreateAdminService.ADMIN_TEST_PWD );
getRemoteRepositoriesService().addRemoteRepository( remoteRepository );
ProxyConnectorService proxyConnectorService = getProxyConnectorService();
ProxyConnector proxyConnector = new ProxyConnector();
proxyConnector.setProxyId( "foo-bar" );
proxyConnector.setSourceRepoId( id );
proxyConnector.setTargetRepoId( "all-merged" );
proxyConnectorService.addProxyConnector( proxyConnector );
repositoriesService.scheduleDownloadRemoteIndex( "all-merged", true, true );
// wait a bit
timeout = 20000;
while ( timeout > 0 )
{