mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 06:55:47 +01:00
Replace model object exception with generic ones and migrate guice
This commit is contained in:
@@ -35,17 +35,16 @@ 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.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
import sonia.scm.repository.GitConstants;
|
||||
|
||||
import java.io.IOException;
|
||||
import sonia.scm.repository.GitConstants;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GitBlameCommand}.
|
||||
@@ -59,10 +58,10 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
|
||||
* Tests blame command with default branch.
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
* @
|
||||
*/
|
||||
@Test
|
||||
public void testDefaultBranch() throws IOException, RepositoryException {
|
||||
public void testDefaultBranch() throws IOException {
|
||||
// without default branch, the repository head should be used
|
||||
BlameCommandRequest request = new BlameCommandRequest();
|
||||
request.setPath("a.txt");
|
||||
@@ -89,7 +88,7 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetBlameResult() throws IOException, RepositoryException
|
||||
public void testGetBlameResult() throws IOException
|
||||
{
|
||||
BlameCommandRequest request = new BlameCommandRequest();
|
||||
|
||||
@@ -124,7 +123,7 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
|
||||
*/
|
||||
@Test
|
||||
public void testGetBlameResultWithRevision()
|
||||
throws IOException, RepositoryException
|
||||
throws IOException
|
||||
{
|
||||
BlameCommandRequest request = new BlameCommandRequest();
|
||||
|
||||
|
||||
@@ -36,19 +36,20 @@ 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.GitConstants;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.List;
|
||||
import sonia.scm.repository.GitConstants;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GitBrowseCommand}.
|
||||
@@ -60,12 +61,9 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
|
||||
|
||||
/**
|
||||
* Test browse command with default branch.
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testDefaultBranch() throws IOException, RepositoryException {
|
||||
public void testDefaultBranch() throws IOException, RevisionNotFoundException {
|
||||
// without default branch, the repository head should be used
|
||||
BrowserResult result = createCommand().getBrowserResult(new BrowseCommandRequest());
|
||||
assertNotNull(result);
|
||||
@@ -94,16 +92,8 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
|
||||
assertEquals("c", foList.get(1).getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testBrowse() throws IOException, RepositoryException
|
||||
{
|
||||
public void testBrowse() throws IOException, RevisionNotFoundException {
|
||||
BrowserResult result =
|
||||
createCommand().getBrowserResult(new BrowseCommandRequest());
|
||||
|
||||
@@ -143,16 +133,8 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
|
||||
assertEquals("c", c.getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testBrowseSubDirectory() throws IOException, RepositoryException
|
||||
{
|
||||
public void testBrowseSubDirectory() throws IOException, RevisionNotFoundException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setPath("c");
|
||||
@@ -198,16 +180,8 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase
|
||||
checkDate(e.getLastModified());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testRecusive() throws IOException, RepositoryException
|
||||
{
|
||||
public void testRecusive() throws IOException, RevisionNotFoundException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setRecursive(true);
|
||||
|
||||
@@ -35,7 +35,6 @@ package sonia.scm.repository.spi;
|
||||
import org.junit.Test;
|
||||
import sonia.scm.repository.GitConstants;
|
||||
import sonia.scm.repository.PathNotFoundException;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -54,7 +53,7 @@ import static org.junit.Assert.assertEquals;
|
||||
public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
|
||||
@Test
|
||||
public void testDefaultBranch() throws IOException, RepositoryException {
|
||||
public void testDefaultBranch() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
// without default branch, the repository head should be used
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
request.setPath("a.txt");
|
||||
@@ -67,7 +66,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCat() throws IOException, RepositoryException {
|
||||
public void testCat() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
@@ -76,7 +75,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleCat() throws IOException, RepositoryException {
|
||||
public void testSimpleCat() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("b.txt");
|
||||
@@ -84,7 +83,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test(expected = PathNotFoundException.class)
|
||||
public void testUnknownFile() throws IOException, RepositoryException {
|
||||
public void testUnknownFile() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("unknown");
|
||||
@@ -92,7 +91,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test(expected = RevisionNotFoundException.class)
|
||||
public void testUnknownRevision() throws IOException, RepositoryException {
|
||||
public void testUnknownRevision() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setRevision("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
@@ -101,7 +100,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleStream() throws IOException, RepositoryException {
|
||||
public void testSimpleStream() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
request.setPath("b.txt");
|
||||
|
||||
@@ -114,7 +113,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
catResultStream.close();
|
||||
}
|
||||
|
||||
private String execute(CatCommandRequest request) throws IOException, RepositoryException {
|
||||
private String execute(CatCommandRequest request) throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
String content = null;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
|
||||
@@ -36,18 +36,16 @@ package sonia.scm.repository.spi;
|
||||
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -67,7 +65,7 @@ public class GitIncomingCommandTest
|
||||
*/
|
||||
@Test
|
||||
public void testGetIncomingChangesets()
|
||||
throws IOException, GitAPIException, RepositoryException
|
||||
throws IOException, GitAPIException
|
||||
{
|
||||
write(outgoing, outgoingDirectory, "a.txt", "content of a.txt");
|
||||
|
||||
@@ -101,7 +99,7 @@ public class GitIncomingCommandTest
|
||||
*/
|
||||
@Test
|
||||
public void testGetIncomingChangesetsWithAllreadyPullChangesets()
|
||||
throws IOException, GitAPIException, RepositoryException
|
||||
throws IOException, GitAPIException
|
||||
{
|
||||
write(outgoing, outgoingDirectory, "a.txt", "content of a.txt");
|
||||
|
||||
@@ -138,7 +136,7 @@ public class GitIncomingCommandTest
|
||||
*/
|
||||
@Test
|
||||
public void testGetIncomingChangesetsWithEmptyRepository()
|
||||
throws IOException, RepositoryException
|
||||
throws IOException
|
||||
{
|
||||
GitIncomingCommand cmd = createCommand();
|
||||
IncomingCommandRequest request = new IncomingCommandRequest();
|
||||
@@ -163,7 +161,7 @@ public class GitIncomingCommandTest
|
||||
@Test
|
||||
@Ignore
|
||||
public void testGetIncomingChangesetsWithUnrelatedRepository()
|
||||
throws IOException, RepositoryException, GitAPIException
|
||||
throws IOException, GitAPIException
|
||||
{
|
||||
write(outgoing, outgoingDirectory, "a.txt", "content of a.txt");
|
||||
|
||||
|
||||
@@ -35,22 +35,23 @@ package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.junit.Test;
|
||||
|
||||
import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.GitConstants;
|
||||
import sonia.scm.repository.Modifications;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import sonia.scm.repository.GitConstants;
|
||||
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GitLogCommand}.
|
||||
@@ -65,10 +66,10 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws GitAPIException
|
||||
* @throws RepositoryException
|
||||
* @
|
||||
*/
|
||||
@Test
|
||||
public void testGetDefaultBranch() throws IOException, GitAPIException, RepositoryException {
|
||||
public void testGetDefaultBranch() throws IOException, GitAPIException {
|
||||
// without default branch, the repository head should be used
|
||||
ChangesetPagingResult result = createCommand().getChangesets(new LogCommandRequest());
|
||||
|
||||
@@ -99,7 +100,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAll() throws IOException, RepositoryException
|
||||
public void testGetAll() throws IOException
|
||||
{
|
||||
ChangesetPagingResult result =
|
||||
createCommand().getChangesets(new LogCommandRequest());
|
||||
@@ -117,7 +118,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllByPath() throws IOException, RepositoryException
|
||||
public void testGetAllByPath() throws IOException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -140,7 +141,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllWithLimit() throws IOException, RepositoryException
|
||||
public void testGetAllWithLimit() throws IOException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -171,7 +172,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetAllWithPaging() throws IOException, RepositoryException
|
||||
public void testGetAllWithPaging() throws IOException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -231,7 +232,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetRange() throws IOException, RepositoryException
|
||||
public void testGetRange() throws IOException
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
|
||||
@@ -37,19 +37,16 @@ package sonia.scm.repository.spi;
|
||||
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link OutgoingCommand}.
|
||||
*
|
||||
@@ -68,7 +65,7 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
*/
|
||||
@Test
|
||||
public void testGetOutgoingChangesets()
|
||||
throws IOException, GitAPIException, RepositoryException
|
||||
throws IOException, GitAPIException
|
||||
{
|
||||
write(outgoing, outgoingDirectory, "a.txt", "content of a.txt");
|
||||
|
||||
@@ -102,7 +99,7 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
*/
|
||||
@Test
|
||||
public void testGetOutgoingChangesetsWithAllreadyPushedChanges()
|
||||
throws IOException, GitAPIException, RepositoryException
|
||||
throws IOException, GitAPIException
|
||||
{
|
||||
write(outgoing, outgoingDirectory, "a.txt", "content of a.txt");
|
||||
|
||||
@@ -142,7 +139,7 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
*/
|
||||
@Test
|
||||
public void testGetOutgoingChangesetsWithEmptyRepository()
|
||||
throws IOException, RepositoryException
|
||||
throws IOException
|
||||
{
|
||||
GitOutgoingCommand cmd = createCommand();
|
||||
OutgoingCommandRequest request = new OutgoingCommandRequest();
|
||||
|
||||
@@ -37,20 +37,17 @@ package sonia.scm.repository.spi;
|
||||
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.repository.api.PushResponse;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -68,7 +65,7 @@ public class GitPushCommandTest extends AbstractRemoteCommandTestBase
|
||||
*/
|
||||
@Test
|
||||
public void testPush()
|
||||
throws IOException, GitAPIException, RepositoryException
|
||||
throws IOException, GitAPIException
|
||||
{
|
||||
write(outgoing, outgoingDirectory, "a.txt", "content of a.txt");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user