use of org.apache.archiva.repository.RepositoryGroup in project archiva by apache.
the class RepositoryGroupHandlerTest method validateRepository.
@Test
void validateRepository() throws IOException {
RepositoryGroupHandler groupHandler = createHandler();
final String id = "test-group-10";
EditableRepositoryGroup repositoryGroup = createRepository(id, "n-" + id);
repositoryGroup.setMergedIndexTTL(5);
CheckedResult<RepositoryGroup, Map<String, List<ValidationError>>> result = groupHandler.validateRepository(repositoryGroup);
assertNotNull(result);
assertEquals(0, result.getResult().size());
repositoryGroup = createRepository(id, "n-test-group-10###");
result = groupHandler.validateRepository(repositoryGroup);
assertNotNull(result);
assertEquals(2, result.getResult().size());
assertNotNull(result.getResult().get("merged_index_ttl"));
assertNotNull(result.getResult().get("name"));
}
use of org.apache.archiva.repository.RepositoryGroup in project archiva by apache.
the class RepositoryGroupHandlerTest method validateRepositoryIfExisting.
@Test
void validateRepositoryIfExisting() throws IOException, RepositoryException {
final String id = "test-group-11";
try {
RepositoryGroupHandler groupHandler = createHandler();
EditableRepositoryGroup repositoryGroup = createRepository(id, "n-" + id);
repositoryGroup.setMergedIndexTTL(5);
groupHandler.put(repositoryGroup);
CheckedResult<RepositoryGroup, Map<String, List<ValidationError>>> result = groupHandler.validateRepository(repositoryGroup);
assertNotNull(result);
assertEquals(1, result.getResult().size());
} finally {
removeGroupFromConfig(id);
}
}
use of org.apache.archiva.repository.RepositoryGroup in project archiva by apache.
the class RepositoryGroupHandlerTest method activateRepository.
@Test
void activateRepository() throws RepositoryException {
String id = "test-group-02";
RepositoryGroupHandler groupHandler = createHandler();
RepositoryGroup repo = groupHandler.newInstance(RepositoryType.MAVEN, id);
groupHandler.activateRepository(repo);
verify(mergedRemoteIndexesScheduler).schedule(eq(repo), any());
assertEquals(RepositoryState.INITIALIZED, repo.getLastState());
assertFalse(hasGroupInConfig(id));
}
use of org.apache.archiva.repository.RepositoryGroup in project archiva by apache.
the class RepositoryGroupHandlerTest method putWithConfiguration.
@Test
void putWithConfiguration() throws RepositoryException {
String id = "test-group-05";
try {
RepositoryGroupHandler groupHandler = createHandler();
RepositoryGroupConfiguration configuration = new RepositoryGroupConfiguration();
configuration.setId(id);
configuration.setName("n-" + id);
ArrayList<String> repos = new ArrayList<>();
repos.add("internal");
configuration.setRepositories(repos);
groupHandler.put(configuration);
RepositoryGroup repo = groupHandler.get(id);
assertNotNull(repo);
assertEquals(id, repo.getId());
assertEquals("n-" + id, repo.getName());
assertNotNull(repo.getRepositories());
assertEquals(1, repo.getRepositories().size());
assertEquals("internal", repo.getRepositories().get(0).getId());
assertTrue(hasGroupInConfig(id));
} finally {
removeGroupFromConfig(id);
}
}
use of org.apache.archiva.repository.RepositoryGroup in project archiva by apache.
the class BasicRepositoryGroupValidatorTest method apply.
@Test
void apply() throws IOException {
BasicRepositoryGroupValidator validator = new BasicRepositoryGroupValidator(configurationHandler);
EditableRepositoryGroup group = createGroup("test", "test");
group.setMergedIndexTTL(360);
ValidationResponse<RepositoryGroup> result = validator.apply(group);
assertNotNull(result);
assertTrue(result.isValid());
}
Aggregations