use of org.apache.archiva.repository.EditableRemoteRepository in project archiva by apache.
the class RemoteRepositoryHandlerTest method put.
@Test
void put() throws IOException, RepositoryException {
final String id = "test-repo-04";
try {
RemoteRepositoryHandler repoHandler = createHandler();
EditableRemoteRepository repository = createRepository(id, "n-" + id);
repoHandler.put(repository);
RemoteRepository storedRepository = repoHandler.get(id);
assertNotNull(storedRepository);
assertEquals(id, storedRepository.getId());
assertEquals("n-" + id, storedRepository.getName());
EditableRemoteRepository repository2 = createRepository(id, "n2-" + id);
repoHandler.put(repository2);
storedRepository = repoHandler.get(id);
assertNotNull(storedRepository);
assertEquals(id, storedRepository.getId());
assertEquals("n2-" + id, storedRepository.getName());
assertTrue(hasRepositoryInConfig(id));
} finally {
removeRepositoryFromConfig(id);
}
}
use of org.apache.archiva.repository.EditableRemoteRepository 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);
}
}
use of org.apache.archiva.repository.EditableRemoteRepository in project archiva by apache.
the class RemoteRepositoryHandlerTest method has.
@Test
void has() throws IOException, RepositoryException {
final String id = "test-repo-13";
try {
RemoteRepositoryHandler repoHandler = createHandler();
EditableRemoteRepository repository = createRepository(id, "n-" + id);
assertFalse(repoHandler.hasRepository(id));
repoHandler.put(repository);
assertTrue(repoHandler.hasRepository(id));
} finally {
removeRepositoryFromConfig(id);
}
}
use of org.apache.archiva.repository.EditableRemoteRepository in project archiva by apache.
the class RemoteRepositoryHandlerTest method validateRepository.
@Test
void validateRepository() throws IOException {
final String id = "test-repo-10";
RemoteRepositoryHandler repoHandler = createHandler();
EditableRemoteRepository repository = createRepository(id, "n-" + id);
CheckedResult<RemoteRepository, Map<String, List<ValidationError>>> result = repoHandler.validateRepository(repository);
assertNotNull(result);
assertEquals(0, result.getResult().size());
repository = createRepository(id, "n-test-repo-10###");
result = repoHandler.validateRepository(repository);
assertNotNull(result);
assertEquals(1, result.getResult().size());
assertNotNull(result.getResult().get("name"));
}
use of org.apache.archiva.repository.EditableRemoteRepository in project archiva by apache.
the class RemoteRepositoryHandlerTest method validateRepositoryIfExisting.
@Test
void validateRepositoryIfExisting() throws IOException, RepositoryException {
final String id = "test-repo-11";
try {
RemoteRepositoryHandler repoHandler = createHandler();
EditableRemoteRepository repository = createRepository(id, "n-" + id);
repoHandler.put(repository);
CheckedResult<RemoteRepository, Map<String, List<ValidationError>>> result = repoHandler.validateRepository(repository);
assertNotNull(result);
assertEquals(1, result.getResult().size());
} finally {
removeRepositoryFromConfig(id);
}
}
Aggregations