use of org.apache.archiva.configuration.model.Configuration in project archiva by apache.
the class RepositoryGroupHandlerTest method testPutWithoutRegister.
@Test
void testPutWithoutRegister() throws RepositoryException {
RepositoryGroupHandler groupHandler = createHandler();
Configuration aCfg = new Configuration();
RepositoryGroupConfiguration configuration = new RepositoryGroupConfiguration();
final String id = "test-group-06";
configuration.setId(id);
configuration.setName("n-" + id);
ArrayList<String> repos = new ArrayList<>();
repos.add("internal");
configuration.setRepositories(repos);
groupHandler.put(configuration, aCfg);
RepositoryGroup repo = groupHandler.get(id);
assertNull(repo);
assertFalse(hasGroupInConfig(id));
assertTrue(aCfg.getRepositoryGroups().stream().anyMatch(g -> g != null && id.equals(g.getId())));
}
use of org.apache.archiva.configuration.model.Configuration in project archiva by apache.
the class ManagedRepositoryHandlerTest method testPutWithoutRegister.
@Test
void testPutWithoutRegister() throws RepositoryException {
final String id = "test-repo-06";
ManagedRepositoryHandler repoHandler = createHandler();
Configuration aCfg = new Configuration();
ManagedRepositoryConfiguration configuration = new ManagedRepositoryConfiguration();
configuration.setId(id);
configuration.setName("n-" + id);
repoHandler.put(configuration, aCfg);
ManagedRepository repo = repoHandler.get(id);
assertNull(repo);
assertFalse(hasRepositoryInConfig(id));
assertTrue(aCfg.getManagedRepositories().stream().anyMatch(g -> g != null && id.equals(g.getId())));
}
use of org.apache.archiva.configuration.model.Configuration in project archiva by apache.
the class ManagedRepositoryHandlerTest method newInstancesFromConfig.
@Test
void newInstancesFromConfig() throws RepositoryException {
final String id = "test-repo-01";
ManagedRepositoryHandler repoHandler = createHandler();
Configuration configuration = new Configuration();
repoHandler.remove("test-repo-01", configuration);
Map<String, ManagedRepository> instances = repoHandler.newInstancesFromConfig();
assertFalse(repoHandler.hasRepository(id));
assertTrue(instances.containsKey(id));
assertEquals(RepositoryState.REFERENCES_SET, instances.get(id).getLastState());
}
use of org.apache.archiva.configuration.model.Configuration in project archiva by apache.
the class ManagedRepositoryHandlerTest method removeRepositoryFromConfig.
// Helper method that removes a repo from the configuration
private void removeRepositoryFromConfig(String id) {
Configuration configuration = configurationHandler.getBaseConfiguration();
Iterator<ManagedRepositoryConfiguration> iter = configuration.getManagedRepositories().iterator();
while (iter.hasNext()) {
ManagedRepositoryConfiguration 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 RemoteRepositoryHandlerTest method testPutWithoutRegister.
@Test
void testPutWithoutRegister() throws RepositoryException {
final String id = "test-repo-06";
RemoteRepositoryHandler repoHandler = createHandler();
Configuration aCfg = new Configuration();
RemoteRepositoryConfiguration configuration = new RemoteRepositoryConfiguration();
configuration.setId(id);
configuration.setName("n-" + id);
repoHandler.put(configuration, aCfg);
RemoteRepository repo = repoHandler.get(id);
assertNull(repo);
assertFalse(hasRepositoryInConfig(id));
assertTrue(aCfg.getRemoteRepositories().stream().anyMatch(g -> g != null && id.equals(g.getId())));
}
Aggregations