mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
Replace model object exception with generic ones and migrate guice
This commit is contained in:
@@ -35,17 +35,15 @@ package sonia.scm.repository.spi;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import sonia.scm.repository.BlameLine;
|
||||
import sonia.scm.repository.BlameResult;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -53,15 +51,8 @@ import java.io.IOException;
|
||||
public class SvnBlameCommandTest extends AbstractSvnCommandTestBase
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetBlameResult() throws IOException, RepositoryException
|
||||
public void testGetBlameResult()
|
||||
{
|
||||
BlameCommandRequest request = new BlameCommandRequest();
|
||||
|
||||
@@ -85,17 +76,8 @@ public class SvnBlameCommandTest extends AbstractSvnCommandTestBase
|
||||
assertNull(line.getAuthor().getMail());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetBlameResultWithRevision()
|
||||
throws IOException, RepositoryException
|
||||
{
|
||||
public void testGetBlameResultWithRevision() {
|
||||
BlameCommandRequest request = new BlameCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
|
||||
@@ -36,19 +36,21 @@ package sonia.scm.repository.spi;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import sonia.scm.repository.BrowserResult;
|
||||
import sonia.scm.repository.FileObject;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -56,16 +58,8 @@ import java.util.List;
|
||||
public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testBrowse() throws IOException, RepositoryException
|
||||
{
|
||||
public void testBrowse() throws RevisionNotFoundException {
|
||||
List<FileObject> foList = getRootFromTip(new BrowseCommandRequest());
|
||||
|
||||
FileObject a = getFileObject(foList, "a.txt");
|
||||
@@ -87,11 +81,9 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testBrowseSubDirectory() throws IOException, RepositoryException
|
||||
{
|
||||
public void testBrowseSubDirectory() throws RevisionNotFoundException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setPath("c");
|
||||
@@ -137,16 +129,8 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
checkDate(e.getLastModified());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testDisableLastCommit() throws IOException, RepositoryException
|
||||
{
|
||||
public void testDisableLastCommit() throws RevisionNotFoundException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setDisableLastCommit(true);
|
||||
@@ -160,8 +144,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecursive() throws IOException, RepositoryException
|
||||
{
|
||||
public void testRecursive() throws RevisionNotFoundException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
request.setRecursive(true);
|
||||
BrowserResult result = createCommand().getBrowserResult(request);
|
||||
@@ -220,20 +203,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
private List<FileObject> getRootFromTip(BrowseCommandRequest request)
|
||||
throws IOException, RepositoryException
|
||||
{
|
||||
private List<FileObject> getRootFromTip(BrowseCommandRequest request) throws RevisionNotFoundException {
|
||||
BrowserResult result = createCommand().getBrowserResult(request);
|
||||
|
||||
assertNotNull(result);
|
||||
|
||||
@@ -37,23 +37,22 @@ package sonia.scm.repository.spi;
|
||||
|
||||
import com.google.common.io.ByteSink;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.repository.api.BundleResponse;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -61,15 +60,8 @@ import java.io.IOException;
|
||||
public class SvnBundleCommandTest extends AbstractSvnCommandTestBase
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testBundle() throws IOException, RepositoryException
|
||||
public void testBundle() throws IOException
|
||||
{
|
||||
File file = temp.newFile();
|
||||
ByteSink sink = Files.asByteSink(file);
|
||||
|
||||
@@ -34,7 +34,6 @@ package sonia.scm.repository.spi;
|
||||
|
||||
import org.junit.Test;
|
||||
import sonia.scm.repository.PathNotFoundException;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -48,7 +47,7 @@ import static org.junit.Assert.assertEquals;
|
||||
public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
|
||||
@Test
|
||||
public void testCat() throws IOException, RepositoryException {
|
||||
public void testCat() throws PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
@@ -57,7 +56,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleCat() throws IOException, RepositoryException {
|
||||
public void testSimpleCat() throws PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("c/d.txt");
|
||||
@@ -65,7 +64,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
}
|
||||
|
||||
@Test(expected = PathNotFoundException.class)
|
||||
public void testUnknownFile() throws IOException, RepositoryException {
|
||||
public void testUnknownFile() throws PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("unknown");
|
||||
@@ -75,7 +74,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
}
|
||||
|
||||
@Test(expected = RevisionNotFoundException.class)
|
||||
public void testUnknownRevision() throws IOException, RepositoryException {
|
||||
public void testUnknownRevision() throws PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
@@ -85,7 +84,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleStream() throws IOException, RepositoryException {
|
||||
public void testSimpleStream() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
request.setPath("a.txt");
|
||||
request.setRevision("1");
|
||||
@@ -99,7 +98,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
catResultStream.close();
|
||||
}
|
||||
|
||||
private String execute(CatCommandRequest request) throws IOException, RepositoryException {
|
||||
private String execute(CatCommandRequest request) throws PathNotFoundException, RevisionNotFoundException {
|
||||
String content = null;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
|
||||
@@ -35,18 +35,18 @@ package sonia.scm.repository.spi;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.Modifications;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -54,16 +54,8 @@ import java.io.IOException;
|
||||
public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAll() throws IOException, RepositoryException
|
||||
{
|
||||
public void testGetAll() throws RevisionNotFoundException {
|
||||
ChangesetPagingResult result =
|
||||
createCommand().getChangesets(new LogCommandRequest());
|
||||
|
||||
@@ -72,16 +64,8 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
assertEquals(6, result.getChangesets().size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllByPath() throws IOException, RepositoryException
|
||||
{
|
||||
public void testGetAllByPath() throws RevisionNotFoundException {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
@@ -96,16 +80,8 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
assertEquals("1", result.getChangesets().get(2).getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllWithLimit() throws IOException, RepositoryException
|
||||
{
|
||||
public void testGetAllWithLimit() throws RevisionNotFoundException {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setPagingLimit(2);
|
||||
@@ -127,16 +103,8 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
assertEquals("4", c2.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllWithPaging() throws IOException, RepositoryException
|
||||
{
|
||||
public void testGetAllWithPaging() throws RevisionNotFoundException {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setPagingStart(1);
|
||||
@@ -159,16 +127,8 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
assertEquals("3", c2.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetCommit() throws IOException, RepositoryException
|
||||
{
|
||||
public void testGetCommit() throws RevisionNotFoundException {
|
||||
Changeset c = createCommand().getChangeset("3");
|
||||
|
||||
assertNotNull(c);
|
||||
@@ -188,16 +148,8 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
assertEquals("b.txt", mods.getRemoved().get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetRange() throws IOException, RepositoryException
|
||||
{
|
||||
public void testGetRange() throws RevisionNotFoundException {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setStartChangeset("2");
|
||||
|
||||
@@ -34,26 +34,22 @@ package sonia.scm.repository.spi;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.tmatesoft.svn.core.SVNException;
|
||||
import org.tmatesoft.svn.core.io.SVNRepository;
|
||||
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
|
||||
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.repository.SvnUtil;
|
||||
import sonia.scm.repository.api.UnbundleResponse;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -61,17 +57,9 @@ import java.io.IOException;
|
||||
public class SvnUnbundleCommandTest extends AbstractSvnCommandTestBase
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
* @throws SVNException
|
||||
*/
|
||||
@Test
|
||||
public void testUnbundle()
|
||||
throws IOException, RepositoryException, SVNException
|
||||
throws IOException, SVNException
|
||||
{
|
||||
File bundle = bundle();
|
||||
SvnContext ctx = createEmptyContext();
|
||||
@@ -95,16 +83,7 @@ public class SvnUnbundleCommandTest extends AbstractSvnCommandTestBase
|
||||
SvnUtil.closeSession(repo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
private File bundle() throws IOException, RepositoryException
|
||||
private File bundle() throws IOException
|
||||
{
|
||||
File file = tempFolder.newFile();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user