use of org.apache.archiva.repository.validation.ValidationError in project archiva by apache.
the class ManagedRepositoryHandlerTest method validateRepositoryIfExisting.
@Test
void validateRepositoryIfExisting() throws IOException, RepositoryException {
final String id = "test-repo-11";
try {
ManagedRepositoryHandler repoHandler = createHandler();
EditableManagedRepository repository = createRepository(id, "n-" + id);
repoHandler.put(repository);
CheckedResult<ManagedRepository, Map<String, List<ValidationError>>> result = repoHandler.validateRepository(repository);
assertNotNull(result);
assertEquals(1, result.getResult().size());
} finally {
removeRepositoryFromConfig(id);
}
}
use of org.apache.archiva.repository.validation.ValidationError in project archiva by apache.
the class RepositoryGroupHandlerTest method validateRepositoryForUpdate.
@Test
void validateRepositoryForUpdate() throws IOException, RepositoryException {
final String id = "test-group-12";
try {
RepositoryGroupHandler groupHandler = createHandler();
EditableRepositoryGroup repositoryGroup = createRepository(id, "n-" + id);
repositoryGroup.setMergedIndexTTL(5);
groupHandler.put(repositoryGroup);
CheckedResult<RepositoryGroup, Map<String, List<ValidationError>>> result = groupHandler.validateRepositoryForUpdate(repositoryGroup);
assertNotNull(result);
assertEquals(0, result.getResult().size());
} finally {
removeGroupFromConfig(id);
}
}
use of org.apache.archiva.repository.validation.ValidationError in project archiva by apache.
the class RepositoryGroupHandlerTest method putWithCheck_invalid.
@Test
void putWithCheck_invalid() throws RepositoryException {
final String id = "test-group-07";
final String name = "n-" + id;
try {
RepositoryGroupHandler groupHandler = createHandler();
BasicRepositoryGroupValidator checker = new BasicRepositoryGroupValidator(configurationHandler);
RepositoryGroupConfiguration configuration = new RepositoryGroupConfiguration();
configuration.setId("");
configuration.setName(name);
ArrayList<String> repos = new ArrayList<>();
repos.add("internal");
configuration.setRepositories(repos);
CheckedResult<RepositoryGroup, Map<String, List<ValidationError>>> result = groupHandler.putWithCheck(configuration, checker);
assertNull(groupHandler.get(id));
assertNotNull(result.getResult());
assertNotNull(result.getResult().get("id"));
assertEquals(1, result.getResult().get("id").size());
assertEquals(ISEMPTY, result.getResult().get("id").get(0).getType());
assertFalse(hasGroupInConfig(id));
assertFalse(hasGroupInConfig(""));
} finally {
removeGroupFromConfig(id);
}
}
use of org.apache.archiva.repository.validation.ValidationError in project archiva by apache.
the class ManagedRepositoryHandlerTest method validateRepositoryForUpdate.
@Test
void validateRepositoryForUpdate() throws IOException, RepositoryException {
final String id = "test-repo-12";
try {
ManagedRepositoryHandler repoHandler = createHandler();
EditableManagedRepository repository = createRepository(id, "n-" + id);
repoHandler.put(repository);
CheckedResult<ManagedRepository, Map<String, List<ValidationError>>> result = repoHandler.validateRepositoryForUpdate(repository);
assertNotNull(result);
assertEquals(0, result.getResult().size());
} finally {
removeRepositoryFromConfig(id);
}
}
use of org.apache.archiva.repository.validation.ValidationError in project archiva by apache.
the class RemoteRepositoryHandlerTest method validateRepositoryForUpdate.
@Test
void validateRepositoryForUpdate() throws IOException, RepositoryException {
final String id = "test-repo-12";
try {
RemoteRepositoryHandler repoHandler = createHandler();
EditableRemoteRepository repository = createRepository(id, "n-" + id);
repoHandler.put(repository);
CheckedResult<RemoteRepository, Map<String, List<ValidationError>>> result = repoHandler.validateRepositoryForUpdate(repository);
assertNotNull(result);
assertEquals(0, result.getResult().size());
} finally {
removeRepositoryFromConfig(id);
}
}
Aggregations