summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-04-15 08:18:02 -0400
committerJames Moger <james.moger@gitblit.com>2013-04-15 08:18:02 -0400
commit843c42bafae020e2e0e6d49befc6db960f61c66c (patch)
tree0d765db364e389dea0bcad47f04dcdc2a59bd47b /src/test
parent47dc64a5d4b10edf2ef418d3e4b428a33420a2a2 (diff)
downloadgitblit-843c42bafae020e2e0e6d49befc6db960f61c66c.tar.gz
gitblit-843c42bafae020e2e0e6d49befc6db960f61c66c.zip
Completed migration to JGit 3.0.0-SNAPSHOT
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/gitblit/tests/GitBlitSuite.java22
-rw-r--r--src/test/java/com/gitblit/tests/GitServletTest.java5
-rw-r--r--src/test/java/com/gitblit/tests/PushLogTest.java8
3 files changed, 23 insertions, 12 deletions
diff --git a/src/test/java/com/gitblit/tests/GitBlitSuite.java b/src/test/java/com/gitblit/tests/GitBlitSuite.java
index 0b8437a6..82552ec1 100644
--- a/src/test/java/com/gitblit/tests/GitBlitSuite.java
+++ b/src/test/java/com/gitblit/tests/GitBlitSuite.java
@@ -25,7 +25,7 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryCache;
import org.eclipse.jgit.lib.RepositoryCache.FileKey;
-import org.eclipse.jgit.internal.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.util.FS;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -78,32 +78,38 @@ public class GitBlitSuite {
private static AtomicBoolean started = new AtomicBoolean(false);
public static Repository getHelloworldRepository() throws Exception {
- return new FileRepository(new File(REPOSITORIES, "helloworld.git"));
+ return getRepository("helloworld.git");
}
public static Repository getTicgitRepository() throws Exception {
- return new FileRepository(new File(REPOSITORIES, "ticgit.git"));
+ return getRepository("ticgit.git");
}
public static Repository getJGitRepository() throws Exception {
- return new FileRepository(new File(REPOSITORIES, "test/jgit.git"));
+ return getRepository("test/jgit.git");
}
public static Repository getAmbitionRepository() throws Exception {
- return new FileRepository(new File(REPOSITORIES, "test/ambition.git"));
+ return getRepository("test/ambition.git");
}
public static Repository getTheoreticalPhysicsRepository() throws Exception {
- return new FileRepository(new File(REPOSITORIES, "test/theoretical-physics.git"));
+ return getRepository("test/theoretical-physics.git");
}
public static Repository getIssuesTestRepository() throws Exception {
JGitUtils.createRepository(REPOSITORIES, "gb-issues.git").close();
- return new FileRepository(new File(REPOSITORIES, "gb-issues.git"));
+ return getRepository("gb-issues.git");
}
public static Repository getGitectiveRepository() throws Exception {
- return new FileRepository(new File(REPOSITORIES, "test/gitective.git"));
+ return getRepository("test/gitective.git");
+ }
+
+ private static Repository getRepository(String name) throws Exception {
+ File gitDir = FileKey.resolve(new File(REPOSITORIES, name), FS.DETECTED);
+ Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
+ return repository;
}
public static boolean startGitblit() throws Exception {
diff --git a/src/test/java/com/gitblit/tests/GitServletTest.java b/src/test/java/com/gitblit/tests/GitServletTest.java
index 6f1d600d..c1aaf1a3 100644
--- a/src/test/java/com/gitblit/tests/GitServletTest.java
+++ b/src/test/java/com/gitblit/tests/GitServletTest.java
@@ -19,8 +19,9 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.ResetCommand.ResetType;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.jgit.internal.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.CredentialsProvider;
import org.eclipse.jgit.transport.PushResult;
import org.eclipse.jgit.transport.RefSpec;
@@ -786,7 +787,7 @@ public class GitServletTest {
public void testPushLog() throws IOException {
String name = "refchecks/ticgit.git";
File refChecks = new File(GitBlitSuite.REPOSITORIES, name);
- FileRepository repository = new FileRepository(refChecks);
+ Repository repository = new FileRepositoryBuilder().setGitDir(refChecks).build();
List<PushLogEntry> pushes = PushLogUtils.getPushLog(name, repository);
GitBlitSuite.close(repository);
assertTrue("Repository has an empty push log!", pushes.size() > 0);
diff --git a/src/test/java/com/gitblit/tests/PushLogTest.java b/src/test/java/com/gitblit/tests/PushLogTest.java
index 0e01344e..0f46b53b 100644
--- a/src/test/java/com/gitblit/tests/PushLogTest.java
+++ b/src/test/java/com/gitblit/tests/PushLogTest.java
@@ -19,7 +19,10 @@ import java.io.File;
import java.io.IOException;
import java.util.List;
-import org.eclipse.jgit.internal.storage.file.FileRepository;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.RepositoryCache.FileKey;
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
+import org.eclipse.jgit.util.FS;
import org.junit.Test;
import com.gitblit.models.PushLogEntry;
@@ -30,7 +33,8 @@ public class PushLogTest {
@Test
public void testPushLog() throws IOException {
String name = "~james/helloworld.git";
- FileRepository repository = new FileRepository(new File(GitBlitSuite.REPOSITORIES, name));
+ File gitDir = FileKey.resolve(new File(GitBlitSuite.REPOSITORIES, name), FS.DETECTED);
+ Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
List<PushLogEntry> pushes = PushLogUtils.getPushLog(name, repository);
GitBlitSuite.close(repository);
}