mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
Adjust to repository storage with id
This commit is contained in:
@@ -106,7 +106,7 @@ public class GitRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase {
|
||||
gitConfig.setRepositoryDirectory(new File("/path"));
|
||||
repositoryHandler.setConfig(gitConfig);
|
||||
|
||||
Repository repository = new Repository("id", "git", "Name");
|
||||
Repository repository = new Repository("id", "git", "Space", "Name");
|
||||
|
||||
File path = repositoryHandler.getDirectory(repository);
|
||||
assertEquals("/path/id", path.getAbsolutePath());
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
package sonia.scm.repository;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GitRepositoryPathMatcher}.
|
||||
@@ -45,18 +47,18 @@ public class GitRepositoryPathMatcherTest {
|
||||
|
||||
@Test
|
||||
public void testIsPathMatching() {
|
||||
assertFalse(pathMatcher.isPathMatching(repository("my-repo"), "my-repoo"));
|
||||
assertFalse(pathMatcher.isPathMatching(repository("my"), "my-repo"));
|
||||
assertFalse(pathMatcher.isPathMatching(repository("my"), "my-repo/with/path"));
|
||||
assertFalse(pathMatcher.isPathMatching(repository("space", "my-repo"), "my-repoo"));
|
||||
assertFalse(pathMatcher.isPathMatching(repository("space", "my"), "my-repo"));
|
||||
assertFalse(pathMatcher.isPathMatching(repository("space", "my"), "my-repo/with/path"));
|
||||
|
||||
assertTrue(pathMatcher.isPathMatching(repository("my-repo"), "my-repo"));
|
||||
assertTrue(pathMatcher.isPathMatching(repository("my-repo"), "my-repo.git"));
|
||||
assertTrue(pathMatcher.isPathMatching(repository("my-repo"), "my-repo/with/path"));
|
||||
assertTrue(pathMatcher.isPathMatching(repository("my-repo"), "my-repo.git/with/path"));
|
||||
assertTrue(pathMatcher.isPathMatching(repository("space", "my-repo"), "my-repo"));
|
||||
assertTrue(pathMatcher.isPathMatching(repository("space", "my-repo"), "my-repo.git"));
|
||||
assertTrue(pathMatcher.isPathMatching(repository("space", "my-repo"), "my-repo/with/path"));
|
||||
assertTrue(pathMatcher.isPathMatching(repository("space", "my-repo"), "my-repo.git/with/path"));
|
||||
}
|
||||
|
||||
private Repository repository(String name) {
|
||||
return new Repository(name, GitRepositoryHandler.TYPE_NAME, name);
|
||||
private Repository repository(String namespace, String name) {
|
||||
return new Repository(name, GitRepositoryHandler.TYPE_NAME, namespace, name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,34 +38,31 @@ package sonia.scm.repository.spi;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.inject.Provider;
|
||||
|
||||
import org.eclipse.jgit.api.CommitCommand;
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.eclipse.jgit.transport.ScmTransportProtocol;
|
||||
import org.eclipse.jgit.transport.Transport;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.GitRepositoryHandler;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.user.User;
|
||||
import sonia.scm.user.UserTestData;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -88,8 +85,8 @@ public class AbstractRemoteCommandTestBase
|
||||
outgoingDirectory = tempFolder.newFile("outgoing");
|
||||
outgoingDirectory.delete();
|
||||
|
||||
incomgingRepository = new Repository("1", "git", "incoming");
|
||||
outgoingRepository = new Repository("2", "git", "outgoing");
|
||||
incomgingRepository = new Repository("1", "git", "space", "incoming");
|
||||
outgoingRepository = new Repository("2", "git", "space", "outgoing");
|
||||
|
||||
incoming = Git.init().setDirectory(incomingDirectory).setBare(false).call();
|
||||
outgoing = Git.init().setDirectory(outgoingDirectory).setBare(false).call();
|
||||
|
||||
@@ -35,14 +35,15 @@ package sonia.scm.web.lfs;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import static org.mockito.Matchers.matches;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.store.BlobStoreFactory;
|
||||
|
||||
import static org.mockito.Matchers.matches;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link LfsBlobStoreFactory}.
|
||||
*
|
||||
@@ -59,7 +60,7 @@ public class LfsBlobStoreFactoryTest {
|
||||
|
||||
@Test
|
||||
public void getBlobStore() throws Exception {
|
||||
lfsBlobStoreFactory.getLfsBlobStore(new Repository("the-id", "GIT", "the-name"));
|
||||
lfsBlobStoreFactory.getLfsBlobStore(new Repository("the-id", "GIT", "space", "the-name"));
|
||||
|
||||
// just make sure the right parameter is passed, as properly validating the return value is nearly impossible with
|
||||
// the return value (and should not be part of this test)
|
||||
|
||||
@@ -7,8 +7,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Created by omilke on 18.05.2017.
|
||||
@@ -18,14 +19,15 @@ public class LfsServletFactoryTest {
|
||||
@Test
|
||||
public void buildBaseUri() throws Exception {
|
||||
|
||||
String repositoryNamespace = "space";
|
||||
String repositoryName = "git-lfs-demo";
|
||||
|
||||
String result = LfsServletFactory.buildBaseUri(new Repository("", "GIT", repositoryName), RequestWithUri(repositoryName, true));
|
||||
String result = LfsServletFactory.buildBaseUri(new Repository("", "GIT", repositoryNamespace, repositoryName), RequestWithUri(repositoryName, true));
|
||||
assertThat(result, is(equalTo("http://localhost:8081/scm/git/git-lfs-demo.git/info/lfs/objects/")));
|
||||
|
||||
|
||||
//result will be with dot-gix suffix, ide
|
||||
result = LfsServletFactory.buildBaseUri(new Repository("", "GIT", repositoryName), RequestWithUri(repositoryName, false));
|
||||
result = LfsServletFactory.buildBaseUri(new Repository("", "GIT", repositoryNamespace, repositoryName), RequestWithUri(repositoryName, false));
|
||||
assertThat(result, is(equalTo("http://localhost:8081/scm/git/git-lfs-demo.git/info/lfs/objects/")));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user