use of org.apache.archiva.configuration.RepositoryGroupConfiguration in project archiva by apache.
the class RepositoryServletRepositoryGroupTest method createRepositoryGroup.
protected RepositoryGroupConfiguration createRepositoryGroup(String id, List<String> repositories) {
RepositoryGroupConfiguration repoGroupConfiguration = new RepositoryGroupConfiguration();
repoGroupConfiguration.setId(id);
repoGroupConfiguration.setRepositories(repositories);
return repoGroupConfiguration;
}
use of org.apache.archiva.configuration.RepositoryGroupConfiguration in project archiva by apache.
the class DefaultRepositoryGroupAdmin method addRepositoryGroup.
@Override
public Boolean addRepositoryGroup(RepositoryGroup repositoryGroup, AuditInformation auditInformation) throws RepositoryAdminException {
validateRepositoryGroup(repositoryGroup, false);
validateManagedRepositoriesExists(repositoryGroup.getRepositories());
RepositoryGroupConfiguration repositoryGroupConfiguration = new RepositoryGroupConfiguration();
repositoryGroupConfiguration.setId(repositoryGroup.getId());
repositoryGroupConfiguration.setRepositories(repositoryGroup.getRepositories());
repositoryGroupConfiguration.setMergedIndexPath(repositoryGroup.getMergedIndexPath());
repositoryGroupConfiguration.setMergedIndexTtl(repositoryGroup.getMergedIndexTtl());
repositoryGroupConfiguration.setCronExpression(repositoryGroup.getCronExpression());
Configuration configuration = getArchivaConfiguration().getConfiguration();
configuration.addRepositoryGroup(repositoryGroupConfiguration);
saveConfiguration(configuration);
triggerAuditEvent(repositoryGroup.getId(), null, AuditEvent.ADD_REPO_GROUP, auditInformation);
mergedRemoteIndexesScheduler.schedule(repositoryGroup, getMergedIndexDirectory(repositoryGroup.getId()));
return Boolean.TRUE;
}
use of org.apache.archiva.configuration.RepositoryGroupConfiguration in project archiva by apache.
the class DefaultRepositoryGroupAdmin method updateRepositoryGroup.
private Boolean updateRepositoryGroup(RepositoryGroup repositoryGroup, AuditInformation auditInformation, boolean triggerAuditEvent) throws RepositoryAdminException {
validateRepositoryGroup(repositoryGroup, true);
validateManagedRepositoriesExists(repositoryGroup.getRepositories());
Configuration configuration = getArchivaConfiguration().getConfiguration();
RepositoryGroupConfiguration repositoryGroupConfiguration = configuration.getRepositoryGroupsAsMap().get(repositoryGroup.getId());
configuration.removeRepositoryGroup(repositoryGroupConfiguration);
repositoryGroupConfiguration.setRepositories(repositoryGroup.getRepositories());
repositoryGroupConfiguration.setMergedIndexPath(repositoryGroup.getMergedIndexPath());
repositoryGroupConfiguration.setMergedIndexTtl(repositoryGroup.getMergedIndexTtl());
repositoryGroupConfiguration.setCronExpression(repositoryGroup.getCronExpression());
configuration.addRepositoryGroup(repositoryGroupConfiguration);
saveConfiguration(configuration);
if (triggerAuditEvent) {
triggerAuditEvent(repositoryGroup.getId(), null, AuditEvent.MODIFY_REPO_GROUP, auditInformation);
}
mergedRemoteIndexesScheduler.unschedule(repositoryGroup);
mergedRemoteIndexesScheduler.schedule(repositoryGroup, getMergedIndexDirectory(repositoryGroup.getId()));
return Boolean.TRUE;
}
use of org.apache.archiva.configuration.RepositoryGroupConfiguration in project archiva by apache.
the class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
c = new Configuration();
testRepo = new ManagedRepositoryConfiguration();
testRepo.setId(TEST_REPO_ID);
testRepo.setLocation(Paths.get("target/test-repository").toAbsolutePath().toString());
testRepo.setReleases(true);
testRepo.setSnapshots(false);
c.addManagedRepository(testRepo);
testRepoS = new ManagedRepositoryConfiguration();
testRepoS.setId(TEST_SNAP_REPO_ID);
testRepoS.setLocation(Paths.get("target/test-repositorys").toAbsolutePath().toString());
testRepoS.setReleases(false);
testRepoS.setSnapshots(true);
c.addManagedRepository(testRepoS);
RemoteRepositoryConfiguration testRemoteRepo = new RemoteRepositoryConfiguration();
testRemoteRepo.setId(TEST_REMOTE_REPO_ID);
testRemoteRepo.setLayout("default");
testRemoteRepo.setName("Central Repository");
testRemoteRepo.setUrl("http://central.repo.com/maven2");
testRemoteRepo.setTimeout(10);
c.addRemoteRepository(testRemoteRepo);
ProxyConnectorConfiguration proxyConnector = new ProxyConnectorConfiguration();
proxyConnector.setSourceRepoId(TEST_REPO_ID);
proxyConnector.setTargetRepoId(TEST_REMOTE_REPO_ID);
proxyConnector.setDisabled(false);
c.addProxyConnector(proxyConnector);
ProxyConnectorConfiguration proxyConnectors = new ProxyConnectorConfiguration();
proxyConnectors.setSourceRepoId(TEST_SNAP_REPO_ID);
proxyConnectors.setTargetRepoId(TEST_REMOTE_REPO_ID);
proxyConnectors.setDisabled(false);
c.addProxyConnector(proxyConnectors);
List<String> repos = new ArrayList<>();
repos.add(TEST_REPO_ID);
repos.add(TEST_SNAP_REPO_ID);
RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
repoGroup.setId(TEST_REPO_GROUP_ID);
repoGroup.setRepositories(repos);
c.addRepositoryGroup(repoGroup);
configuration.save(c);
repositoryRegistry.reload();
assertFalse(c.getManagedRepositories().get(0).isSnapshots());
assertTrue(c.getManagedRepositories().get(0).isReleases());
assertTrue(c.getManagedRepositories().get(1).isSnapshots());
assertFalse(c.getManagedRepositories().get(1).isReleases());
wagonFactory = mock(WagonFactory.class);
storage.setWagonFactory(wagonFactory);
Wagon wagon = new MockWagon();
when(wagonFactory.getWagon(new WagonFactoryRequest().protocol("wagon#http"))).thenReturn(wagon);
}
Aggregations