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);
}
Aggregations