Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Kinzler2010-07-09 08:19:47 -0400
committerMathias Kinzler2010-07-09 08:19:47 -0400
commitb3963f10ccecd694f9fb6cf3a92d3c6973968997 (patch)
tree094fcfb2524f8c28262a350a8cbcd0033327a8ca /org.eclipse.egit.core.test
parent8ce3c63648968c67d064e7c266aad98e2f7c58f7 (diff)
downloadegit-b3963f10ccecd694f9fb6cf3a92d3c6973968997.tar.gz
egit-b3963f10ccecd694f9fb6cf3a92d3c6973968997.tar.xz
egit-b3963f10ccecd694f9fb6cf3a92d3c6973968997.zip
Remove some deprecated JGit API from CoreTests
Bug: 319152 Change-Id: Icb91f6f8fe6d385d4d6577f1cfe3568f32595cd1 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Diffstat (limited to 'org.eclipse.egit.core.test')
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/storage/BlobStorageTest.java4
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java8
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java23
3 files changed, 18 insertions, 17 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/storage/BlobStorageTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/storage/BlobStorageTest.java
index ae612b683..7b59fb3fe 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/storage/BlobStorageTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/internal/storage/BlobStorageTest.java
@@ -61,14 +61,13 @@ public class BlobStorageTest extends GitTestCase {
@Test
public void testFailWrongType() throws Exception {
- createEmptyTree(repository);
BlobStorage blobStorage = new BlobStorage(repository, "file", ObjectId.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904"));
assertEquals("file", blobStorage.getName());
try {
blobStorage.getContents();
fail("We should not be able to read this blob");
} catch (CoreException e) {
- assertEquals("IO error reading Git blob 4b825dc642cb6eb9a060e54bf8d69288fbee4904 with path file", e.getMessage());
+ assertEquals("Git blob 4b825dc642cb6eb9a060e54bf8d69288fbee4904 with path file not found", e.getMessage());
}
}
@@ -76,7 +75,6 @@ public class BlobStorageTest extends GitTestCase {
public void testFailCorrupt() throws Exception {
try {
createFileCorruptShort(repository, project.getProject(), "file", "data");
- createEmptyTree(repository);
BlobStorage blobStorage = new BlobStorage(repository, "file", ObjectId.fromString("6320cd248dd8aeaab759d5871f8781b5c0505172"));
assertEquals("file", blobStorage.getName());
blobStorage.getContents();
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
index 50a421cb7..ac971b273 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
@@ -20,7 +20,6 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectWriter;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.lib.Tree;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.SystemReader;
import org.junit.After;
@@ -74,11 +73,4 @@ public abstract class GitTestCase {
fileOutputStream.close();
return id;
}
-
- protected ObjectId createEmptyTree(Repository repository) throws IOException {
- ObjectWriter objectWriter = new ObjectWriter(repository);
- Tree tree = new Tree(repository);
- return objectWriter.writeTree(tree);
- }
-
}
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java
index 7abc2c9dd..e6ae24e64 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java
@@ -23,6 +23,7 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Tag;
+import org.eclipse.jgit.revwalk.RevWalk;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -76,15 +77,19 @@ public class TagOperationTest extends DualRepositoryTestCase {
@Test
public void addTag() throws Exception {
- assertTrue("Tags should be empty", repository1.getRepository().getTags().isEmpty());
+ assertTrue("Tags should be empty", repository1.getRepository()
+ .getTags().isEmpty());
Tag newTag = new Tag(repository1.getRepository());
newTag.setTag("TheNewTag");
newTag.setMessage("Well, I'm the tag");
newTag.setAuthor(new PersonIdent(TestUtils.AUTHOR));
- newTag.setObjId(repository1.getRepository().resolve("refs/heads/master"));
- TagOperation top = new TagOperation(repository1.getRepository(), newTag, false);
+ newTag.setObjId(repository1.getRepository()
+ .resolve("refs/heads/master"));
+ TagOperation top = new TagOperation(repository1.getRepository(),
+ newTag, false);
top.execute(new NullProgressMonitor());
- assertFalse("Tags should not be empty", repository1.getRepository().getTags().isEmpty());
+ assertFalse("Tags should not be empty", repository1.getRepository()
+ .getTags().isEmpty());
try {
top.execute(null);
@@ -101,12 +106,18 @@ public class TagOperationTest extends DualRepositoryTestCase {
// expected
}
Ref tagRef = repository1.getRepository().getTags().get("TheNewTag");
- Tag tag = repository1.getRepository().mapTag(tagRef.getName());
+ RevWalk walk = new RevWalk(repository1.getRepository());
+ Tag tag = walk.parseTag(
+ repository1.getRepository().resolve(tagRef.getName())).asTag(
+ walk);
+
newTag.setMessage("Another message");
assertFalse("Messages should differ", tag.getMessage().equals(
newTag.getMessage()));
top.execute(null);
- tag = repository1.getRepository().mapTag(tagRef.getName());
+ tag = walk.parseTag(
+ repository1.getRepository().resolve(tagRef.getName())).asTag(
+ walk);
assertTrue("Messages be same", tag.getMessage().equals(
newTag.getMessage()));
}

Back to the top