From 55a334b3018ed0db1335c8857e13153cb2f46361 Mon Sep 17 00:00:00 2001 From: Robin Rosenberg Date: Sun, 2 May 2010 10:46:47 +0200 Subject: [PATCH] Make the org.eclipse.core.test bundle a fragment bundle A fragment bundle allows us direct access to internal packages of the host bundle that we are testing without the hazzle with export/import. Since we cannot have an activator for a fragment we now set up the MockSystemReader in the GitTestCase that our tests derive from anyway. Change-Id: I6a1ded23d0a3063ae03ef6b8683c04b8dbe0d84e Signed-off-by: Robin Rosenberg --- org.eclipse.egit.core.test/META-INF/MANIFEST.MF | 2 +- .../src/org/eclipse/egit/core/test/Activator.java | 62 ---------------------- .../org/eclipse/egit/core/test/GitTestCase.java | 7 +-- 3 files changed, 5 insertions(+), 66 deletions(-) delete mode 100644 org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/Activator.java diff --git a/org.eclipse.egit.core.test/META-INF/MANIFEST.MF b/org.eclipse.egit.core.test/META-INF/MANIFEST.MF index 270e9c9e..66af0dce 100644 --- a/org.eclipse.egit.core.test/META-INF/MANIFEST.MF +++ b/org.eclipse.egit.core.test/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Name: Git Team Provider Core Test Plug-in (Incubation) Bundle-Vendor: Eclipse.org Bundle-SymbolicName: org.eclipse.egit.core.test +Fragment-Host: org.eclipse.egit.core Bundle-Version: 0.8.0.qualifier -Bundle-Activator: org.eclipse.egit.core.test.Activator Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)", org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)", diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/Activator.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/Activator.java deleted file mode 100644 index 99e6b52b..00000000 --- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/Activator.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2008, Robin Rosenberg - * - * 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.core.test; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.jgit.junit.MockSystemReader; -import org.eclipse.jgit.util.SystemReader; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends Plugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.egit.core.test"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - // Empty - } - - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - SystemReader.setInstance(new MockSystemReader()); - } - - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java index d53b35fc..58faa475 100644 --- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java +++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java @@ -26,9 +26,10 @@ public abstract class GitTestCase { @Before public void setUp() throws Exception { - ((MockSystemReader) SystemReader.getInstance()).setProperty( - Constants.GIT_CEILING_DIRECTORIES_KEY, ResourcesPlugin - .getWorkspace().getRoot().getLocation().toFile() + MockSystemReader mockSystemReader = new MockSystemReader(); + SystemReader.setInstance(mockSystemReader); + mockSystemReader.setProperty(Constants.GIT_CEILING_DIRECTORIES_KEY, + ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile() .getAbsoluteFile().toString()); project = new TestProject(true); gitDir = new File(project.getProject().getWorkspace().getRoot() -- 2.11.4.GIT