ArchivaRepository repository =
new ArchivaRepository( TEST_DEFAULT_REPO_ID, TEST_DEFAULT_REPOSITORY_NAME, repoUri );
File indexLocation = new File( "target/index-crossrepo-" + getName() + "/" );
MockConfiguration config = (MockConfiguration) lookup( ArchivaConfiguration.class.getName(), "mock" );
ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
repoConfig.setId( TEST_DEFAULT_REPO_ID );
repoConfig.setName( TEST_DEFAULT_REPOSITORY_NAME );
repoConfig.setLocation( repoDir.getAbsolutePath() );
repoConfig.setIndexDir( indexLocation.getAbsolutePath() );
repoConfig.setScanned( true );
if ( indexLocation.exists() )
{
FileUtils.deleteDirectory( indexLocation );
}
config.getConfiguration().addManagedRepository( repoConfig );
// Create the (empty) indexes.
RepositoryContentIndex indexHashcode = indexFactory.createHashcodeIndex( repository );
RepositoryContentIndex indexBytecode = indexFactory.createBytecodeIndex( repository );
RepositoryContentIndex indexContents = indexFactory.createFileContentIndex( repository );