use of org.apache.archiva.rest.api.services.RemoteRepositoriesService in project archiva by apache.
the class RemoteRepositoriesServiceTest method listRemoteRepositoriesKarma.
@Test
public void listRemoteRepositoriesKarma() throws Exception {
RemoteRepositoriesService service = getRemoteRepositoriesService();
WebClient.client(service).header("Authorization", authorizationHeader);
WebClient.getConfig(service).getHttpConduit().getClient().setReceiveTimeout(300000);
List<RemoteRepository> repos = service.getRemoteRepositories();
assertFalse(repos.isEmpty());
log.info("repos {}", repos);
}
use of org.apache.archiva.rest.api.services.RemoteRepositoriesService in project archiva by apache.
the class RemoteRepositoriesServiceTest method checkRemoteConnectivity2.
/*
* Check maven repository
*/
@Test
public void checkRemoteConnectivity2() throws Exception {
RemoteRepositoriesService service = getRemoteRepositoriesService();
WebClient.client(service).header("Authorization", authorizationHeader);
int initialSize = service.getRemoteRepositories().size();
service.addRemoteRepository(getRemoteMavenRepository());
assertTrue(service.checkRemoteConnectivity("id-maven1"));
}
use of org.apache.archiva.rest.api.services.RemoteRepositoriesService in project archiva by apache.
the class RemoteRepositoriesServiceTest method checkRemoteConnectivity3.
/*
* Check oracle repository that allows not browsing (MRM-1933)
*/
@Test
public void checkRemoteConnectivity3() throws Exception {
RemoteRepositoriesService service = getRemoteRepositoriesService();
WebClient.client(service).header("Authorization", authorizationHeader);
WebClient.client(service).accept("application/json");
int initialSize = service.getRemoteRepositories().size();
service.addRemoteRepository(getRemoteOracleRepository());
assertTrue(service.checkRemoteConnectivity("id-oracle"));
}
use of org.apache.archiva.rest.api.services.RemoteRepositoriesService in project archiva by apache.
the class RemoteRepositoriesServiceTest method addAndDeleteRemoteRepository.
@Test
public void addAndDeleteRemoteRepository() throws Exception {
RemoteRepositoriesService service = getRemoteRepositoriesService();
WebClient.client(service).header("Authorization", authorizationHeader);
int initialSize = service.getRemoteRepositories().size();
service.addRemoteRepository(getRemoteRepository());
assertNotNull(service.getRemoteRepository("id-new"));
assertEquals(getRemoteRepository().getName(), service.getRemoteRepository("id-new").getName());
assertEquals(getRemoteRepository().getUrl(), service.getRemoteRepository("id-new").getUrl());
assertEquals(getRemoteRepository().getLayout(), service.getRemoteRepository("id-new").getLayout());
assertEquals(getRemoteRepository().getUserName(), service.getRemoteRepository("id-new").getUserName());
assertEquals(getRemoteRepository().getPassword(), service.getRemoteRepository("id-new").getPassword());
assertEquals(getRemoteRepository().getTimeout(), service.getRemoteRepository("id-new").getTimeout());
assertEquals(getRemoteRepository().getDescription(), service.getRemoteRepository("id-new").getDescription());
assertEquals(initialSize + 1, service.getRemoteRepositories().size());
service.deleteRemoteRepository("id-new");
assertNull(service.getRemoteRepository("id-new"));
assertEquals(initialSize, service.getRemoteRepositories().size());
}
use of org.apache.archiva.rest.api.services.RemoteRepositoriesService in project archiva by apache.
the class RemoteRepositoryConnectivityCheckTest method checkRemoteConnectivity.
@Test
public void checkRemoteConnectivity() throws Exception {
Server repoServer = buildStaticServer(Paths.get(System.getProperty("basedir"), "src/test/repositories/test-repo"));
ServerConnector serverConnector = new ServerConnector(repoServer, new HttpConnectionFactory());
repoServer.addConnector(serverConnector);
repoServer.start();
RemoteRepositoriesService service = getRemoteRepositoriesService();
WebClient.client(service).header("Authorization", authorizationHeader);
try {
int repoServerPort = serverConnector.getLocalPort();
RemoteRepository repo = getRemoteRepository();
repo.setUrl("http://localhost:" + repoServerPort);
service.addRemoteRepository(repo);
assertThat(service.checkRemoteConnectivity(repo.getId())).isTrue();
} finally {
service.deleteRemoteRepository("id-new");
repoServer.stop();
}
}
Aggregations