use of org.apache.archiva.repository.RepositoryGroup 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.RepositoryGroup 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());
}
use of org.apache.archiva.repository.RepositoryGroup in project archiva by apache.
the class BasicRepositoryGroupValidatorTest method applyWithEmptyId.
@Test
void applyWithEmptyId() throws IOException {
BasicRepositoryGroupValidator validator = new BasicRepositoryGroupValidator(configurationHandler);
EditableRepositoryGroup group = createGroup("", "test");
group.setMergedIndexTTL(0);
ValidationResponse<RepositoryGroup> result = validator.apply(group);
assertNotNull(result);
assertFalse(result.isValid());
assertTrue(result.getResult().containsKey("id"));
assertEquals("repository_group", result.getResult().get("id").get(0).getCategory());
assertEquals("empty", result.getResult().get("id").get(0).getType());
assertEquals("id", result.getResult().get("id").get(0).getAttribute());
}
use of org.apache.archiva.repository.RepositoryGroup in project archiva by apache.
the class BasicRepositoryGroupValidatorTest method applyWithBadTTL.
@Test
void applyWithBadTTL() throws IOException {
BasicRepositoryGroupValidator validator = new BasicRepositoryGroupValidator(configurationHandler);
EditableRepositoryGroup group = createGroup("test", "test");
group.setMergedIndexTTL(0);
ValidationResponse<RepositoryGroup> result = validator.apply(group);
assertNotNull(result);
assertFalse(result.isValid());
assertTrue(result.getResult().containsKey("merged_index_ttl"));
assertEquals("repository_group", result.getResult().get("merged_index_ttl").get(0).getCategory());
assertEquals("min", result.getResult().get("merged_index_ttl").get(0).getType());
assertEquals("merged_index_ttl", result.getResult().get("merged_index_ttl").get(0).getAttribute());
}
use of org.apache.archiva.repository.RepositoryGroup in project archiva by apache.
the class MavenRepositoryProviderTest method createRepositoryGroupWithCfg.
@Test
public void createRepositoryGroupWithCfg() throws RepositoryException {
RepositoryGroupConfiguration cfg = new RepositoryGroupConfiguration();
cfg.setId("group2");
cfg.setName("Group 2");
cfg.setCronExpression("0 0 03 ? * MON");
cfg.setMergedIndexTtl(504);
cfg.setMergedIndexPath(".index-abc");
ArrayList<String> repos = new ArrayList<>();
repos.add("test01");
repos.add("test02");
cfg.setRepositories(repos);
RepositoryGroup grp = provider.createRepositoryGroup(cfg);
assertEquals("group2", grp.getId());
assertEquals("Group 2", grp.getName());
assertEquals("0 0 03 ? * MON", grp.getSchedulingDefinition());
IndexCreationFeature indexCreationFeature = grp.getFeature(IndexCreationFeature.class);
try {
assertEquals(new URI(".index-abc"), indexCreationFeature.getIndexPath());
} catch (URISyntaxException e) {
e.printStackTrace();
}
assertEquals(504, grp.getMergedIndexTTL());
assertEquals(0, grp.getRepositories().size());
// assertTrue(grp.getRepositories().stream().anyMatch(r -> "test01".equals(r.getId())));
// assertTrue(grp.getRepositories().stream().anyMatch(r -> "test02".equals(r.getId())));
}
Aggregations