use of org.apache.archiva.repository.EditableRepositoryGroup 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.EditableRepositoryGroup in project archiva by apache.
the class RepositoryGroupHandlerTest method has.
@Test
void has() throws IOException, RepositoryException {
final String id = "test-group-13";
try {
RepositoryGroupHandler groupHandler = createHandler();
EditableRepositoryGroup repositoryGroup = createRepository(id, "n-" + id);
repositoryGroup.setMergedIndexTTL(5);
assertFalse(groupHandler.hasRepository(id));
groupHandler.put(repositoryGroup);
assertTrue(groupHandler.hasRepository(id));
} finally {
removeGroupFromConfig(id);
}
}
use of org.apache.archiva.repository.EditableRepositoryGroup 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());
}
use of org.apache.archiva.repository.EditableRepositoryGroup in project archiva by apache.
the class BasicRepositoryGroupValidatorTest method applyWithBadName.
@Test
void applyWithBadName() throws IOException {
BasicRepositoryGroupValidator validator = new BasicRepositoryGroupValidator(configurationHandler);
validator.setRepositoryRegistry(repositoryRegistry);
EditableRepositoryGroup group = createGroup("test", "badtest\\name");
group.setMergedIndexTTL(360);
ValidationResponse<RepositoryGroup> result = validator.apply(group);
assertFalse(result.isValid());
assertEquals(1, result.getResult().size());
assertEquals("invalid_chars", result.getResult().get("name").get(0).getType());
}
use of org.apache.archiva.repository.EditableRepositoryGroup in project archiva by apache.
the class BasicRepositoryGroupValidatorTest method applyWithNullObject.
@Test
void applyWithNullObject() throws IOException {
BasicRepositoryGroupValidator validator = new BasicRepositoryGroupValidator(configurationHandler);
EditableRepositoryGroup group = createGroup("", "test");
group.setMergedIndexTTL(0);
ValidationResponse<RepositoryGroup> result = validator.apply(null);
assertNotNull(result);
assertFalse(result.isValid());
assertTrue(result.getResult().containsKey("object"));
assertEquals("repository_group", result.getResult().get("object").get(0).getCategory());
assertEquals("isnull", result.getResult().get("object").get(0).getType());
assertEquals("object", result.getResult().get("object").get(0).getAttribute());
}
Aggregations