Search in sources :

Example 11 with ManagedRepositoriesService

use of org.apache.archiva.rest.api.services.ManagedRepositoriesService in project archiva by apache.

the class ManagedRepositoriesServiceTest method updateManagedRepo.

@Test
public void updateManagedRepo() throws Exception {
    ManagedRepositoriesService service = getManagedRepositoriesService(authorizationHeader);
    ManagedRepository repo = getTestManagedRepository();
    if (service.getManagedRepository(repo.getId()) != null) {
        service.deleteManagedRepository(repo.getId(), true);
        assertNull(service.getManagedRepository(repo.getId()));
    }
    service.addManagedRepository(repo);
    RepositoriesService repositoriesService = getRepositoriesService(authorizationHeader);
    int timeout = 20000;
    while (timeout > 0 && repositoriesService.alreadyScanning(repo.getId())) {
        Thread.sleep(500);
        timeout -= 500;
    }
    repo = service.getManagedRepository(repo.getId());
    assertNotNull(repo);
    assertEquals("test", repo.getName());
    // toto is foo in French :-)
    repo.setName("toto");
    service.updateManagedRepository(repo);
    repo = service.getManagedRepository(repo.getId());
    assertNotNull(repo);
    assertEquals("toto", repo.getName());
    timeout = 20000;
    while (timeout > 0 && repositoriesService.alreadyScanning(repo.getId())) {
        Thread.sleep(500);
        timeout -= 500;
    }
    service.deleteManagedRepository(repo.getId(), true);
    assertNull(service.getManagedRepository(repo.getId()));
}
Also used : ManagedRepository(org.apache.archiva.admin.model.beans.ManagedRepository) ManagedRepositoriesService(org.apache.archiva.rest.api.services.ManagedRepositoriesService) RepositoriesService(org.apache.archiva.rest.api.services.RepositoriesService) ManagedRepositoriesService(org.apache.archiva.rest.api.services.ManagedRepositoriesService) Test(org.junit.Test)

Example 12 with ManagedRepositoriesService

use of org.apache.archiva.rest.api.services.ManagedRepositoriesService in project archiva by apache.

the class RepositoriesServiceTest method scanRepo.

@Test
public void scanRepo() throws Exception {
    RepositoriesService service = getRepositoriesService(authorizationHeader);
    ManagedRepositoriesService managedRepositoriesService = getManagedRepositoriesService(authorizationHeader);
    String repoId = managedRepositoriesService.getManagedRepositories().get(0).getId();
    int timeout = 20000;
    while (timeout > 0 && service.alreadyScanning(repoId)) {
        Thread.sleep(500);
        timeout -= 500;
    }
    assertTrue(service.scanRepository(repoId, true));
}
Also used : ManagedRepositoriesService(org.apache.archiva.rest.api.services.ManagedRepositoriesService) RepositoriesService(org.apache.archiva.rest.api.services.RepositoriesService) ManagedRepositoriesService(org.apache.archiva.rest.api.services.ManagedRepositoriesService) Test(org.junit.Test)

Aggregations

ManagedRepositoriesService (org.apache.archiva.rest.api.services.ManagedRepositoriesService)12 ManagedRepository (org.apache.archiva.admin.model.beans.ManagedRepository)8 Test (org.junit.Test)8 RepositoriesService (org.apache.archiva.rest.api.services.RepositoriesService)7 Path (java.nio.file.Path)6 RepositoryGroup (org.apache.archiva.admin.model.beans.RepositoryGroup)3 RepositoryGroupService (org.apache.archiva.rest.api.services.RepositoryGroupService)3 ProxyConnector (org.apache.archiva.admin.model.beans.ProxyConnector)2 RemoteRepository (org.apache.archiva.admin.model.beans.RemoteRepository)2 Artifact (org.apache.archiva.maven2.model.Artifact)2 SearchRequest (org.apache.archiva.rest.api.model.SearchRequest)2 ProxyConnectorService (org.apache.archiva.rest.api.services.ProxyConnectorService)2 SearchService (org.apache.archiva.rest.api.services.SearchService)2 JacksonJaxbJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider)1 Date (java.util.Date)1 ZipEntry (java.util.zip.ZipEntry)1 ZipFile (java.util.zip.ZipFile)1 RoleManagementService (org.apache.archiva.redback.rest.api.services.RoleManagementService)1 ArchivaRepositoryStatistics (org.apache.archiva.rest.api.model.ArchivaRepositoryStatistics)1 HttpWagon (org.apache.maven.wagon.providers.http.HttpWagon)1