use of org.apache.archiva.configuration.model.Configuration in project archiva by apache.
the class RemoteRepositoryHandlerTest method removeRepositoryFromConfig.
// Helper method that removes a repo from the configuration
private void removeRepositoryFromConfig(String id) {
Configuration configuration = configurationHandler.getBaseConfiguration();
Iterator<RemoteRepositoryConfiguration> iter = configuration.getRemoteRepositories().iterator();
while (iter.hasNext()) {
RemoteRepositoryConfiguration repo = iter.next();
if (id.equals(repo.getId())) {
iter.remove();
break;
}
}
try {
configurationHandler.save(configuration);
} catch (Throwable e) {
System.err.println("Could not remove repo from config " + id);
}
}
use of org.apache.archiva.configuration.model.Configuration in project archiva by apache.
the class Maven2RepositoryMetadataResolverTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
c = new Configuration();
c.setVersion("2.0");
testRepo = new ManagedRepositoryConfiguration();
testRepo.setId(TEST_REPO_ID);
testRepo.setLocation(Paths.get("target/test-repository").toAbsolutePath().toString());
testRepo.setReleases(true);
testRepo.setSnapshots(true);
c.addManagedRepository(testRepo);
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);
RepositoryScanningConfiguration scCfg = new RepositoryScanningConfiguration();
c.setRepositoryScanning(scCfg);
configuration.save(c);
assertFalse(configuration.isDefaulted());
repositoryRegistry.reload();
assertTrue(c.getManagedRepositories().get(0).isSnapshots());
assertTrue(c.getManagedRepositories().get(0).isReleases());
wagonFactory = mock(WagonFactory.class);
storage.setWagonFactory(wagonFactory);
Wagon wagon = new MockWagon();
when(wagonFactory.getWagon(new WagonFactoryRequest().protocol("wagon#http"))).thenReturn(wagon);
}
use of org.apache.archiva.configuration.model.Configuration in project archiva by apache.
the class DefaultArchivaAdministration method addInvalidContentConsumer.
@Override
public void addInvalidContentConsumer(String invalidContentConsumer, AuditInformation auditInformation) throws RepositoryAdminException {
Configuration configuration = getArchivaConfiguration().getConfiguration();
if (configuration.getRepositoryScanning().getInvalidContentConsumers().contains(invalidContentConsumer)) {
log.warn("skip adding invalidContentConsumer {} as already here", invalidContentConsumer);
return;
}
configuration.getRepositoryScanning().addInvalidContentConsumer(invalidContentConsumer);
saveConfiguration(configuration);
triggerAuditEvent("", "", AuditEvent.ENABLE_REPO_CONSUMER, auditInformation);
}
use of org.apache.archiva.configuration.model.Configuration in project archiva by apache.
the class DefaultArchivaAdministration method removeFileTypePattern.
@Override
public void removeFileTypePattern(String fileTypeId, String pattern, AuditInformation auditInformation) throws RepositoryAdminException {
Configuration configuration = getArchivaConfiguration().getConfiguration();
org.apache.archiva.configuration.model.FileType fileType = getFileTypeById(fileTypeId, configuration);
if (fileType == null) {
return;
}
fileType.removePattern(pattern);
saveConfiguration(configuration);
triggerAuditEvent("", "", AuditEvent.REMOVE_PATTERN, auditInformation);
}
use of org.apache.archiva.configuration.model.Configuration in project archiva by apache.
the class DefaultArchivaAdministration method addLegacyArtifactPath.
@Override
public void addLegacyArtifactPath(LegacyArtifactPath legacyArtifactPath, AuditInformation auditInformation) throws RepositoryAdminException {
Configuration configuration = getArchivaConfiguration().getConfiguration();
configuration.addLegacyArtifactPath(getModelMapper().map(legacyArtifactPath, org.apache.archiva.configuration.model.LegacyArtifactPath.class));
saveConfiguration(configuration);
triggerAuditEvent("", "", AuditEvent.ADD_LEGACY_PATH, auditInformation);
}
Aggregations