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;
}
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;
}
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);
}
Aggregations