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