Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.egit.core.test/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java16
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/T0003_AdaptableFileTreeIteratorTest.java8
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_HistoryTest.java (renamed from org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_history.java)31
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/T0001_ConnectProviderOperationTest.java11
5 files changed, 48 insertions, 24 deletions
diff --git a/org.eclipse.egit.core.test/META-INF/MANIFEST.MF b/org.eclipse.egit.core.test/META-INF/MANIFEST.MF
index 196c2b104..b4338c1c4 100644
--- a/org.eclipse.egit.core.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.core.test/META-INF/MANIFEST.MF
@@ -10,10 +10,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.team.core;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.jdt.launching;bundle-version="[3.4.0,4.0.0)"
+ org.eclipse.jdt.launching;bundle-version="[3.4.0,4.0.0)",
+ org.junit4;bundle-version="[4.3.0,5.0.0)"
Bundle-ActivationPolicy: lazy
-Import-Package: junit.framework;version="[4.3.1,5.0.0)",
- org.eclipse.egit.core;version="[0.6.0,0.7.0)",
+Import-Package: org.eclipse.egit.core;version="[0.6.0,0.7.0)",
org.eclipse.egit.core.op;version="[0.6.0,0.7.0)",
org.eclipse.egit.core.project;version="[0.6.0,0.7.0)",
org.eclipse.jgit.junit;version="[0.6.0,0.7.0)",
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 46c3b1ba5..d53b35fcd 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
@@ -10,22 +10,22 @@ package org.eclipse.egit.core.test;
import java.io.File;
import java.io.IOException;
-import org.eclipse.jgit.lib.Constants;
-
-import junit.framework.TestCase;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jgit.junit.MockSystemReader;
+import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.util.SystemReader;
+import org.junit.After;
+import org.junit.Before;
-public abstract class GitTestCase extends TestCase {
+public abstract class GitTestCase {
protected TestProject project;
protected File gitDir;
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
((MockSystemReader) SystemReader.getInstance()).setProperty(
Constants.GIT_CEILING_DIRECTORIES_KEY, ResourcesPlugin
.getWorkspace().getRoot().getLocation().toFile()
@@ -36,8 +36,8 @@ public abstract class GitTestCase extends TestCase {
rmrf(gitDir);
}
- protected void tearDown() throws Exception {
- super.tearDown();
+ @After
+ public void tearDown() throws Exception {
project.dispose();
rmrf(gitDir);
}
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/T0003_AdaptableFileTreeIteratorTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/T0003_AdaptableFileTreeIteratorTest.java
index f401b6d96..954ca8ece 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/T0003_AdaptableFileTreeIteratorTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/T0003_AdaptableFileTreeIteratorTest.java
@@ -8,6 +8,8 @@
*******************************************************************************/
package org.eclipse.egit.core.test;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -24,6 +26,8 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.treewalk.WorkingTreeIterator;
import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
+import org.junit.Before;
+import org.junit.Test;
public class T0003_AdaptableFileTreeIteratorTest extends GitTestCase {
@@ -33,7 +37,8 @@ public class T0003_AdaptableFileTreeIteratorTest extends GitTestCase {
private File file;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
repository = new Repository(gitDir);
@@ -50,6 +55,7 @@ public class T0003_AdaptableFileTreeIteratorTest extends GitTestCase {
operation.run(null);
}
+ @Test
public void testFileTreeToContainerAdaptation() throws IOException {
final IWorkspaceRoot root = project.getProject().getWorkspace()
.getRoot();
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_history.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_HistoryTest.java
index 2c748ab25..a20ae5883 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_history.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/T0002_HistoryTest.java
@@ -9,6 +9,10 @@
*******************************************************************************/
package org.eclipse.egit.core.test.internal.mapping;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -19,10 +23,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.egit.core.GitProvider;
import org.eclipse.egit.core.op.ConnectProviderOperation;
import org.eclipse.egit.core.test.GitTestCase;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.history.IFileHistory;
-import org.eclipse.team.core.history.IFileHistoryProvider;
-import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.jgit.lib.Commit;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileTreeEntry;
@@ -32,8 +32,14 @@ import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.Tree;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.history.IFileHistory;
+import org.eclipse.team.core.history.IFileHistoryProvider;
+import org.eclipse.team.core.history.IFileRevision;
+import org.junit.Before;
+import org.junit.Test;
-public class T0002_history extends GitTestCase {
+public class T0002_HistoryTest extends GitTestCase {
protected static final PersonIdent jauthor;
@@ -50,8 +56,10 @@ public class T0002_history extends GitTestCase {
private Tree tree;
private ObjectWriter objectWriter;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
+
project.createSourceFolder();
gitDir = new File(project.getProject().getWorkspace().getRoot()
.getRawLocation().toFile(), Constants.DOT_GIT);
@@ -119,6 +127,7 @@ public class T0002_history extends GitTestCase {
return f;
}
+ @Test
public void testSingleRevision_1() {
GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
@@ -127,9 +136,9 @@ public class T0002_history extends GitTestCase {
IFileRevision fileRevision = fileHistory.getFileRevision("60f0d7917fe2aed5c92b5bc35dfb55b9b8ada359");
assertEquals("60f0d7917fe2aed5c92b5bc35dfb55b9b8ada359", fileRevision.getContentIdentifier());
assertEquals("J. Author",fileRevision.getAuthor());
-
}
+ @Test
public void testSingleRevision_2() {
GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
@@ -139,6 +148,7 @@ public class T0002_history extends GitTestCase {
assertNull(fileRevision); // not matched by getFileHistoryFor
}
+ @Test
public void testSingleRevision_3() {
GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
@@ -147,9 +157,9 @@ public class T0002_history extends GitTestCase {
IFileRevision fileRevision = fileHistory.getFileRevision("fd5a571c8a3a4a152e4c413d09d3ecb7d41e1e5f");
assertEquals("fd5a571c8a3a4a152e4c413d09d3ecb7d41e1e5f", fileRevision.getContentIdentifier());
assertEquals("J. Author",fileRevision.getAuthor());
-
}
+ @Test
public void testShallowHistory() {
GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
@@ -159,9 +169,9 @@ public class T0002_history extends GitTestCase {
assertEquals(1, fileRevisions.length);
assertEquals("60f0d7917fe2aed5c92b5bc35dfb55b9b8ada359", fileRevisions[0].getContentIdentifier());
assertEquals("J. Author",fileRevisions[0].getAuthor());
-
}
+ @Test
public void testDeepHistory_A() {
GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
@@ -171,9 +181,9 @@ public class T0002_history extends GitTestCase {
assertEquals(1, fileRevisions.length);
assertEquals("60f0d7917fe2aed5c92b5bc35dfb55b9b8ada359", fileRevisions[0].getContentIdentifier());
assertEquals("J. Author",fileRevisions[0].getAuthor());
-
}
+ @Test
public void testDeepHistory_B() {
GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
@@ -185,6 +195,5 @@ public class T0002_history extends GitTestCase {
assertEquals("J. Author",fileRevisions[0].getAuthor());
assertEquals("60f0d7917fe2aed5c92b5bc35dfb55b9b8ada359", fileRevisions[1].getContentIdentifier());
assertEquals("J. Author",fileRevisions[0].getAuthor());
-
}
}
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/T0001_ConnectProviderOperationTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/T0001_ConnectProviderOperationTest.java
index 593a5246e..38c84b59b 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/T0001_ConnectProviderOperationTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/T0001_ConnectProviderOperationTest.java
@@ -9,6 +9,11 @@
*******************************************************************************/
package org.eclipse.egit.core.test.op;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
@@ -22,7 +27,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.core.op.ConnectProviderOperation;
import org.eclipse.egit.core.test.GitTestCase;
-import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.jgit.lib.Commit;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileTreeEntry;
@@ -32,9 +36,12 @@ import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.Tree;
+import org.eclipse.team.core.RepositoryProvider;
+import org.junit.Test;
public class T0001_ConnectProviderOperationTest extends GitTestCase {
+ @Test
public void testNoRepository() throws CoreException {
ConnectProviderOperation operation = new ConnectProviderOperation(
@@ -45,6 +52,7 @@ public class T0001_ConnectProviderOperationTest extends GitTestCase {
assertTrue(!gitDir.exists());
}
+ @Test
public void testNewRepository() throws CoreException, IOException {
File gitDir = new File(project.getProject().getWorkspace().getRoot()
@@ -61,6 +69,7 @@ public class T0001_ConnectProviderOperationTest extends GitTestCase {
assertTrue(gitDir.exists());
}
+ @Test
public void testNewUnsharedFile() throws CoreException, IOException,
InterruptedException {

Back to the top