Search in sources :

Example 16 with EditableRemoteRepository

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());
}
Also used : Path(java.nio.file.Path) RemoteRepository(org.apache.archiva.repository.RemoteRepository) EditableRemoteRepository(org.apache.archiva.repository.EditableRemoteRepository) EditableRemoteRepository(org.apache.archiva.repository.EditableRemoteRepository) Test(org.junit.jupiter.api.Test)

Example 17 with EditableRemoteRepository

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());
}
Also used : Path(java.nio.file.Path) RemoteRepository(org.apache.archiva.repository.RemoteRepository) EditableRemoteRepository(org.apache.archiva.repository.EditableRemoteRepository) EditableRemoteRepository(org.apache.archiva.repository.EditableRemoteRepository) Test(org.junit.jupiter.api.Test)

Aggregations

EditableRemoteRepository (org.apache.archiva.repository.EditableRemoteRepository)17 RemoteRepository (org.apache.archiva.repository.RemoteRepository)13 Test (org.junit.jupiter.api.Test)11 Path (java.nio.file.Path)7 Map (java.util.Map)3 ValidationError (org.apache.archiva.repository.validation.ValidationError)3 RemoteRepositoryConfiguration (org.apache.archiva.configuration.model.RemoteRepositoryConfiguration)2 RepositoryException (org.apache.archiva.repository.RepositoryException)2 RepositoryProvider (org.apache.archiva.repository.RepositoryProvider)2 RepositoryType (org.apache.archiva.repository.RepositoryType)2 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ReentrantReadWriteLock (java.util.concurrent.locks.ReentrantReadWriteLock)1 RegistryException (org.apache.archiva.components.registry.RegistryException)1 Configuration (org.apache.archiva.configuration.model.Configuration)1 ProxyConnectorConfiguration (org.apache.archiva.configuration.model.ProxyConnectorConfiguration)1 IndeterminateConfigurationException (org.apache.archiva.configuration.provider.IndeterminateConfigurationException)1 IndexCreationFeature (org.apache.archiva.repository.features.IndexCreationFeature)1 RemoteIndexFeature (org.apache.archiva.repository.features.RemoteIndexFeature)1