Search in sources :

Example 1 with DefaultProxyConnectorAdmin

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();
}
Also used : ConfigurationListener(org.apache.archiva.configuration.ConfigurationListener) DefaultProxyConnectorAdmin(org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin) ArchivaConfiguration(org.apache.archiva.configuration.ArchivaConfiguration) ManagedRepositoryConfiguration(org.apache.archiva.configuration.ManagedRepositoryConfiguration) ContextConfiguration(org.springframework.test.context.ContextConfiguration) Configuration(org.apache.archiva.configuration.Configuration) ArchivaConfiguration(org.apache.archiva.configuration.ArchivaConfiguration) DefaultManagedRepositoryAdmin(org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin) Before(org.junit.Before)

Aggregations

DefaultManagedRepositoryAdmin (org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin)1 DefaultProxyConnectorAdmin (org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin)1 ArchivaConfiguration (org.apache.archiva.configuration.ArchivaConfiguration)1 Configuration (org.apache.archiva.configuration.Configuration)1 ConfigurationListener (org.apache.archiva.configuration.ConfigurationListener)1 ManagedRepositoryConfiguration (org.apache.archiva.configuration.ManagedRepositoryConfiguration)1 Before (org.junit.Before)1 ContextConfiguration (org.springframework.test.context.ContextConfiguration)1