Search in sources :

Example 1 with DefaultRepositoryCommonValidator

use of org.apache.archiva.admin.repository.DefaultRepositoryCommonValidator in project archiva by apache.

the class ArchivaDavResourceFactoryTest method setUp.

@Before
@Override
public void setUp() throws Exception {
    super.setUp();
    requestControl = createControl();
    request = requestControl.createMock(DavServletRequest.class);
    responseControl = createControl();
    response = responseControl.createMock(DavServletResponse.class);
    // responseControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
    archivaConfigurationControl = createControl();
    archivaConfiguration = archivaConfigurationControl.createMock(ArchivaConfiguration.class);
    config = new Configuration();
    expect(archivaConfiguration.getConfiguration()).andReturn(config).times(2, 20);
    expect(archivaConfiguration.getDefaultLocale()).andReturn(Locale.getDefault()).anyTimes();
    archivaConfiguration.addListener(EasyMock.anyObject());
    expectLastCall().times(0, 4);
    archivaConfiguration.save(config);
    expectLastCall().times(0, 4);
    archivaConfigurationControl.replay();
    defaultManagedRepositoryAdmin.setArchivaConfiguration(archivaConfiguration);
    repositoryRegistry.setArchivaConfiguration(archivaConfiguration);
    repositoryRegistry.reload();
    ((DefaultRepositoryCommonValidator) defaultManagedRepositoryAdmin.getRepositoryCommonValidator()).setArchivaConfiguration(archivaConfiguration);
    if (defaultManagedRepositoryAdmin.getManagedRepository(RELEASES_REPO) == null) {
        defaultManagedRepositoryAdmin.addManagedRepository(createManagedRepository(RELEASES_REPO, Paths.get("target/test-classes/" + RELEASES_REPO).toString(), "default"), false, null);
    }
    if (defaultManagedRepositoryAdmin.getManagedRepository(INTERNAL_REPO) == null) {
        defaultManagedRepositoryAdmin.addManagedRepository(createManagedRepository(INTERNAL_REPO, Paths.get("target/test-classes/" + INTERNAL_REPO).toString(), "default"), false, null);
    }
    RepositoryGroup repoGroupConfig = new RepositoryGroup();
    repoGroupConfig.setId(LOCAL_REPO_GROUP);
    repoGroupConfig.addRepository(RELEASES_REPO);
    repoGroupConfig.addRepository(INTERNAL_REPO);
    defaultRepositoryGroupAdmin.setArchivaConfiguration(archivaConfiguration);
    if (defaultManagedRepositoryAdmin.getManagedRepository(LOCAL_REPO_GROUP) == null) {
        defaultRepositoryGroupAdmin.addRepositoryGroup(repoGroupConfig, null);
    }
    repoContentFactoryControl = createControl();
    repoFactory = repoContentFactoryControl.createMock(RepositoryContentFactory.class);
    repoRequestControl = createControl();
    repoRequest = repoRequestControl.createMock(RepositoryRequest.class);
    resourceFactory = new OverridingArchivaDavResourceFactory(applicationContext, plexusSisuBridge, archivaConfiguration);
    resourceFactory.setArchivaConfiguration(archivaConfiguration);
    resourceFactory.setRepositoryFactory(repoFactory);
    resourceFactory.setRepositoryRequest(repoRequest);
    resourceFactory.setConnectors(new OverridingRepositoryProxyConnectors());
    resourceFactory.setRemoteRepositoryAdmin(remoteRepositoryAdmin);
    resourceFactory.setManagedRepositoryAdmin(defaultManagedRepositoryAdmin);
    resourceFactory.setRepositoryRegistry(repositoryRegistry);
}
Also used : DavServletRequest(org.apache.jackrabbit.webdav.DavServletRequest) ArchivaConfiguration(org.apache.archiva.configuration.ArchivaConfiguration) RepositoryGroupConfiguration(org.apache.archiva.configuration.RepositoryGroupConfiguration) Configuration(org.apache.archiva.configuration.Configuration) ContextConfiguration(org.springframework.test.context.ContextConfiguration) RepositoryGroup(org.apache.archiva.admin.model.beans.RepositoryGroup) RepositoryRequest(org.apache.archiva.repository.content.maven2.RepositoryRequest) DavServletResponse(org.apache.jackrabbit.webdav.DavServletResponse) DefaultRepositoryCommonValidator(org.apache.archiva.admin.repository.DefaultRepositoryCommonValidator) ArchivaConfiguration(org.apache.archiva.configuration.ArchivaConfiguration) RepositoryContentFactory(org.apache.archiva.repository.RepositoryContentFactory) Before(org.junit.Before)

Aggregations

RepositoryGroup (org.apache.archiva.admin.model.beans.RepositoryGroup)1 DefaultRepositoryCommonValidator (org.apache.archiva.admin.repository.DefaultRepositoryCommonValidator)1 ArchivaConfiguration (org.apache.archiva.configuration.ArchivaConfiguration)1 Configuration (org.apache.archiva.configuration.Configuration)1 RepositoryGroupConfiguration (org.apache.archiva.configuration.RepositoryGroupConfiguration)1 RepositoryContentFactory (org.apache.archiva.repository.RepositoryContentFactory)1 RepositoryRequest (org.apache.archiva.repository.content.maven2.RepositoryRequest)1 DavServletRequest (org.apache.jackrabbit.webdav.DavServletRequest)1 DavServletResponse (org.apache.jackrabbit.webdav.DavServletResponse)1 Before (org.junit.Before)1 ContextConfiguration (org.springframework.test.context.ContextConfiguration)1