This commit is contained in:
Mohamed Karray
2018-11-15 11:28:33 +01:00
381 changed files with 12331 additions and 11177 deletions

View File

@@ -70,10 +70,10 @@ public class DummyRepositoryHandler
@Override
protected void create(Repository repository, File directory) throws AlreadyExistsException {
protected void create(Repository repository, File directory) {
String key = repository.getNamespace() + "/" + repository.getName();
if (existingRepoNames.contains(key)) {
throw new AlreadyExistsException();
throw new AlreadyExistsException(repository);
} else {
existingRepoNames.add(key);
}

View File

@@ -35,7 +35,6 @@ package sonia.scm.repository;
import org.junit.Test;
import sonia.scm.AbstractTestBase;
import sonia.scm.AlreadyExistsException;
import sonia.scm.store.ConfigurationStoreFactory;
import sonia.scm.store.InMemoryConfigurationStoreFactory;
import sonia.scm.util.IOUtil;
@@ -62,12 +61,12 @@ public abstract class SimpleRepositoryHandlerTestBase extends AbstractTestBase {
ConfigurationStoreFactory factory, File directory) throws IOException, RepositoryPathNotFoundException;
@Test
public void testCreate() throws AlreadyExistsException {
public void testCreate() {
createRepository();
}
@Test
public void testCreateResourcePath() throws AlreadyExistsException {
public void testCreateResourcePath() {
Repository repository = createRepository();
String path = handler.createResourcePath(repository);
@@ -77,7 +76,7 @@ public abstract class SimpleRepositoryHandlerTestBase extends AbstractTestBase {
}
@Test
public void testDelete() throws Exception {
public void testDelete() {
Repository repository = createRepository();
handler.delete(repository);
@@ -102,7 +101,7 @@ public abstract class SimpleRepositoryHandlerTestBase extends AbstractTestBase {
}
}
private Repository createRepository() throws AlreadyExistsException {
private Repository createRepository() {
Repository repository = RepositoryTestData.createHeartOfGold();
handler.create(repository);

View File

@@ -39,12 +39,10 @@ import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.junit.Test;
import sonia.scm.AlreadyExistsException;
import sonia.scm.ConcurrentModificationException;
import sonia.scm.Manager;
import sonia.scm.ManagerTestBase;
import sonia.scm.NotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -63,7 +61,7 @@ public abstract class UserManagerTestBase extends ManagerTestBase<User> {
public static final int THREAD_COUNT = 10;
@Test
public void testCreate() throws AlreadyExistsException {
public void testCreate() {
User zaphod = UserTestData.createZaphod();
manager.create(zaphod);
@@ -75,7 +73,7 @@ public abstract class UserManagerTestBase extends ManagerTestBase<User> {
}
@Test(expected = AlreadyExistsException.class)
public void testCreateExisting() throws AlreadyExistsException {
public void testCreateExisting() {
User zaphod = UserTestData.createZaphod();
manager.create(zaphod);
@@ -87,7 +85,7 @@ public abstract class UserManagerTestBase extends ManagerTestBase<User> {
}
@Test
public void testDelete() throws Exception {
public void testDelete() {
User zaphod = UserTestData.createZaphod();
manager.create(zaphod);
@@ -97,12 +95,12 @@ public abstract class UserManagerTestBase extends ManagerTestBase<User> {
}
@Test(expected = NotFoundException.class)
public void testDeleteNotFound() throws Exception {
public void testDeleteNotFound() {
manager.delete(UserTestData.createDent());
}
@Test
public void testGet() throws AlreadyExistsException {
public void testGet() {
User zaphod = UserTestData.createZaphod();
manager.create(zaphod);
@@ -116,7 +114,7 @@ public abstract class UserManagerTestBase extends ManagerTestBase<User> {
}
@Test
public void testGetAll() throws AlreadyExistsException {
public void testGetAll() {
User zaphod = UserTestData.createZaphod();
manager.create(zaphod);
@@ -181,7 +179,7 @@ public abstract class UserManagerTestBase extends ManagerTestBase<User> {
}
@Test
public void testModify() throws AlreadyExistsException, NotFoundException, ConcurrentModificationException {
public void testModify() {
User zaphod = UserTestData.createZaphod();
manager.create(zaphod);
@@ -238,7 +236,7 @@ public abstract class UserManagerTestBase extends ManagerTestBase<User> {
}
@Test
public void testRefresh() throws AlreadyExistsException, NotFoundException {
public void testRefresh() {
User zaphod = UserTestData.createZaphod();
manager.create(zaphod);
@@ -289,7 +287,7 @@ public abstract class UserManagerTestBase extends ManagerTestBase<User> {
finished = true;
}
private User createUser() throws AlreadyExistsException {
private User createUser() {
String id = UUID.randomUUID().toString();
User user = new User(id, id.concat(" displayName"),
id.concat("@mail.com"));
@@ -299,7 +297,7 @@ public abstract class UserManagerTestBase extends ManagerTestBase<User> {
return user;
}
private void modifyAndDeleteUser(User user) throws IOException, NotFoundException, ConcurrentModificationException {
private void modifyAndDeleteUser(User user) {
String name = user.getName();
String nd = name.concat(" new displayname");