Search in sources :

Example 6 with BasicRemoteRepository

use of org.apache.archiva.repository.base.remote.BasicRemoteRepository in project archiva by apache.

the class RepositoryProviderMock method createRemoteInstance.

@Override
public RemoteRepository createRemoteInstance(RemoteRepositoryConfiguration configuration) throws RepositoryException {
    BasicRemoteRepository remoteRepository = null;
    try {
        remoteRepository = BasicRemoteRepository.newFilesystemInstance(configuration.getId(), configuration.getName(), Paths.get("target/remotes"));
    } catch (IOException e) {
        throw new RepositoryException(e);
    }
    updateRemoteInstance(remoteRepository, configuration);
    return remoteRepository;
}
Also used : BasicRemoteRepository(org.apache.archiva.repository.base.remote.BasicRemoteRepository) IOException(java.io.IOException)

Example 7 with BasicRemoteRepository

use of org.apache.archiva.repository.base.remote.BasicRemoteRepository in project archiva by apache.

the class RepositoryContentConsumersTest method createRemoteRepository.

protected RemoteRepository createRemoteRepository(String id, String name, String url) throws URISyntaxException, IOException {
    BasicRemoteRepository repo = BasicRemoteRepository.newFilesystemInstance(id, name, Paths.get("remotes"));
    repo.setLocation(new URI(url));
    return repo;
}
Also used : BasicRemoteRepository(org.apache.archiva.repository.base.remote.BasicRemoteRepository) URI(java.net.URI)

Example 8 with BasicRemoteRepository

use of org.apache.archiva.repository.base.remote.BasicRemoteRepository in project archiva by apache.

the class ArchivaRepositoryRegistryTest method putRemoteRepository.

@Test
public void putRemoteRepository() throws Exception {
    BasicRemoteRepository remoteRepository = BasicRemoteRepository.newFilesystemInstance("test001", "Test repo", archivaConfiguration.getRemoteRepositoryBaseDir());
    remoteRepository.setDescription(remoteRepository.getPrimaryLocale(), "This is just a test");
    RemoteRepository newRepo = repositoryRegistry.putRepository(remoteRepository);
    assertSame(remoteRepository, newRepo);
    assertNotNull(remoteRepository.getContent());
    assertEquals(6, repositoryRegistry.getRepositories().size());
    remoteRepository = BasicRemoteRepository.newFilesystemInstance("internal", "Test repo", archivaConfiguration.getRemoteRepositoryBaseDir());
    remoteRepository.setDescription(remoteRepository.getPrimaryLocale(), "This is just a test");
    RemoteRepository updatedRepo;
    try {
        updatedRepo = repositoryRegistry.putRepository(remoteRepository);
        assertSame(remoteRepository, updatedRepo);
        throw new RuntimeException("Should throw repository exception, if repository exists already and is not the same type.");
    } catch (RepositoryException e) {
    // OK
    }
    remoteRepository = BasicRemoteRepository.newFilesystemInstance("central", "Test repo", archivaConfiguration.getRemoteRepositoryBaseDir());
    remoteRepository.setDescription(remoteRepository.getPrimaryLocale(), "This is just a test");
    updatedRepo = repositoryRegistry.putRepository(remoteRepository);
    assertSame(updatedRepo, remoteRepository);
    assertNotNull(remoteRepository.getContent());
    assertEquals(6, repositoryRegistry.getRepositories().size());
    RemoteRepository remoteRepository1 = repositoryRegistry.getRemoteRepository("central");
    assertEquals("Test repo", remoteRepository1.getName());
    assertSame(remoteRepository1, remoteRepository);
}
Also used : BasicRemoteRepository(org.apache.archiva.repository.base.remote.BasicRemoteRepository) RemoteRepository(org.apache.archiva.repository.RemoteRepository) BasicRemoteRepository(org.apache.archiva.repository.base.remote.BasicRemoteRepository) RepositoryException(org.apache.archiva.repository.RepositoryException) Test(org.junit.jupiter.api.Test)

Aggregations

BasicRemoteRepository (org.apache.archiva.repository.base.remote.BasicRemoteRepository)8 IOException (java.io.IOException)4 RepositoryException (org.apache.archiva.repository.RepositoryException)4 URI (java.net.URI)2 Path (java.nio.file.Path)1 DefaultFileLockManager (org.apache.archiva.common.filelock.DefaultFileLockManager)1 FileLockManager (org.apache.archiva.common.filelock.FileLockManager)1 RemoteRepository (org.apache.archiva.repository.RemoteRepository)1 FilesystemStorage (org.apache.archiva.repository.storage.fs.FilesystemStorage)1 Test (org.junit.jupiter.api.Test)1