summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2013-03-21 03:52:33 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2013-03-21 03:52:33 -0400
commit9aee4e0a26bc394a3d4871320526c37344841ee2 (patch)
treed7a21c7aec4dca8554b3a465c923b9ab4e07f7db /org.eclipse.jgit.test/tst
parenta31920555f075c028f087b2e174293e1f11d714d (diff)
parent38cac0acf3c67d8006121e84b39f7028cf91ffe9 (diff)
downloadjgit-9aee4e0a26bc394a3d4871320526c37344841ee2.tar.gz
jgit-9aee4e0a26bc394a3d4871320526c37344841ee2.zip
Merge changes If98b0b97,I7c9c09b4
* changes: Add convenience factory method for most used builder pattern Don't use internal type FileRepository in public API
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java7
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RepositorySetupWorkDirTest.java14
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java23
3 files changed, 24 insertions, 20 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java
index 2c811671d8..46c4af3973 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java
@@ -55,6 +55,7 @@ import java.io.IOException;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.util.FileUtils;
@@ -126,7 +127,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
builder.setWorkTree(dir);
builder.setMustExist(true);
- FileRepository repo2 = builder.build();
+ Repository repo2 = builder.build();
assertEquals(repo1.getDirectory(), repo2.getDirectory());
assertEquals(dir, repo2.getWorkTree());
@@ -145,7 +146,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
FileRepositoryBuilder builder = new FileRepositoryBuilder();
builder.setWorkTree(dir);
builder.setMustExist(true);
- FileRepository repo2 = builder.build();
+ Repository repo2 = builder.build();
assertEquals(repo1.getDirectory(), repo2.getDirectory());
assertEquals(dir, repo2.getWorkTree());
@@ -165,7 +166,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase {
builder.findGitDir(dir);
assertEquals(repo1.getDirectory(), builder.getGitDir());
builder.setMustExist(true);
- FileRepository repo2 = builder.build();
+ Repository repo2 = builder.build();
assertEquals(repo1.getDirectory(), repo2.getDirectory());
assertEquals(dir, repo2.getWorkTree());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RepositorySetupWorkDirTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RepositorySetupWorkDirTest.java
index 20896001ca..bc47782ea0 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RepositorySetupWorkDirTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RepositorySetupWorkDirTest.java
@@ -97,7 +97,8 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase {
@Test
public void testNotBare_CreateRepositoryFromWorkDirOnly() throws Exception {
File workdir = getFile("workdir", "repo");
- FileRepository repo = new FileRepositoryBuilder().setWorkTree(workdir).build();
+ Repository repo = new FileRepositoryBuilder().setWorkTree(workdir)
+ .build();
assertFalse(repo.isBare());
assertWorkdirPath(repo, "workdir", "repo");
assertGitdirPath(repo, "workdir", "repo", Constants.DOT_GIT);
@@ -107,7 +108,8 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase {
public void testWorkdirIsDotGit_CreateRepositoryFromWorkDirOnly()
throws Exception {
File workdir = getFile("workdir", "repo");
- FileRepository repo = new FileRepositoryBuilder().setWorkTree(workdir).build();
+ Repository repo = new FileRepositoryBuilder().setWorkTree(workdir)
+ .build();
assertGitdirPath(repo, "workdir", "repo", Constants.DOT_GIT);
}
@@ -117,7 +119,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase {
File gitDir = getFile("workdir", "repoWithConfig");
File workTree = getFile("workdir", "treeRoot");
setWorkTree(gitDir, workTree);
- FileRepository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
+ Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
assertFalse(repo.isBare());
assertWorkdirPath(repo, "workdir", "treeRoot");
assertGitdirPath(repo, "workdir", "repoWithConfig");
@@ -128,7 +130,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase {
throws Exception {
File gitDir = getFile("workdir", "repoWithConfig");
setBare(gitDir, true);
- FileRepository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
+ Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
assertTrue(repo.isBare());
}
@@ -137,7 +139,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase {
throws Exception {
File gitDir = getFile("workdir", "repoWithBareConfigTrue", "child");
setBare(gitDir, false);
- FileRepository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
+ Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
assertWorkdirPath(repo, "workdir", "repoWithBareConfigTrue");
}
@@ -146,7 +148,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase {
throws Exception {
File gitDir = getFile("workdir", "repoWithBareConfigFalse", "child");
setBare(gitDir, false);
- FileRepository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
+ Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
assertFalse(repo.isBare());
assertWorkdirPath(repo, "workdir", "repoWithBareConfigFalse");
assertGitdirPath(repo, "workdir", "repoWithBareConfigFalse", "child");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
index a4de35ee97..921ec29d53 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
@@ -140,8 +140,8 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder().setGitDir(theDir)
- .build();
+ FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).build();
assertEqualsPath(theDir, r.getDirectory());
assertEqualsPath(repo1Parent, r.getWorkTree());
assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
@@ -165,8 +165,9 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder().setGitDir(theDir)
- .setWorkTree(repo1Parent.getParentFile()).build();
+ FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).setWorkTree(repo1Parent.getParentFile())
+ .build();
assertEqualsPath(theDir, r.getDirectory());
assertEqualsPath(repo1Parent.getParentFile(), r.getWorkTree());
assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
@@ -189,8 +190,8 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder().setWorkTree(repo1Parent)
- .build();
+ FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setWorkTree(repo1Parent).build();
assertEqualsPath(theDir, r.getDirectory());
assertEqualsPath(repo1Parent, r.getWorkTree());
assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
@@ -218,8 +219,8 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder().setGitDir(theDir)
- .build();
+ FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).build();
assertEqualsPath(theDir, r.getDirectory());
assertEqualsPath(workdir, r.getWorkTree());
assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
@@ -247,8 +248,8 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder().setGitDir(theDir)
- .build();
+ FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).build();
assertEqualsPath(theDir, r.getDirectory());
assertEqualsPath(workdir, r.getWorkTree());
assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
@@ -275,7 +276,7 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
repo1initial.close();
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = new FileRepositoryBuilder() //
+ FileRepository r = (FileRepository) new FileRepositoryBuilder() //
.setGitDir(theDir).setObjectDirectory(objDir) //
.addAlternateObjectDirectory(altObjDir) //
.setIndexFile(indexFile) //