use of org.apache.archiva.repository.EditableRemoteRepository in project archiva by apache.
the class BasicRemoteRepositoryValidatorTest method applyWithEmptyId.
@Test
void applyWithEmptyId() throws IOException {
BasicRemoteRepositoryValidator validator = new BasicRemoteRepositoryValidator(configurationHandler);
validator.setRepositoryRegistry(repositoryRegistry);
Path repoDir = getRepoBaseDir().resolve("test");
EditableRemoteRepository repo = createRepository("", "test", repoDir);
ValidationResponse<RemoteRepository> result = validator.apply(repo);
assertFalse(result.isValid());
assertEquals(1, result.getResult().size());
assertTrue(result.getResult().containsKey("id"));
assertEquals("remote_repository", 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.EditableRemoteRepository in project archiva by apache.
the class BasicRemoteRepositoryValidatorTest method applyWithBadName.
@Test
void applyWithBadName() throws IOException {
BasicRemoteRepositoryValidator validator = new BasicRemoteRepositoryValidator(configurationHandler);
validator.setRepositoryRegistry(repositoryRegistry);
Path repoDir = getRepoBaseDir().resolve("test");
EditableRemoteRepository repo = createRepository("test", "badtest\\name", repoDir);
ValidationResponse<RemoteRepository> result = validator.apply(repo);
assertFalse(result.isValid());
assertEquals(1, result.getResult().size());
assertEquals("invalid_chars", result.getResult().get("name").get(0).getType());
}
Aggregations