mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
merge
This commit is contained in:
@@ -36,7 +36,6 @@ package sonia.scm.repository.spi;
|
||||
import org.junit.Test;
|
||||
import sonia.scm.repository.BrowserResult;
|
||||
import sonia.scm.repository.FileObject;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
@@ -55,7 +54,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
{
|
||||
|
||||
@Test
|
||||
public void testBrowseWithFilePath() throws RevisionNotFoundException {
|
||||
public void testBrowseWithFilePath() {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
request.setPath("a.txt");
|
||||
FileObject file = createCommand().getBrowserResult(request).getFile();
|
||||
@@ -65,7 +64,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBrowse() throws RevisionNotFoundException {
|
||||
public void testBrowse() {
|
||||
Collection<FileObject> foList = getRootFromTip(new BrowseCommandRequest());
|
||||
|
||||
FileObject a = getFileObject(foList, "a.txt");
|
||||
@@ -89,7 +88,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void testBrowseSubDirectory() throws RevisionNotFoundException {
|
||||
public void testBrowseSubDirectory() {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setPath("c");
|
||||
@@ -136,7 +135,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisableLastCommit() throws RevisionNotFoundException {
|
||||
public void testDisableLastCommit() {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setDisableLastCommit(true);
|
||||
@@ -150,7 +149,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecursive() throws RevisionNotFoundException {
|
||||
public void testRecursive() {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
request.setRecursive(true);
|
||||
BrowserResult result = createCommand().getBrowserResult(request);
|
||||
@@ -199,7 +198,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
.orElseThrow(() -> new AssertionError("file " + name + " not found"));
|
||||
}
|
||||
|
||||
private Collection<FileObject> getRootFromTip(BrowseCommandRequest request) throws RevisionNotFoundException {
|
||||
private Collection<FileObject> getRootFromTip(BrowseCommandRequest request) {
|
||||
BrowserResult result = createCommand().getBrowserResult(request);
|
||||
|
||||
assertNotNull(result);
|
||||
|
||||
@@ -32,9 +32,12 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import sonia.scm.repository.PathNotFoundException;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import sonia.scm.NotFoundException;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -46,8 +49,11 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
|
||||
@Rule
|
||||
public final ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void testCat() throws PathNotFoundException, RevisionNotFoundException {
|
||||
public void testCat() {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
@@ -56,35 +62,59 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleCat() throws PathNotFoundException, RevisionNotFoundException {
|
||||
public void testSimpleCat() {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("c/d.txt");
|
||||
assertEquals("d", execute(request));
|
||||
}
|
||||
|
||||
@Test(expected = PathNotFoundException.class)
|
||||
public void testUnknownFile() throws PathNotFoundException, RevisionNotFoundException {
|
||||
@Test
|
||||
public void testUnknownFile() {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("unknown");
|
||||
request.setRevision("1");
|
||||
|
||||
execute(request);
|
||||
}
|
||||
expectedException.expect(new BaseMatcher<Object>() {
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("expected NotFoundException for path");
|
||||
}
|
||||
|
||||
@Test(expected = RevisionNotFoundException.class)
|
||||
public void testUnknownRevision() throws PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
request.setRevision("42");
|
||||
@Override
|
||||
public boolean matches(Object item) {
|
||||
return "Path".equals(((NotFoundException)item).getContext().get(0).getType());
|
||||
}
|
||||
});
|
||||
|
||||
execute(request);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleStream() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
public void testUnknownRevision() {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
request.setRevision("42");
|
||||
|
||||
expectedException.expect(new BaseMatcher<Object>() {
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("expected NotFoundException for revision");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Object item) {
|
||||
return "Revision".equals(((NotFoundException)item).getContext().get(0).getType());
|
||||
}
|
||||
});
|
||||
|
||||
execute(request);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleStream() throws IOException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
request.setPath("a.txt");
|
||||
request.setRevision("1");
|
||||
@@ -98,7 +128,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
catResultStream.close();
|
||||
}
|
||||
|
||||
private String execute(CatCommandRequest request) throws PathNotFoundException, RevisionNotFoundException {
|
||||
private String execute(CatCommandRequest request) {
|
||||
String content = null;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.junit.Test;
|
||||
import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.Modifications;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -57,7 +56,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
{
|
||||
|
||||
@Test
|
||||
public void testGetAll() throws RevisionNotFoundException {
|
||||
public void testGetAll() {
|
||||
ChangesetPagingResult result =
|
||||
createCommand().getChangesets(new LogCommandRequest());
|
||||
|
||||
@@ -67,7 +66,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllByPath() throws RevisionNotFoundException {
|
||||
public void testGetAllByPath() {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
@@ -83,7 +82,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllWithLimit() throws RevisionNotFoundException {
|
||||
public void testGetAllWithLimit() {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setPagingLimit(2);
|
||||
@@ -106,7 +105,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllWithPaging() throws RevisionNotFoundException {
|
||||
public void testGetAllWithPaging() {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setPagingStart(1);
|
||||
@@ -130,7 +129,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommit() throws RevisionNotFoundException, IOException {
|
||||
public void testGetCommit() {
|
||||
Changeset c = createCommand().getChangeset("3");
|
||||
|
||||
assertNotNull(c);
|
||||
@@ -151,7 +150,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRange() throws RevisionNotFoundException {
|
||||
public void testGetRange() {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setStartChangeset("2");
|
||||
|
||||
Reference in New Issue
Block a user