From 526b6266a5afa1de67a1667230fc4ebea331dab5 Mon Sep 17 00:00:00 2001 From: Robin Rosenberg Date: Tue, 16 Apr 2013 00:05:41 +0200 Subject: Remove some unnecessary dependencies on FileRepostory Change-Id: Ib6ee3a2874a7e2240aa68f4ac32d00c4d1fab5ae Signed-off-by: Chris Aniszczyk --- .../tst/org/eclipse/jgit/api/PullCommandTest.java | 3 +-- .../jgit/api/PullCommandWithRebaseTest.java | 3 +-- .../internal/storage/file/AbbreviationTest.java | 5 +++-- .../storage/file/FileRepositoryBuilderTest.java | 22 +++++++++++----------- .../eclipse/jgit/internal/storage/file/GCTest.java | 7 ------- .../jgit/internal/storage/file/PackFileTest.java | 7 ++++--- .../eclipse/jgit/submodule/SubmoduleWalkTest.java | 5 ++--- .../org/eclipse/jgit/transport/TransportTest.java | 4 ++-- .../treewalk/filter/InterIndexDiffFilterTest.java | 6 +++--- 9 files changed, 27 insertions(+), 35 deletions(-) (limited to 'org.eclipse.jgit.test') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java index ac7584949b..8d22a1b58a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java @@ -56,7 +56,6 @@ import java.io.IOException; import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; import org.eclipse.jgit.api.MergeResult.MergeStatus; import org.eclipse.jgit.api.errors.NoHeadException; -import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; @@ -74,7 +73,7 @@ import org.junit.Test; public class PullCommandTest extends RepositoryTestCase { /** Second Test repository */ - protected FileRepository dbTarget; + protected Repository dbTarget; private Git source; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java index 51ebf72bfd..993e16f5e9 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java @@ -57,7 +57,6 @@ import java.io.IOException; import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode; import org.eclipse.jgit.api.MergeResult.MergeStatus; import org.eclipse.jgit.api.RebaseResult.Status; -import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.ConfigConstants; import org.eclipse.jgit.lib.Constants; @@ -76,7 +75,7 @@ import org.junit.Test; public class PullCommandWithRebaseTest extends RepositoryTestCase { /** Second Test repository */ - protected FileRepository dbTarget; + protected Repository dbTarget; private Git source; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java index dd43dbba82..3a0b827b3f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java @@ -68,6 +68,7 @@ import org.eclipse.jgit.junit.TestRepository; import org.eclipse.jgit.lib.AbbreviatedObjectId; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectReader; +import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevBlob; import org.eclipse.jgit.transport.PackedObjectInfo; import org.eclipse.jgit.util.FileUtils; @@ -81,14 +82,14 @@ public class AbbreviationTest extends LocalDiskRepositoryTestCase { private ObjectReader reader; - private TestRepository test; + private TestRepository test; @Before public void setUp() throws Exception { super.setUp(); db = createBareRepository(); reader = db.newObjectReader(); - test = new TestRepository(db); + test = new TestRepository(db); } @After 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 46c4af3973..0655415a9d 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 @@ -56,7 +56,7 @@ 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.lib.StoredConfig; import org.eclipse.jgit.storage.file.FileRepositoryBuilder; import org.eclipse.jgit.util.FileUtils; import org.junit.Test; @@ -64,7 +64,7 @@ import org.junit.Test; public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase { @Test public void testShouldAutomagicallyDetectGitDirectory() throws Exception { - FileRepository r = createWorkRepository(); + Repository r = createWorkRepository(); File d = new File(r.getDirectory(), "sub-dir"); FileUtils.mkdir(d); @@ -74,8 +74,8 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase { @Test public void emptyRepositoryFormatVersion() throws Exception { - FileRepository r = createWorkRepository(); - FileBasedConfig config = r.getConfig(); + Repository r = createWorkRepository(); + StoredConfig config = r.getConfig(); config.setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, ""); config.save(); @@ -85,8 +85,8 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase { @Test public void invalidRepositoryFormatVersion() throws Exception { - FileRepository r = createWorkRepository(); - FileBasedConfig config = r.getConfig(); + Repository r = createWorkRepository(); + StoredConfig config = r.getConfig(); config.setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "notanumber"); config.save(); @@ -101,8 +101,8 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase { @Test public void unknownRepositoryFormatVersion() throws Exception { - FileRepository r = createWorkRepository(); - FileBasedConfig config = r.getConfig(); + Repository r = createWorkRepository(); + StoredConfig config = r.getConfig(); config.setLong(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 1); config.save(); @@ -118,7 +118,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase { @SuppressWarnings("resource" /* java 7 */) @Test public void absoluteGitDirRef() throws Exception { - FileRepository repo1 = createWorkRepository(); + Repository repo1 = createWorkRepository(); File dir = createTempDirectory("dir"); File dotGit = new File(dir, Constants.DOT_GIT); new FileWriter(dotGit).append( @@ -136,7 +136,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase { @SuppressWarnings("resource" /* java 7 */) @Test public void relativeGitDirRef() throws Exception { - FileRepository repo1 = createWorkRepository(); + Repository repo1 = createWorkRepository(); File dir = new File(repo1.getWorkTree(), "dir"); assertTrue(dir.mkdir()); File dotGit = new File(dir, Constants.DOT_GIT); @@ -155,7 +155,7 @@ public class FileRepositoryBuilderTest extends LocalDiskRepositoryTestCase { @SuppressWarnings("resource" /* java 7 */) @Test public void scanWithGitDirRef() throws Exception { - FileRepository repo1 = createWorkRepository(); + Repository repo1 = createWorkRepository(); File dir = createTempDirectory("dir"); File dotGit = new File(dir, Constants.DOT_GIT); new FileWriter(dotGit).append( diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GCTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GCTest.java index d5c8f12ef6..9d2a03b097 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GCTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GCTest.java @@ -64,13 +64,6 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.internal.JGitText; -import org.eclipse.jgit.internal.storage.file.FileRepository; -import org.eclipse.jgit.internal.storage.file.GC; -import org.eclipse.jgit.internal.storage.file.LockFile; -import org.eclipse.jgit.internal.storage.file.PackFile; -import org.eclipse.jgit.internal.storage.file.PackIndex; -import org.eclipse.jgit.internal.storage.file.RefDirectory; -import org.eclipse.jgit.internal.storage.file.RefDirectoryUpdate; import org.eclipse.jgit.internal.storage.file.GC.RepoStatistics; import org.eclipse.jgit.internal.storage.file.PackIndex.MutableEntry; import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java index 64941995de..ced4575f20 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java @@ -71,6 +71,7 @@ import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectInserter; import org.eclipse.jgit.lib.ObjectLoader; import org.eclipse.jgit.lib.ObjectStream; +import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevBlob; import org.eclipse.jgit.storage.file.WindowCacheConfig; import org.eclipse.jgit.transport.PackParser; @@ -86,9 +87,9 @@ public class PackFileTest extends LocalDiskRepositoryTestCase { private TestRng rng; - private FileRepository repo; + private Repository repo; - private TestRepository tr; + private TestRepository tr; private WindowCursor wc; @@ -107,7 +108,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase { WindowCache.reconfigure(cfg); repo = createBareRepository(); - tr = new TestRepository(repo); + tr = new TestRepository(repo); wc = (WindowCursor) repo.newObjectReader(); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java index 7712097203..f44f67f845 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java @@ -61,7 +61,6 @@ import org.eclipse.jgit.dircache.DirCacheEditor; import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit; import org.eclipse.jgit.dircache.DirCacheEntry; import org.eclipse.jgit.errors.ConfigInvalidException; -import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.junit.TestRepository; import org.eclipse.jgit.lib.Config; @@ -81,12 +80,12 @@ import org.junit.Test; * Unit tests of {@link SubmoduleWalk} */ public class SubmoduleWalkTest extends RepositoryTestCase { - private TestRepository testDb; + private TestRepository testDb; @Before public void setUp() throws Exception { super.setUp(); - testDb = new TestRepository(db); + testDb = new TestRepository(db); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java index c6b3ba624e..aba4e6a8f8 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java @@ -55,10 +55,10 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.junit.SampleDataRepositoryTestCase; import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.Repository; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -216,7 +216,7 @@ public class TransportTest extends SampleDataRepositoryTestCase { @Test public void testLocalTransportWithRelativePath() throws Exception { - FileRepository other = createWorkRepository(); + Repository other = createWorkRepository(); String otherDir = other.getWorkTree().getName(); RemoteConfig config = new RemoteConfig(db.getConfig(), "other"); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/InterIndexDiffFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/InterIndexDiffFilterTest.java index f74c44cfe7..b3aa0ee686 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/InterIndexDiffFilterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/InterIndexDiffFilterTest.java @@ -50,21 +50,21 @@ import java.io.IOException; import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.dircache.DirCacheEditor; +import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit; import org.eclipse.jgit.dircache.DirCacheEntry; import org.eclipse.jgit.dircache.DirCacheIterator; -import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit; -import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.treewalk.TreeWalk; import org.junit.Before; import org.junit.Test; public class InterIndexDiffFilterTest extends LocalDiskRepositoryTestCase { - private FileRepository db; + private Repository db; @Before public void setUp() throws Exception { -- cgit v1.2.3