Search in sources :

Example 6 with EditableRemoteRepository

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);
    }
}
Also used : 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 7 with EditableRemoteRepository

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);
    }
}
Also used : RemoteRepository(org.apache.archiva.repository.RemoteRepository) EditableRemoteRepository(org.apache.archiva.repository.EditableRemoteRepository) ValidationError(org.apache.archiva.repository.validation.ValidationError) Map(java.util.Map) EditableRemoteRepository(org.apache.archiva.repository.EditableRemoteRepository) Test(org.junit.jupiter.api.Test)

Example 8 with EditableRemoteRepository

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

Example 9 with EditableRemoteRepository

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"));
}
Also used : RemoteRepository(org.apache.archiva.repository.RemoteRepository) EditableRemoteRepository(org.apache.archiva.repository.EditableRemoteRepository) ValidationError(org.apache.archiva.repository.validation.ValidationError) Map(java.util.Map) EditableRemoteRepository(org.apache.archiva.repository.EditableRemoteRepository) Test(org.junit.jupiter.api.Test)

Example 10 with EditableRemoteRepository

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);
    }
}
Also used : RemoteRepository(org.apache.archiva.repository.RemoteRepository) EditableRemoteRepository(org.apache.archiva.repository.EditableRemoteRepository) ValidationError(org.apache.archiva.repository.validation.ValidationError) Map(java.util.Map) 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