use of org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin in project archiva by apache.
the class AbstractMavenRepositorySearch method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
FileUtils.deleteDirectory(Paths.get(org.apache.archiva.common.utils.FileUtils.getBasedir(), "/target/repos/" + TEST_REPO_1 + "/.indexer"));
assertFalse(Files.exists(Paths.get(org.apache.archiva.common.utils.FileUtils.getBasedir(), "/target/repos/" + TEST_REPO_1 + "/.indexer")));
FileUtils.deleteDirectory(Paths.get(org.apache.archiva.common.utils.FileUtils.getBasedir(), "/target/repos/" + TEST_REPO_2 + "/.indexer"));
assertFalse(Files.exists(Paths.get(org.apache.archiva.common.utils.FileUtils.getBasedir(), "/target/repos/" + TEST_REPO_2 + "/.indexer")));
archivaConfigControl = EasyMock.createControl();
archivaConfig = archivaConfigControl.createMock(ArchivaConfiguration.class);
DefaultManagedRepositoryAdmin defaultManagedRepositoryAdmin = new DefaultManagedRepositoryAdmin();
defaultManagedRepositoryAdmin.setArchivaConfiguration(archivaConfig);
DefaultProxyConnectorAdmin defaultProxyConnectorAdmin = new DefaultProxyConnectorAdmin();
defaultProxyConnectorAdmin.setArchivaConfiguration(archivaConfig);
repositoryRegistry.setArchivaConfiguration(archivaConfig);
search = new MavenRepositorySearch(indexer, repositoryRegistry, defaultProxyConnectorAdmin, queryCreator);
assertNotNull(repositoryRegistry);
defaultManagedRepositoryAdmin.setRepositoryRegistry(repositoryRegistry);
config = new Configuration();
config.addManagedRepository(createRepositoryConfig(TEST_REPO_1));
config.addManagedRepository(createRepositoryConfig(TEST_REPO_2));
config.addManagedRepository(createRepositoryConfig(REPO_RELEASE));
archivaConfig.addListener(EasyMock.anyObject(ConfigurationListener.class));
EasyMock.expect(archivaConfig.getDefaultLocale()).andReturn(Locale.getDefault()).anyTimes();
EasyMock.expect(archivaConfig.getConfiguration()).andReturn(config).anyTimes();
archivaConfig.save(EasyMock.anyObject(Configuration.class));
EasyMock.expectLastCall().anyTimes();
archivaConfigControl.replay();
repositoryRegistry.reload();
archivaConfigControl.reset();
}
Aggregations