Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2016-03-17 22:43:18 +0000
committerMatthias Sohn2016-03-21 00:03:27 +0000
commit00e4c9acebeec43abbb18b9fbea431a70a3cb873 (patch)
tree0698a928308d008a0294a83e9673096f41efebbd /org.eclipse.egit.ui.test
parentc1024b6856f8fe396c58974ef8d4bc68a97ad82e (diff)
downloadegit-00e4c9acebeec43abbb18b9fbea431a70a3cb873.tar.gz
egit-00e4c9acebeec43abbb18b9fbea431a70a3cb873.tar.xz
egit-00e4c9acebeec43abbb18b9fbea431a70a3cb873.zip
Remove session properties when disconnecting a project
Disconnecting a project left the session properties for the RepositoryMappings still attached to the resource info in the Eclipse resource tree. This prevents timely garbage collection of no longer used repository instances because the mappings contain hard references to repositories. Moreover, potentially stale properties might become active again when the project is re-connected. Change-Id: I845c708d3d98ba285c8db94edd2ed14deebd29fb Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java
index ece1f6ab95..9fde54af5e 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java
@@ -13,6 +13,7 @@ import static org.eclipse.swtbot.eclipse.finder.waits.Conditions.waitForEditor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
@@ -24,10 +25,12 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.JobFamilies;
import org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry;
+import org.eclipse.egit.core.project.GitProjectData;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.core.test.TestRepository;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
@@ -263,6 +266,23 @@ public class SubmoduleFolderTest extends LocalRepositoryTestCase {
}
@Test
+ public void testDisconnect() throws Exception {
+ SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
+ getProjectItem(projectExplorerTree, PROJ1).select();
+ String menuString = util
+ .getPluginLocalizedValue("DisconnectAction_label");
+ ContextMenuHelper.clickContextMenuSync(projectExplorerTree, "Team",
+ menuString);
+ ResourcesPlugin.getWorkspace().getRoot()
+ .refreshLocal(IResource.DEPTH_INFINITE, null);
+ // Access the session property directly: RepositoryMapping.getMapping()
+ // checks whether the project is shared with git.
+ Object mapping = childFolder.getSessionProperty(new QualifiedName(
+ GitProjectData.class.getName(), "RepositoryMapping"));
+ assertNull("Should have no RepositoryMapping", mapping);
+ }
+
+ @Test
public void testDecoration() throws Exception {
SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
SWTBotTreeItem node = TestUtil.navigateTo(projectExplorerTree,

Back to the top