Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2013-10-19 23:53:56 +0000
committerMatthias Sohn2013-10-22 13:38:17 +0000
commitfed21849f6a0fc2003a30bc036cefbbdf428a8cb (patch)
tree7adbfbfb4309e6b5664dd40b6b36d54e845becb9 /org.eclipse.egit.ui.test/src/org
parent448b9ac17151d750e0389b41c20f6800fc568406 (diff)
downloadegit-fed21849f6a0fc2003a30bc036cefbbdf428a8cb.tar.gz
egit-fed21849f6a0fc2003a30bc036cefbbdf428a8cb.tar.xz
egit-fed21849f6a0fc2003a30bc036cefbbdf428a8cb.zip
Fix UI tests interfering with each other because of shared test setup
The most common cause of unstable UI tests was that the test data (repositories and projects) was set up once per class, and then each test method used the same data. When one test method only reads the data but another modifies it, the test may fail depending on the order of execution. This is an attempt to fix this by changing the test setup so that it's done once per test method (@Before instead of @BeforeClass). To make it easier (and possibly faster) to clean up and reduce the possibility of accidentally sharing the data, the data for each test method is created in a separate directory. Change-Id: I2d7ae4e86c08483a1e8a2824a31648f9d6827bf8 Signed-off-by: Robin Stocker <robin@nibor.org>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java68
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/LinkedResourcesTest.java17
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapterTest.java9
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushBranchWizardTest.java16
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelBlobTest.java5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheFileTest.java9
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTest.java5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTreeTest.java5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCommitTest.java5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelRepositoryTest.java5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelRootTest.java8
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTestCase.java4
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTreeTest.java9
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingFileTest.java5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTreeTest.java5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/operations/GitScopeUtilTest.java18
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchDialogTest.java13
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchQueryTest.java12
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorInputFactoryTest.java12
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorInputTest.java12
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java13
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/DiffStyleRangeFormatterTest.java12
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/RepositoryCommitTest.java13
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java11
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java16
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java24
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitActionTest.java17
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitNonWSChangesTest.java15
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java18
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java15
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/DisconnectConnectTest.java6
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java36
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/MergeToolTest.java7
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java11
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/ReplaceActionsTest.java18
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/ShowInTest.java6
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/TagActionTest.java18
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java16
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java17
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java16
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java10
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java24
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java17
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestBase.java140
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java9
45 files changed, 226 insertions, 521 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
index 3d5d389121..7193f78deb 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LocalRepositoryTestCase.java
@@ -32,7 +32,9 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.GitCorePreferences;
+import org.eclipse.egit.core.JobFamilies;
import org.eclipse.egit.core.RepositoryCache;
+import org.eclipse.egit.core.internal.indexdiff.IndexDiffCache;
import org.eclipse.egit.core.op.AddToIndexOperation;
import org.eclipse.egit.core.op.CloneOperation;
import org.eclipse.egit.core.op.CommitOperation;
@@ -61,7 +63,9 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before;
import org.junit.BeforeClass;
/**
@@ -91,8 +95,8 @@ import org.junit.BeforeClass;
* private File localRepo;
* private File remoteRepo;
* ...
- * {@literal @}BeforeClass
- * public static void initRepos() throws Exception {
+ * {@literal @}Before
+ * public void initRepos() throws Exception {
* localRepo = repositoryFile = createProjectAndCommitToRepository();
* remtoeRepo =remoteRepositoryFile = createRemoteRepository(repositoryFile);
* }
@@ -104,8 +108,10 @@ import org.junit.BeforeClass;
*/
public abstract class LocalRepositoryTestCase extends EGitTestCase {
+ private static int testMethodNumber = 0;
+
// the temporary directory
- private static File testDirectory;
+ private File testDirectory;
protected static final String REPO1 = "FirstRepository";
@@ -127,15 +133,16 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
protected static TestUtils testUtils = new TestUtils();
- public static File getTestDirectory() {
+ public File getTestDirectory() {
return testDirectory;
}
- @BeforeClass
- public static void beforeClassBase() throws Exception {
- deleteAllProjects();
+ @Before
+ public void initNewTestDirectory() throws Exception {
+ testMethodNumber++;
// create standalone temporary directory
- testDirectory = testUtils.createTempDir("LocalRepositoriesTests");
+ testDirectory = testUtils.createTempDir("LocalRepositoriesTests"
+ + testMethodNumber);
if (testDirectory.exists())
FileUtils.delete(testDirectory, FileUtils.RECURSIVE
| FileUtils.RETRY);
@@ -145,15 +152,30 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
File repoRoot = new File(testDirectory, "RepositoryRoot");
if (!repoRoot.exists())
FileUtils.mkdir(repoRoot, true);
+ // make sure the default directory for Repos is not the user home
+ org.eclipse.egit.ui.Activator.getDefault().getPreferenceStore()
+ .setValue(UIPreferences.DEFAULT_REPO_DIR, repoRoot.getPath());
+ }
+
+ @After
+ public void resetWorkspace() throws Exception {
+ // close all editors/dialogs
+ new Eclipse().reset();
+ // cleanup
+ for (IProject project : ResourcesPlugin.getWorkspace().getRoot()
+ .getProjects())
+ project.delete(false, false, null);
+ shutDownRepositories();
+ }
+
+ @BeforeClass
+ public static void beforeClassBase() throws Exception {
// suppress auto-ignoring and auto-sharing to avoid interference
IEclipsePreferences corePrefs = InstanceScope.INSTANCE
.getNode(org.eclipse.egit.core.Activator.getPluginId());
corePrefs.putBoolean(
GitCorePreferences.core_autoIgnoreDerivedResources, false);
corePrefs.putBoolean(GitCorePreferences.core_autoShareProjects, false);
- // make sure the default directory for Repos is not the user home
- org.eclipse.egit.ui.Activator.getDefault().getPreferenceStore()
- .setValue(UIPreferences.DEFAULT_REPO_DIR, repoRoot.getPath());
// suppress the configuration dialog
org.eclipse.egit.ui.Activator.getDefault().getPreferenceStore()
.setValue(UIPreferences.SHOW_INITIAL_CONFIG_DIALOG, false);
@@ -167,13 +189,7 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
@AfterClass
public static void afterClassBase() throws Exception {
- // close all editors/dialogs
- new Eclipse().reset();
- // cleanup
- deleteAllProjects();
- shutDownRepositories();
- FileUtils.delete(testDirectory, FileUtils.RECURSIVE | FileUtils.RETRY);
- Activator.getDefault().getRepositoryCache().clear();
+ testUtils.deleteTempDirs();
}
protected static void shutDownRepositories() {
@@ -197,11 +213,11 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
}
- protected static File createProjectAndCommitToRepository() throws Exception {
+ protected File createProjectAndCommitToRepository() throws Exception {
return createProjectAndCommitToRepository(REPO1);
}
- protected static File createProjectAndCommitToRepository(String repoName)
+ protected File createProjectAndCommitToRepository(String repoName)
throws Exception {
File gitDir = new File(new File(testDirectory, repoName),
@@ -275,10 +291,15 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
createStableBranch(myRepository);
// and check in some stuff into master again
touchAndSubmit(null);
+
+ // Make sure cache entry is already listening for changes
+ IndexDiffCache cache = Activator.getDefault().getIndexDiffCache();
+ cache.getIndexDiffCacheEntry(lookupRepository(gitDir));
+
return gitDir;
}
- protected static File createRemoteRepository(File repositoryDir)
+ protected File createRemoteRepository(File repositoryDir)
throws Exception {
Repository myRepository = lookupRepository(repositoryDir);
File gitDir = new File(testDirectory, REPO2);
@@ -340,7 +361,7 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
return myRemoteRepository.getDirectory();
}
- protected static File createChildRepository(File repositoryDir)
+ protected File createChildRepository(File repositoryDir)
throws Exception {
Repository myRepository = lookupRepository(repositoryDir);
URIish uri = new URIish("file:///" + myRepository.getDirectory());
@@ -452,8 +473,6 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
String message = commitMessage;
if (message == null)
message = newContent;
- // TODO: remove after replacing GitIndex in CommitOperation
- waitInUI();
CommitOperation op = new CommitOperation(commitables,
untracked, TestUtil.TESTAUTHOR, TestUtil.TESTCOMMITTER,
message);
@@ -494,6 +513,7 @@ public abstract class LocalRepositoryTestCase extends EGitTestCase {
file.setContents(
new ByteArrayInputStream(newContent.getBytes(prj
.getDefaultCharset())), 0, null);
+ TestUtil.joinJobs(JobFamilies.INDEX_DIFF_CACHE_UPDATE);
return file;
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/LinkedResourcesTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/LinkedResourcesTest.java
index 0cfac90684..528515ffda 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/LinkedResourcesTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/LinkedResourcesTest.java
@@ -31,26 +31,23 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jgit.util.FileUtils;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class LinkedResourcesTest extends LocalRepositoryTestCase {
// the standalone temporary directory
- private static File standaloneDirectory;
+ private File standaloneDirectory;
private static final String LINKED_FILE = "LinkedFile";
private static final String STANDALONE_FOLDER = "StandaloneFolder";
- private File gitDir;
-
private IProject project;
@Before
public void setUp() throws Exception {
- gitDir = createProjectAndCommitToRepository();
+ createProjectAndCommitToRepository();
project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1);
// create standalone temporary directory
standaloneDirectory = testUtils.createTempDir(STANDALONE_FOLDER);
@@ -61,16 +58,6 @@ public class LinkedResourcesTest extends LocalRepositoryTestCase {
FileUtils.mkdir(standaloneDirectory, true);
}
- @After
- public void tearDown() throws Exception {
- deleteAllProjects();
- shutDownRepositories();
- FileUtils.delete(gitDir.getParentFile(), FileUtils.RECURSIVE
- | FileUtils.RETRY);
- FileUtils.delete(standaloneDirectory, FileUtils.RECURSIVE
- | FileUtils.RETRY);
- }
-
private List<RepositoryActionHandler> getRepositoryActionHandlerList()
throws CoreException {
IExtensionRegistry registry = Platform.getExtensionRegistry();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapterTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapterTest.java
index 2b13f83ea9..551227d1e1 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapterTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapterTest.java
@@ -35,7 +35,6 @@ import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.util.FileUtils;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -78,14 +77,6 @@ public class DecoratableResourceAdapterTest extends LocalRepositoryTestCase {
TestUtil.joinJobs(JobFamilies.INDEX_DIFF_CACHE_UPDATE);
}
- @After
- public void tearDown() throws Exception {
- deleteAllProjects();
- shutDownRepositories();
- FileUtils.delete(gitDir.getParentFile(), FileUtils.RECURSIVE
- | FileUtils.RETRY);
- }
-
@Test
public void testDecorationEmptyProject() throws Exception {
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { new TestDecoratableResource(
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushBranchWizardTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushBranchWizardTest.java
index 42fb11c9d6..7e9bd4bd6c 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushBranchWizardTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushBranchWizardTest.java
@@ -29,9 +29,7 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.URIish;
-import org.eclipse.jgit.util.FileUtils;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -55,20 +53,6 @@ public class PushBranchWizardTest extends LocalRepositoryTestCase {
reposToDelete.add(remoteRepository);
}
- @After
- public void deleteRepositories() throws Exception {
- deleteAllProjects();
- shutDownRepositories();
- for (Repository r : reposToDelete) {
- if (r.isBare())
- FileUtils.delete(r.getDirectory(), FileUtils.RECURSIVE
- | FileUtils.RETRY);
- else
- FileUtils.delete(r.getWorkTree(), FileUtils.RECURSIVE
- | FileUtils.RETRY);
- }
- }
-
@Test
public void pushToExistingRemote() throws Exception {
checkoutNewLocalBranch("foo");
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelBlobTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelBlobTest.java
index 15da12b251..6fd41e8137 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelBlobTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelBlobTest.java
@@ -27,7 +27,7 @@ import org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change;
import org.eclipse.egit.ui.Activator;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.ObjectId;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -250,7 +250,8 @@ public class GitModelBlobTest extends GitModelTestCase {
assertEquals(file.getLocation(), leftLocation);
}
- @BeforeClass public static void setupEnvironment() throws Exception {
+ @Before
+ public void setupEnvironment() throws Exception {
leftRepoFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheFileTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheFileTest.java
index 7d83213345..e9a3d74b51 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheFileTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheFileTest.java
@@ -20,7 +20,7 @@ import org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change;
import org.eclipse.egit.ui.Activator;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.ObjectId;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -54,7 +54,7 @@ public class GitModelCacheFileTest extends GitModelTestCase {
// then
assertTrue(actual);
}
-
+
@Test public void shouldReturnNotEqualForDifferentBaseIds()
throws Exception {
// given
@@ -145,7 +145,8 @@ public class GitModelCacheFileTest extends GitModelTestCase {
assertFalse(actual);
}
- @BeforeClass public static void setupEnvironment() throws Exception {
+ @Before
+ public void setupEnvironment() throws Exception {
leftRepoFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil()
@@ -163,5 +164,5 @@ public class GitModelCacheFileTest extends GitModelTestCase {
return new GitModelCacheFile(createModelCommit(),
lookupRepository(leftRepoFile), change, location);
}
-
+
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTest.java
index 96235ca235..5dce9342e8 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTest.java
@@ -22,7 +22,7 @@ import org.eclipse.egit.core.synchronize.StagedChangeCache;
import org.eclipse.egit.ui.Activator;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
public class GitModelCacheTest extends GitModelTestCase {
@@ -124,7 +124,8 @@ public class GitModelCacheTest extends GitModelTestCase {
assertEquals(4, dirChildren.length);
}
- @BeforeClass public static void setupEnvironment() throws Exception {
+ @Before
+ public void setupEnvironment() throws Exception {
leftRepoFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTreeTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTreeTest.java
index 20f2198e47..79e19e9e56 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTreeTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTreeTest.java
@@ -17,7 +17,7 @@ import org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.synchronize.model.TreeBuilder.FileModelFactory;
import org.eclipse.jgit.lib.Repository;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
public class GitModelCacheTreeTest extends GitModelTestCase {
@@ -71,7 +71,8 @@ public class GitModelCacheTreeTest extends GitModelTestCase {
assertFalse(actual);
}
- @BeforeClass public static void setupEnvironment() throws Exception {
+ @Before
+ public void setupEnvironment() throws Exception {
leftRepoFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCommitTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCommitTest.java
index 4311422dc4..631ff8043b 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCommitTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCommitTest.java
@@ -16,7 +16,7 @@ import static org.mockito.Mockito.mock;
import java.io.File;
import org.eclipse.egit.ui.Activator;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
public class GitModelCommitTest extends GitModelTestCase {
@@ -134,7 +134,8 @@ public class GitModelCommitTest extends GitModelTestCase {
assertFalse(actual);
}
- @BeforeClass public static void setupEnvironment() throws Exception {
+ @Before
+ public void setupEnvironment() throws Exception {
leftRepoFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelRepositoryTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelRepositoryTest.java
index 39a330e576..6c89844b18 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelRepositoryTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelRepositoryTest.java
@@ -13,7 +13,7 @@ import static org.junit.Assert.assertTrue;
import org.eclipse.egit.ui.Activator;
import org.eclipse.jgit.lib.Repository;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
public class GitModelRepositoryTest extends GitModelTestCase {
@@ -58,7 +58,8 @@ public class GitModelRepositoryTest extends GitModelTestCase {
assertTrue(actual);
}
- @BeforeClass public static void setupEnvironment() throws Exception {
+ @Before
+ public void setupEnvironment() throws Exception {
leftRepoFile = createProjectAndCommitToRepository();
rightRepoFile = createChildRepository(leftRepoFile);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelRootTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelRootTest.java
index bf45080909..5d688da5ce 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelRootTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelRootTest.java
@@ -17,15 +17,15 @@ import java.io.File;
import org.eclipse.egit.core.synchronize.dto.GitSynchronizeData;
import org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet;
import org.eclipse.jgit.lib.Repository;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
public class GitModelRootTest extends GitModelTestCase {
private static Repository repo1, repo2;
- @BeforeClass
- public static void setupEnvironment() throws Exception {
+ @Before
+ public void setupEnvironment() throws Exception {
File repoFile = createProjectAndCommitToRepository(REPO1);
repo1 = lookupRepository(repoFile);
@@ -38,7 +38,7 @@ public class GitModelRootTest extends GitModelTestCase {
// given
touchAndSubmit("second commit");
GitSynchronizeDataSet gsds = new GitSynchronizeDataSet();
- gsds.add(new GitSynchronizeData(repo1, HEAD + "~1", HEAD, false));
+ gsds.add(new GitSynchronizeData(repo1, HEAD, HEAD + "^1", false));
gsds.add(new GitSynchronizeData(repo2, HEAD, HEAD, false));
// when
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTestCase.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTestCase.java
index 4b04616bdd..b8abcc1dfb 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTestCase.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTestCase.java
@@ -28,9 +28,9 @@ import org.mockito.Mockito;
abstract class GitModelTestCase extends LocalRepositoryTestCase {
- protected static File leftRepoFile;
+ protected File leftRepoFile;
- protected static File rightRepoFile;
+ protected File rightRepoFile;
protected GitModelRepository createModelRepository() throws Exception {
return new GitModelRepository(getGSD(lookupRepository(leftRepoFile)));
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTreeTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTreeTest.java
index e3f9f86f66..44a8e77397 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTreeTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTreeTest.java
@@ -16,7 +16,7 @@ import static org.mockito.Mockito.mock;
import org.eclipse.core.runtime.IPath;
import org.eclipse.egit.ui.Activator;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
public class GitModelTreeTest extends GitModelTestCase {
@@ -36,10 +36,10 @@ public class GitModelTreeTest extends GitModelTestCase {
// given
GitModelTree left = createModelTree(getTreeLocation());
GitModelTree right = createModelTree(getTreeLocation());
-
+
// when
boolean actual = left.equals(right);
-
+
// then
assertTrue(actual);
}
@@ -96,7 +96,8 @@ public class GitModelTreeTest extends GitModelTestCase {
assertFalse(actual);
}
- @BeforeClass public static void setupEnvironment() throws Exception {
+ @Before
+ public void setupEnvironment() throws Exception {
leftRepoFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingFileTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingFileTest.java
index 3ae13b5344..66413a3ab2 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingFileTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingFileTest.java
@@ -14,7 +14,7 @@ import static org.mockito.Mockito.mock;
import org.eclipse.core.runtime.IPath;
import org.eclipse.egit.ui.Activator;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
public class GitModelWorkingFileTest extends GitModelTestCase {
@@ -81,7 +81,8 @@ public class GitModelWorkingFileTest extends GitModelTestCase {
assertFalse(actual);
}
- @BeforeClass public static void setupEnvironment() throws Exception {
+ @Before
+ public void setupEnvironment() throws Exception {
leftRepoFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTreeTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTreeTest.java
index d45f163b7e..755276b1be 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTreeTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTreeTest.java
@@ -13,7 +13,7 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import org.eclipse.egit.ui.Activator;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
public class GitModelWorkingTreeTest extends GitModelTestCase {
@@ -44,7 +44,8 @@ public class GitModelWorkingTreeTest extends GitModelTestCase {
assertFalse(actual);
}
- @BeforeClass public static void setupEnvironment() throws Exception {
+ @Before
+ public void setupEnvironment() throws Exception {
leftRepoFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/operations/GitScopeUtilTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/operations/GitScopeUtilTest.java
index c6b1a93e08..bcaed2bff9 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/operations/GitScopeUtilTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/operations/GitScopeUtilTest.java
@@ -36,18 +36,15 @@ import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.egit.ui.internal.operations.GitScopeOperation;
import org.eclipse.egit.ui.internal.operations.GitScopeOperationFactory;
import org.eclipse.egit.ui.internal.operations.GitScopeUtil;
-import org.eclipse.egit.ui.test.Eclipse;
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.util.FileUtils;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.team.core.subscribers.SubscriberScopeManager;
import org.eclipse.ui.IWorkbenchPart;
-import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
@@ -86,23 +83,8 @@ public class GitScopeUtilTest extends LocalRepositoryTestCase {
});
}
- @After
- public void tearDown() throws Exception {
- deleteAllProjects();
- shutDownRepositories();
- FileUtils.delete(repositoryFile.getParentFile(), FileUtils.RECURSIVE
- | FileUtils.RETRY);
- }
-
@AfterClass
public static void afterClassBase() throws Exception {
- // close all editors/dialogs
- new Eclipse().reset();
- // cleanup
- IProject modelProject = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(PROJ1);
- modelProject.delete(false, false, null);
-
GitScopeOperationFactory.setFactory(new GitScopeOperationFactory());
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchDialogTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchDialogTest.java
index 5fdc41009e..5ddb45d367 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchDialogTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchDialogTest.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2011 GitHub Inc.
+ * Copyright (c) 2011, 2013 GitHub Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,7 +32,7 @@ import org.eclipse.swtbot.swt.finder.results.Result;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
/**
@@ -41,13 +41,12 @@ import org.junit.Test;
@SuppressWarnings("restriction")
public class CommitSearchDialogTest extends LocalRepositoryTestCase {
- private static Repository repository;
+ private Repository repository;
- private static RevCommit commit;
+ private RevCommit commit;
- @BeforeClass
- public static void setup() throws Exception {
- closeWelcomePage();
+ @Before
+ public void setup() throws Exception {
File repoFile = createProjectAndCommitToRepository();
assertNotNull(repoFile);
repository = Activator.getDefault().getRepositoryCache()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchQueryTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchQueryTest.java
index 5da4e9dd5d..1ff895c153 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchQueryTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchQueryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 GitHub Inc.
+ * Copyright (c) 2011, 2013 GitHub Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,7 +30,7 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.search.ui.ISearchResult;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
/**
@@ -38,12 +38,12 @@ import org.junit.Test;
*/
public class CommitSearchQueryTest extends LocalRepositoryTestCase {
- private static Repository repository;
+ private Repository repository;
- private static RevCommit commit;
+ private RevCommit commit;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
File repoFile = createProjectAndCommitToRepository();
assertNotNull(repoFile);
repository = Activator.getDefault().getRepositoryCache()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorInputFactoryTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorInputFactoryTest.java
index 9419d399b9..36507c69a1 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorInputFactoryTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorInputFactoryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 GitHub Inc.
+ * Copyright (c) 2011, 2013 GitHub Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.ui.XMLMemento;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
/**
@@ -35,12 +35,12 @@ import org.junit.Test;
*/
public class CommitEditorInputFactoryTest extends LocalRepositoryTestCase {
- private static Repository repository;
+ private Repository repository;
- private static RevCommit commit;
+ private RevCommit commit;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
File repoFile = createProjectAndCommitToRepository();
assertNotNull(repoFile);
repository = Activator.getDefault().getRepositoryCache()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorInputTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorInputTest.java
index 199773bfad..07ffc754dd 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorInputTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorInputTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 GitHub Inc.
+ * Copyright (c) 2011, 2013 GitHub Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,7 +25,7 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
/**
@@ -33,12 +33,12 @@ import org.junit.Test;
*/
public class CommitEditorInputTest extends LocalRepositoryTestCase {
- private static Repository repository;
+ private Repository repository;
- private static RevCommit commit;
+ private RevCommit commit;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
File repoFile = createProjectAndCommitToRepository();
assertNotNull(repoFile);
repository = Activator.getDefault().getRepositoryCache()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java
index 40a0fe5cb5..dd8264d994 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2011, 2012 GitHub Inc and others.
+ * Copyright (c) 2011, 2013 GitHub Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,7 +36,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
/**
@@ -44,13 +44,12 @@ import org.junit.Test;
*/
public class CommitEditorTest extends LocalRepositoryTestCase {
- private static Repository repository;
+ private Repository repository;
- private static RevCommit commit;
+ private RevCommit commit;
- @BeforeClass
- public static void setup() throws Exception {
- closeWelcomePage();
+ @Before
+ public void setup() throws Exception {
File repoFile = createProjectAndCommitToRepository();
assertNotNull(repoFile);
repository = Activator.getDefault().getRepositoryCache()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/DiffStyleRangeFormatterTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/DiffStyleRangeFormatterTest.java
index 64cc3ba8d2..57f5093787 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/DiffStyleRangeFormatterTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/DiffStyleRangeFormatterTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 GitHub Inc.
+ * Copyright (c) 2011, 2013 GitHub Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,7 +25,7 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
/**
@@ -33,12 +33,12 @@ import org.junit.Test;
*/
public class DiffStyleRangeFormatterTest extends LocalRepositoryTestCase {
- private static Repository repository;
+ private Repository repository;
- private static RevCommit commit;
+ private RevCommit commit;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
File repoFile = createProjectAndCommitToRepository();
assertNotNull(repoFile);
repository = Activator.getDefault().getRepositoryCache()
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/RepositoryCommitTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/RepositoryCommitTest.java
index c122f05729..e89682581a 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/RepositoryCommitTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/RepositoryCommitTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 GitHub Inc.
+ * Copyright (c) 2011, 2013 GitHub Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,7 +26,7 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
/**
@@ -34,12 +34,12 @@ import org.junit.Test;
*/
public class RepositoryCommitTest extends LocalRepositoryTestCase {
- private static Repository repository;
+ private Repository repository;
- private static RevCommit commit;
+ private RevCommit commit;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
File repoFile = createProjectAndCommitToRepository();
assertNotNull(repoFile);
repository = Activator.getDefault().getRepositoryCache()
@@ -81,6 +81,7 @@ public class RepositoryCommitTest extends LocalRepositoryTestCase {
assertEquals(commit, repoCommit.getAdapter(RevCommit.class));
}
+ @Test
public void testGetters() {
RepositoryCommit repoCommit = new RepositoryCommit(repository, commit);
assertEquals(repository, repoCommit.getRepository());
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
index 3d0c046a46..bb91cda3b2 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
@@ -45,7 +45,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarToggleButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -58,13 +58,12 @@ public class HistoryViewTest extends LocalRepositoryTestCase {
private static final String ADDEDMESSAGE = "A new file in a new folder";
- private static int commitCount;
+ private int commitCount;
- private static File repoFile;
+ private File repoFile;
- @BeforeClass
- public static void setup() throws Exception {
- // File repoFile =
+ @Before
+ public void setup() throws Exception {
repoFile = createProjectAndCommitToRepository();
IProject prj = ResourcesPlugin.getWorkspace().getRoot()
.getProject(PROJ1);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java
index af55012d09..e4a3932442 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/StagingViewTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (C) 2011, Jens Baumgart <jens.baumgart@sap.com>
+ * Copyright (C) 2011, 2013 Jens Baumgart <jens.baumgart@sap.com> and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -29,23 +29,23 @@ import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
public class StagingViewTest extends LocalRepositoryTestCase {
private static final GitRepositoriesViewTestUtils repoViewUtil = new GitRepositoriesViewTestUtils();
- private static File repositoryFile;
+ private File repositoryFile;
- private static Repository repository;
+ private Repository repository;
- private static SWTBotView repositoriesView;
+ private SWTBotView repositoriesView;
- private static SWTBotTree repoViewTree;
+ private SWTBotTree repoViewTree;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
repository = lookupRepository(repositoryFile);
TestUtil.configureTestCommitterAsUser(repository);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
index 4ba8e993f2..171de7c7e3 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
@@ -32,7 +32,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.egit.core.op.BranchOperation;
import org.eclipse.egit.core.op.CommitOperation;
import org.eclipse.egit.core.op.TagOperation;
import org.eclipse.egit.ui.Activator;
@@ -69,7 +68,6 @@ import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE.SharedImages;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -78,14 +76,14 @@ import org.junit.runner.RunWith;
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class BranchAndResetActionTest extends LocalRepositoryTestCase {
- private static File repositoryFile;
private static String LOCAL_BRANCHES;
-
private static String TAGS;
- @BeforeClass
- public static void setup() throws Exception {
+ private File repositoryFile;
+
+ @Before
+ public void setup() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
Repository repo = lookupRepository(repositoryFile);
@@ -105,16 +103,6 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
null, repo), repo));
TAGS = provider.getText(new TagsNode(new RepositoryNode(null, repo),
repo));
- waitInUI();
- }
-
- @Before
- public void prepare() throws Exception {
- Repository repo = lookupRepository(repositoryFile);
- if (!repo.getBranch().equals("master")) {
- BranchOperation bop = new BranchOperation(repo, "refs/heads/master");
- bop.execute(null);
- }
}
@Test
@@ -338,8 +326,8 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
ContextMenuHelper.clickContextMenu(projectExplorerTree, menuPath);
SWTBotShell dialog = bot
.shell(UIText.CreateBranchWizard_NewBranchTitle);
- return dialog;
- }
+ return dialog;
+ }
private SWTBotShell openRenameBranchDialog() {
SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitActionTest.java
index 41f90249d8..7d46cce763 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitActionTest.java
@@ -22,7 +22,6 @@ import java.io.File;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.egit.core.op.BranchOperation;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
@@ -37,7 +36,6 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -46,10 +44,10 @@ import org.junit.runner.RunWith;
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class CommitActionTest extends LocalRepositoryTestCase {
- private static File repositoryFile;
+ private File repositoryFile;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
Repository repo = lookupRepository(repositoryFile);
TestUtil.configureTestCommitterAsUser(repo);
@@ -61,15 +59,6 @@ public class CommitActionTest extends LocalRepositoryTestCase {
assertTrue(dotProject.delete());
}
- @Before
- public void prepare() throws Exception {
- Repository repo = lookupRepository(repositoryFile);
- if (!repo.getBranch().equals("master")) {
- BranchOperation bop = new BranchOperation(repo, "refs/heads/master");
- bop.execute(null);
- }
- }
-
@Test
public void testOpenCommitWithoutChanged() throws Exception {
NoFilesToCommitPopup popup = CommitDialogTester
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitNonWSChangesTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitNonWSChangesTest.java
index 6443486e33..df1baaebfb 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitNonWSChangesTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CommitNonWSChangesTest.java
@@ -1,13 +1,12 @@
-package org.eclipse.egit.ui.test.team.actions;
-
/*******************************************************************************
- * Copyright (C) 2011, Jens Baumgart <jens.baumgart@sap.com>
+ * Copyright (C) 2011, 2013 Jens Baumgart <jens.baumgart@sap.com> and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
+package org.eclipse.egit.ui.test.team.actions;
import static org.junit.Assert.assertEquals;
@@ -29,7 +28,7 @@ import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -38,12 +37,12 @@ import org.junit.runner.RunWith;
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class CommitNonWSChangesTest extends LocalRepositoryTestCase {
- private static File repositoryFile;
+ private File repositoryFile;
- private static Repository repository;
+ private Repository repository;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil()
.addConfiguredRepository(repositoryFile);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java
index f839b52e55..a2cae0f12c 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java
@@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.egit.core.op.BranchOperation;
import org.eclipse.egit.core.op.ResetOperation;
import org.eclipse.egit.core.op.TagOperation;
import org.eclipse.egit.ui.Activator;
@@ -56,7 +55,6 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizeManager;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -65,13 +63,13 @@ import org.junit.runner.RunWith;
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class CompareActionsTest extends LocalRepositoryTestCase {
- private static File repositoryFile;
+ private File repositoryFile;
private static String TAGS;
private static ObjectId commitOfTag;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
Repository repo = lookupRepository(repositoryFile);
@@ -94,7 +92,6 @@ public class CompareActionsTest extends LocalRepositoryTestCase {
// null, repo), repo));
TAGS = provider.getText(new TagsNode(new RepositoryNode(null, repo),
repo));
- waitInUI();
}
@SuppressWarnings("restriction")
@@ -106,15 +103,6 @@ public class CompareActionsTest extends LocalRepositoryTestCase {
.setValue(UIPreferences.SYNC_VIEW_FETCH_BEFORE_LAUNCH, false);
}
- @Before
- public void prepare() throws Exception {
- Repository repo = lookupRepository(repositoryFile);
- if (!repo.getBranch().equals("master")) {
- BranchOperation bop = new BranchOperation(repo, "refs/heads/master");
- bop.execute(null);
- }
- }
-
@Test
public void testCompareWithCommit() throws Exception {
String compareWithCommitMenuText = util
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java
index 0d56b94f04..83cd5ae9d9 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CreatePatchActionTest.java
@@ -33,7 +33,6 @@ import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -85,11 +84,9 @@ public class CreatePatchActionTest extends LocalRepositoryTestCase {
+ "+Hello, world\n" //
+ "\\ No newline at end of file";
- private File gitDir;
-
@Before
public void setup() throws Exception {
- gitDir = createProjectAndCommitToRepository();
+ createProjectAndCommitToRepository();
IFile[] commitables = getAllFiles();
CommitOperation cop = new CommitOperation(commitables,
@@ -118,14 +115,6 @@ public class CreatePatchActionTest extends LocalRepositoryTestCase {
secondtextFile2 };
}
- @After
- public void tearDown() throws Exception {
- deleteAllProjects();
- shutDownRepositories();
- FileUtils.delete(gitDir.getParentFile(), FileUtils.RECURSIVE
- | FileUtils.RETRY);
- }
-
@Test
public void testNoChanges() throws Exception {
CreatePatchWizard.openWizard(PROJ1);
@@ -188,7 +177,6 @@ public class CreatePatchActionTest extends LocalRepositoryTestCase {
public void testWorkspace() throws Exception {
touchAndSubmit("oldContent", null);
touch("newContent");
- waitInUI();
CreatePatchWizard createPatchWizard = openCreatePatchWizard();
LocationPage locationPage = createPatchWizard.getLocationPage();
@@ -219,7 +207,6 @@ public class CreatePatchActionTest extends LocalRepositoryTestCase {
newFile.create(
new ByteArrayInputStream("Hello, world".getBytes(secondProject
.getDefaultCharset())), false, null);
- waitInUI();
CreatePatchWizard createPatchWizard = openCreatePatchWizard();
LocationPage locationPage = createPatchWizard.getLocationPage();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/DisconnectConnectTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/DisconnectConnectTest.java
index 45094cc0e7..9d5f8ca8bb 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/DisconnectConnectTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/DisconnectConnectTest.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -35,8 +35,8 @@ import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class DisconnectConnectTest extends LocalRepositoryTestCase {
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
createProjectAndCommitToRepository();
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
index e6416feabb..bc38a7914a 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
@@ -40,7 +40,7 @@ import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -49,16 +49,18 @@ import org.junit.runner.RunWith;
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class FetchAndMergeActionTest extends LocalRepositoryTestCase {
- private static File repositoryFile;
+ private File repositoryFile;
- private static File childRepositoryFile;
+ private File childRepositoryFile;
- private static String REMOTE_BRANCHES;
+ private String REMOTE_BRANCHES;
- private static String LOCAL_BRANCHES;
+ private String LOCAL_BRANCHES;
- @BeforeClass
- public static void setup() throws Exception {
+ private String initialCommitId;
+
+ @Before
+ public void setup() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
childRepositoryFile = createChildRepository(repositoryFile);
RepositoriesViewLabelProvider provider = GitRepositoriesViewTestUtils
@@ -68,25 +70,16 @@ public class FetchAndMergeActionTest extends LocalRepositoryTestCase {
new RepositoryNode(null, repo), repo));
LOCAL_BRANCHES = provider.getText(new LocalNode(new RepositoryNode(
null, repo), repo));
+ ObjectId id = repo.resolve(repo.getFullBranch());
+ initialCommitId = id.name();
}
- private String prepare() throws Exception {
- deleteAllProjects();
- shareProjects(repositoryFile);
- Repository repo = lookupRepository(repositoryFile);
- RevWalk rw = new RevWalk(repo);
- ObjectId id = repo.resolve(repo.getFullBranch());
- String commitId = rw.parseCommit(id).name();
+ @Test
+ public void testFetchFromOriginThenMerge() throws Exception {
touchAndSubmit(null);
deleteAllProjects();
shareProjects(childRepositoryFile);
- waitInUI();
- return commitId;
- }
- @Test
- public void testFetchFromOriginThenMerge() throws Exception {
- String previousCommit = prepare();
String oldContent = getTestFileContent();
fetch();
@@ -98,7 +91,7 @@ public class FetchAndMergeActionTest extends LocalRepositoryTestCase {
SWTBotTree tree = confirm.bot().tree();
String branch = tree.getAllItems()[0].getText();
assertTrue("Wrong result",
- branch.contains(previousCommit.substring(0, 7)));
+ branch.contains(initialCommitId.substring(0, 7)));
confirm.close();
@@ -130,7 +123,6 @@ public class FetchAndMergeActionTest extends LocalRepositoryTestCase {
@Test
public void testMergeSquash() throws Exception {
- prepare();
String oldContent = getTestFileContent();
RevCommit oldCommit = getCommitForHead();
createNewBranch("newBranch", true);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/MergeToolTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/MergeToolTest.java
index 60ed055842..47c8fb006e 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/MergeToolTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/MergeToolTest.java
@@ -33,7 +33,6 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -51,12 +50,6 @@ public class MergeToolTest extends LocalRepositoryTestCase {
testRepository = new TestRepository<Repository>(repository);
}
- @After
- public void tearDown() throws Exception {
- deleteAllProjects();
- shutDownRepositories();
- }
-
@Test
public void useHeadOptionShouldCauseFileToNotHaveConflictMarkers()
throws Exception {
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java
index d7e50e7479..520fbfc854 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java
@@ -29,7 +29,7 @@ import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -38,16 +38,15 @@ import org.junit.runner.RunWith;
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class PushActionTest extends LocalRepositoryTestCase {
- private static File repositoryFile;
+ private File repositoryFile;
- private static File remoteRepositoryFile;
+ private File remoteRepositoryFile;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
remoteRepositoryFile = createRemoteRepository(repositoryFile);
touchAndSubmit(null);
- waitInUI();
}
@Test
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/ReplaceActionsTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/ReplaceActionsTest.java
index ec848acc25..dd1a7e3d3d 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/ReplaceActionsTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/ReplaceActionsTest.java
@@ -21,7 +21,6 @@ import java.util.TimeZone;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.egit.core.op.BranchOperation;
import org.eclipse.egit.core.op.TagOperation;
import org.eclipse.egit.ui.JobFamilies;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
@@ -41,7 +40,6 @@ import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -50,12 +48,12 @@ import org.junit.runner.RunWith;
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class ReplaceActionsTest extends LocalRepositoryTestCase {
- private static File repositoryFile;
+ private File repositoryFile;
private static ObjectId commitOfTag;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
Repository repo = lookupRepository(repositoryFile);
@@ -69,16 +67,6 @@ public class ReplaceActionsTest extends LocalRepositoryTestCase {
TagOperation top = new TagOperation(repo, tag, false);
top.execute(null);
touchAndSubmit(null);
- waitInUI();
- }
-
- @Before
- public void prepare() throws Exception {
- Repository repo = lookupRepository(repositoryFile);
- if (!repo.getBranch().equals("master")) {
- BranchOperation bop = new BranchOperation(repo, "refs/heads/master");
- bop.execute(null);
- }
}
@Test
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/ShowInTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/ShowInTest.java
index 776052e080..685ffa8716 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/ShowInTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/ShowInTest.java
@@ -21,7 +21,7 @@ import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.team.ui.history.IHistoryView;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -31,8 +31,8 @@ import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class ShowInTest extends LocalRepositoryTestCase {
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
createProjectAndCommitToRepository();
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/TagActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/TagActionTest.java
index 2f3c5fed14..e72852a055 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/TagActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/TagActionTest.java
@@ -17,7 +17,6 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
-import org.eclipse.egit.core.op.BranchOperation;
import org.eclipse.egit.core.op.TagOperation;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.egit.ui.internal.UIText;
@@ -33,7 +32,6 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -42,10 +40,10 @@ import org.junit.runner.RunWith;
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class TagActionTest extends LocalRepositoryTestCase {
- private static File repositoryFile;
+ private File repositoryFile;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
Repository repo = lookupRepository(repositoryFile);
@@ -57,16 +55,6 @@ public class TagActionTest extends LocalRepositoryTestCase {
TagOperation top = new TagOperation(repo, tag, false);
top.execute(null);
touchAndSubmit(null);
- waitInUI();
- }
-
- @Before
- public void prepare() throws Exception {
- Repository repo = lookupRepository(repositoryFile);
- if (!repo.getBranch().equals("master")) {
- BranchOperation bop = new BranchOperation(repo, "refs/heads/master");
- bop.execute(null);
- }
}
@Test
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java
index 52ffce5bfa..7861322406 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 SAP AG and others.
+ * Copyright (c) 2010, 2013 SAP AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,7 +41,6 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.URIish;
-import org.eclipse.jgit.util.FileUtils;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
@@ -49,7 +48,6 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -90,18 +88,6 @@ public class GitRepositoriesViewBranchHandlingTest extends
repositoryUtil.addConfiguredRepository(clonedRepositoryFile);
}
- @After
- public void tearDown() throws Exception {
- deleteAllProjects();
- shutDownRepositories();
- FileUtils.delete(repositoryFile.getParentFile(), FileUtils.RECURSIVE
- | FileUtils.RETRY);
- FileUtils.delete(remoteRepositoryFile, FileUtils.RECURSIVE
- | FileUtils.RETRY);
- FileUtils.delete(clonedRepositoryFile.getParentFile(),
- FileUtils.RECURSIVE | FileUtils.RETRY);
- }
-
@Test
public void testCreateCheckoutDeleteLocalBranch() throws Exception {
final SWTBotView view = getOrOpenView();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
index f42c042bb5..0ac80ff81c 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
@@ -33,7 +33,6 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -44,16 +43,16 @@ import org.junit.runner.RunWith;
public class GitRepositoriesViewFetchAndPushTest extends
GitRepositoriesViewTestBase {
- private static File repositoryFile;
+ private File repositoryFile;
- private static File remoteRepositoryFile;
+ private File remoteRepositoryFile;
- private static File clonedRepositoryFile;
+ private File clonedRepositoryFile;
- private static File clonedRepositoryFile2;
+ private File clonedRepositoryFile2;
- @BeforeClass
- public static void beforeClass() throws Exception {
+ @Before
+ public void before() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
remoteRepositoryFile = createRemoteRepository(repositoryFile);
// now let's clone the remote repository
@@ -75,13 +74,11 @@ public class GitRepositoriesViewFetchAndPushTest extends
op.run(null);
clonedRepositoryFile2 = new File(workdir, Constants.DOT_GIT);
- }
- @Before
- public void before() throws Exception {
clearView();
deleteAllProjects();
}
+
@Test
public void testPushToOriginPushNode() throws Exception {
testPushToOrigin(false);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java
index 152ea45b93..730afa3836 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 SAP AG and others.
+ * Copyright (c) 2010, 2013 SAP AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,7 +29,7 @@ import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -40,12 +40,12 @@ import org.junit.runner.RunWith;
public class GitRepositoriesViewRemoteHandlingTest extends
GitRepositoriesViewTestBase {
- private static File repositoryFile;
+ private File repositoryFile;
- private static File remoteRepositoryFile;
+ private File remoteRepositoryFile;
- @BeforeClass
- public static void beforeClass() throws Exception {
+ @Before
+ public void before() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
remoteRepositoryFile = createRemoteRepository(repositoryFile);
Activator.getDefault().getRepositoryUtil().addConfiguredRepository(
@@ -55,7 +55,7 @@ public class GitRepositoriesViewRemoteHandlingTest extends
/**
* Verify that remote configuration is shown correctly; also check error
* node display
- *
+ *
* @throws Exception
*/
@Test
@@ -117,7 +117,7 @@ public class GitRepositoriesViewRemoteHandlingTest extends
/**
* Remote configuration scenarios
- *
+ *
* @throws Exception
*/
@Test
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
index b11baed0e1..7e1f307271 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
@@ -42,12 +42,12 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
- * SWTBot Tests for the Git Repositories View (repsitory handling)
+ * SWTBot Tests for the Git Repositories View (repository handling)
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class GitRepositoriesViewRepoHandlingTest extends
@@ -55,10 +55,10 @@ public class GitRepositoriesViewRepoHandlingTest extends
private static final String REMOVE_REPOSITORY_CONTEXT_MENU_LABEL = "RepoViewRemove.label";
- private static File repositoryFile;
+ private File repositoryFile;
- @BeforeClass
- public static void beforeClass() throws Exception {
+ @Before
+ public void before() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java
index 9bb6f0d85d..cd44ba0525 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 SAP AG.
+ * Copyright (c) 2010, 2013 SAP AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,7 +28,6 @@ import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevTag;
@@ -38,7 +37,6 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -49,33 +47,19 @@ import org.junit.runner.RunWith;
public class GitRepositoriesViewTagHandlingTest extends
GitRepositoriesViewTestBase {
- private static File repositoryFile;
+ private File repositoryFile;
private Repository repository;
private RevWalk revWalk;
- @BeforeClass
- public static void beforeClass() throws Exception {
+ @Before
+ public void beforeClass() throws Exception {
setVerboseBranchMode(false);
repositoryFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil().addConfiguredRepository(
repositoryFile);
- }
-
- @Before
- public void before() throws Exception {
repository = lookupRepository(repositoryFile);
- for (String ref : repository.getTags().keySet()) {
- RefUpdate op = repository.updateRef(ref, true);
- op.setRefLogMessage("tag deleted", //$NON-NLS-1$
- false);
- // we set the force update in order
- // to avoid having this rejected
- // due to minor issues
- op.setForceUpdate(true);
- op.delete();
- }
revWalk = new RevWalk(repository);
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
index a0bc6784a5..7c7c15fd29 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
@@ -48,7 +48,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -71,10 +71,10 @@ import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
- private static File repositoryFile;
+ private File repositoryFile;
- @BeforeClass
- public static void beforeClass() throws Exception {
+ @Before
+ public void beforeClass() throws Exception {
setVerboseBranchMode(false);
repositoryFile = createProjectAndCommitToRepository();
Activator.getDefault().getRepositoryUtil().addConfiguredRepository(
@@ -536,7 +536,8 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
SWTBotShell createBranchShell = bot
.shell(UIText.CreateBranchWizard_NewBranchTitle);
createBranchShell.bot().textWithId("BranchName").setText("abc");
- createBranchShell.bot().checkBox().deselect();
+ createBranchShell.bot()
+ .checkBox(UIText.CreateBranchPage_CheckoutButton).deselect();
createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click();
refreshAndWait();
// delete branch
@@ -570,13 +571,15 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
SWTBotShell createBranchShell = bot
.shell(UIText.CreateBranchWizard_NewBranchTitle);
createBranchShell.bot().textWithId("BranchName").setText("abc");
- createBranchShell.bot().checkBox().deselect();
+ createBranchShell.bot()
+ .checkBox(UIText.CreateBranchPage_CheckoutButton).deselect();
createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click();
// create second branch (123)
ContextMenuHelper.clickContextMenu(tree, "Create Branch...");
createBranchShell = bot.shell(UIText.CreateBranchWizard_NewBranchTitle);
createBranchShell.bot().textWithId("BranchName").setText("123");
- createBranchShell.bot().checkBox().deselect();
+ createBranchShell.bot()
+ .checkBox(UIText.CreateBranchPage_CheckoutButton).deselect();
createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click();
refreshAndWait();
localBranchesItem = myRepoViewUtil.getLocalBranchesItem(tree,
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestBase.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestBase.java
index 1914dea497..8172745427 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestBase.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestBase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 SAP AG and others.
+ * Copyright (c) 2010, 2013 SAP AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,37 +13,23 @@ package org.eclipse.egit.ui.view.repositories;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.eclipse.core.commands.State;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.RepositoryUtil;
-import org.eclipse.egit.core.op.CommitOperation;
-import org.eclipse.egit.core.op.ConnectProviderOperation;
import org.eclipse.egit.ui.JobFamilies;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.egit.ui.internal.UIText;
-import org.eclipse.egit.ui.internal.push.PushOperationUI;
import org.eclipse.egit.ui.internal.repository.RepositoriesView;
import org.eclipse.egit.ui.internal.repository.tree.command.ToggleBranchCommitCommand;
-import org.eclipse.egit.ui.test.Eclipse;
import org.eclipse.egit.ui.test.JobJoiner;
import org.eclipse.egit.ui.test.TestUtil;
-import org.eclipse.jgit.lib.ConfigConstants;
-import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefUpdate;
@@ -53,7 +39,6 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
-import org.junit.After;
/**
* Collection of utility methods for Git Repositories View tests
@@ -81,124 +66,6 @@ public abstract class GitRepositoriesViewTestBase extends
RepositoryUtil.PREFS_DIRECTORIES);
}
- protected static File createProjectAndCommitToRepository() throws Exception {
-
- File gitDir = new File(new File(getTestDirectory(), REPO1),
- Constants.DOT_GIT);
- Repository myRepository = lookupRepository(gitDir);
- myRepository.create();
-
- // TODO Bug: for some reason, this seems to be required
- myRepository.getConfig().setString(ConfigConstants.CONFIG_CORE_SECTION,
- null, ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "0");
-
- myRepository.getConfig().save();
-
- // we need to commit into master first
- IProject firstProject = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(PROJ1);
-
- if (firstProject.exists())
- firstProject.delete(true, null);
- IProjectDescription desc = ResourcesPlugin.getWorkspace()
- .newProjectDescription(PROJ1);
- desc.setLocation(new Path(new File(myRepository.getWorkTree(), PROJ1)
- .getPath()));
- firstProject.create(desc, null);
- firstProject.open(null);
-
- IFolder folder = firstProject.getFolder(FOLDER);
- folder.create(false, true, null);
- IFile textFile = folder.getFile(FILE1);
- textFile.create(new ByteArrayInputStream("Hello, world"
- .getBytes(firstProject.getDefaultCharset())), false, null);
- IFile textFile2 = folder.getFile(FILE2);
- textFile2.create(new ByteArrayInputStream("Some more content"
- .getBytes(firstProject.getDefaultCharset())), false, null);
-
- new ConnectProviderOperation(firstProject, gitDir).execute(null);
-
- IProject secondPoject = ResourcesPlugin.getWorkspace().getRoot()
- .getProject(PROJ2);
-
- if (secondPoject.exists())
- secondPoject.delete(true, null);
-
- desc = ResourcesPlugin.getWorkspace().newProjectDescription(PROJ2);
- desc.setLocation(new Path(new File(myRepository.getWorkTree(), PROJ2)
- .getPath()));
- secondPoject.create(desc, null);
- secondPoject.open(null);
-
- IFolder secondfolder = secondPoject.getFolder(FOLDER);
- secondfolder.create(false, true, null);
- IFile secondtextFile = secondfolder.getFile(FILE1);
- secondtextFile.create(new ByteArrayInputStream("Hello, world"
- .getBytes(firstProject.getDefaultCharset())), false, null);
- IFile secondtextFile2 = secondfolder.getFile(FILE2);
- secondtextFile2.create(new ByteArrayInputStream("Some more content"
- .getBytes(firstProject.getDefaultCharset())), false, null);
-
- new ConnectProviderOperation(secondPoject, gitDir).execute(null);
-
- IFile[] commitables = new IFile[] { firstProject.getFile(".project"),
- textFile, textFile2, secondtextFile, secondtextFile2 };
- ArrayList<IFile> untracked = new ArrayList<IFile>();
- untracked.addAll(Arrays.asList(commitables));
- // commit to stable
- CommitOperation op = new CommitOperation(commitables,
- untracked, "Test Author <test.author@test.com>",
- "Test Committer <test.commiter@test.com>",
- "Initial commit");
- op.execute(null);
-
- // now create a stable branch (from master)
- createStableBranch(myRepository);
- // and check in some stuff into master again
- touchAndSubmit(null);
- return gitDir;
- }
-
- protected static File createRemoteRepository(File repositoryDir)
- throws Exception {
- Repository myRepository = org.eclipse.egit.core.Activator.getDefault()
- .getRepositoryCache().lookupRepository(repositoryDir);
- File gitDir = new File(getTestDirectory(), REPO2);
- Repository myRemoteRepository = lookupRepository(gitDir);
- myRemoteRepository.create();
-
- createStableBranch(myRepository);
-
- // now we configure the push destination
- myRepository.getConfig().setString("remote", "push", "pushurl",
- "file:///" + myRemoteRepository.getDirectory().getPath());
- myRepository.getConfig().setString("remote", "push", "push",
- "+refs/heads/*:refs/heads/*");
- // TODO Bug: for some reason, this seems to be required
- myRepository.getConfig().setString(ConfigConstants.CONFIG_CORE_SECTION,
- null, ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "0");
-
- myRepository.getConfig().save();
- // and push
- PushOperationUI pa = new PushOperationUI(myRepository, "push", 0, false);
- pa.execute(null);
- TestUtil.joinJobs(JobFamilies.PUSH);
- try {
- // delete the stable branch again
- RefUpdate op = myRepository.updateRef("refs/heads/stable");
- op.setRefLogMessage("branch deleted", //$NON-NLS-1$
- false);
- // we set the force update in order
- // to avoid having this rejected
- // due to minor issues
- op.setForceUpdate(true);
- op.delete();
- } catch (IOException ioe) {
- throw new InvocationTargetException(ioe);
- }
- return myRemoteRepository.getDirectory();
- }
-
protected static void createStableBranch(Repository myRepository)
throws IOException {
// let's create a stable branch temporarily so
@@ -223,11 +90,6 @@ public abstract class GitRepositoriesViewTestBase extends
verboseBranchModeState.setValue(Boolean.valueOf(state));
}
- @After
- public void afterBase() {
- new Eclipse().reset();
- }
-
protected SWTBotView getOrOpenView() throws Exception {
if (viewbot == null) {
viewbot = TestUtil.showView(RepositoriesView.VIEW_ID);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java
index 46b443bb72..67bdf65638 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java
@@ -50,7 +50,6 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
-import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.StringUtils;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
@@ -115,14 +114,6 @@ public abstract class AbstractSynchronizeViewTest extends
.addConfiguredRepository(repositoryFile);
}
- @After
- public void deleteRepository() throws Exception {
- deleteAllProjects();
- shutDownRepositories();
- FileUtils.delete(repositoryFile.getParentFile(), FileUtils.RECURSIVE | FileUtils.RETRY);
- FileUtils.delete(childRepositoryFile.getParentFile(), FileUtils.RECURSIVE | FileUtils.RETRY);
- }
-
@BeforeClass public static void setupEnvironment() throws Exception {
// disable perspective synchronize selection
TeamUIPlugin.getPlugin().getPreferenceStore().setValue(

Back to the top