Bug 112856 - Bundles should be able to contribute extension point to other namespaces
diff --git a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeBuilder.java b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeBuilder.java
index f80f9e9..9c77ed1 100644
--- a/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeBuilder.java
+++ b/bundles/org.eclipse.core.contenttype/src/org/eclipse/core/internal/content/ContentTypeBuilder.java
@@ -121,7 +121,7 @@
 	 * @throws CoreException if mandatory attributes are missing in the markup
 	 */
 	private ContentType createContentType(IConfigurationElement contentTypeCE) throws CoreException {
-		String namespace = contentTypeCE.getNamespace();
+		String namespace = contentTypeCE.getContributor().getName();
 		String simpleId = contentTypeCE.getAttributeAsIs("id"); //$NON-NLS-1$
 		String name = contentTypeCE.getAttribute("name"); //$NON-NLS-1$
 
@@ -219,7 +219,7 @@
 	 */
 	private void registerFileAssociation(IConfigurationElement fileAssociationElement) {
 		//TODO: need to ensure the config. element is valid		
-		String contentTypeId = getUniqueId(fileAssociationElement.getNamespace(), fileAssociationElement.getAttribute("content-type")); //$NON-NLS-1$
+		String contentTypeId = getUniqueId(fileAssociationElement.getContributor().getName(), fileAssociationElement.getAttribute("content-type")); //$NON-NLS-1$
 		ContentType target = catalog.internalGetContentType(contentTypeId);
 		if (target == null)
 			return;
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionHandle.java b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionHandle.java
index 0da14cb..2e3421f 100644
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionHandle.java
+++ b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionHandle.java
@@ -21,12 +21,14 @@
  */
 public class ExtensionHandle extends BaseExtensionHandle {
 
+	static final ExtensionHandle[] EMPTY_ARRAY = new ExtensionHandle[0];
+
 	public ExtensionHandle(IObjectManager objectManager, int id) {
 		super(objectManager, id);
 	}
 
 	public IPluginDescriptor getDeclaringPluginDescriptor() throws InvalidRegistryObjectException {
-		String namespace = getNamespace();
+		String namespace = getContributor().getName();
 		IPluginDescriptor result = RegistryCompatibilityHelper.getPluginDescriptor(namespace);
 		if (result == null) {
 			Bundle underlyingBundle = BundleHelper.getDefault().getBundle(namespace);
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java
index b44ef45..2487cd2 100644
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java
+++ b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/internal/registry/ExtensionPointHandle.java
@@ -19,11 +19,13 @@
  */
 public class ExtensionPointHandle extends BaseExtensionPointHandle {
 
+	static final ExtensionPointHandle[] EMPTY_ARRAY = new ExtensionPointHandle[0];
+
 	public ExtensionPointHandle(IObjectManager objectManager, int id) {
 		super(objectManager, id);
 	}
 
 	public IPluginDescriptor getDeclaringPluginDescriptor() {
-		return RegistryCompatibilityHelper.getPluginDescriptor(getNamespace());
+		return RegistryCompatibilityHelper.getPluginDescriptor(getContributor().getName());
 	}
 }
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtension.java b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtension.java
index e8d77d3..4f66c75 100644
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtension.java
+++ b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtension.java
@@ -61,10 +61,30 @@
 	 * @throws InvalidRegistryObjectException if this extension is no longer valid
 	 * @see IExtensionRegistry
 	 * @since 3.0
+	 * 
+	 * @deprecated As namespace is no longer restricted to the contributor name, 
+	 * use {@link #getNamespaceIdentifier()} to obtain namespace name or {@link #getContributor()}
+	 * to get the name of the contributor of this registry element  
 	 */
 	public String getNamespace() throws InvalidRegistryObjectException;
 
 	/**
+	 * Returns the namespace name for this extension.
+	 * @return the namespace name for this extension
+	 * @throws InvalidRegistryObjectException if this extension is no longer valid
+	 * @since org.eclipse.equinox.registry 3.2	 
+	 */
+	public String getNamespaceIdentifier() throws InvalidRegistryObjectException;
+
+	/**
+	 * Returns the contributor of the extension.
+	 * @return the contributor for this extension
+	 * @throws InvalidRegistryObjectException if this extension is no longer valid
+	 * @since org.eclipse.equinox.registry 3.2	 
+	 */
+	public IContributor getContributor() throws InvalidRegistryObjectException;
+
+	/**
 	 * Returns the unique identifier of the extension point
 	 * to which this extension should be contributed.
 	 *
@@ -126,7 +146,7 @@
 	 * @since 3.1
 	 */
 	public boolean isValid();
-	
+
 	/**
 	 * Returns the descriptor of the plug-in that declares this extension.
 	 * 
diff --git a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtensionPoint.java b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtensionPoint.java
index bc7286d..e773ec0 100644
--- a/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtensionPoint.java
+++ b/bundles/org.eclipse.core.runtime.compatibility.registry/src/org/eclipse/core/runtime/IExtensionPoint.java
@@ -62,10 +62,30 @@
 	 * @throws InvalidRegistryObjectException if this extension point is no longer valid
 	 * @see IExtensionRegistry
 	 * @since 3.0
+	 * 
+	 * @deprecated As namespace is no longer restricted to the contributor name, 
+	 * use {@link #getNamespaceIdentifier()} to obtain namespace name or {@link #getContributor()}
+	 * to get the name of the contributor of this registry element  
 	 */
 	public String getNamespace() throws InvalidRegistryObjectException;
 
 	/**
+	 * Returns the namespace name for this extension point.
+	 * @return the namespace name for this extension point
+	 * @throws InvalidRegistryObjectException if this extension point is no longer valid
+	 * @since org.eclipse.equinox.registry 3.2	 
+	 */
+	public String getNamespaceIdentifier() throws InvalidRegistryObjectException;
+
+	/**
+	 * Returns the contributor of the extension point.
+	 * @return the contributor for this extension point
+	 * @throws InvalidRegistryObjectException if this extension point is no longer valid
+	 * @since org.eclipse.equinox.registry 3.2	 
+	 */
+	public IContributor getContributor() throws InvalidRegistryObjectException;
+
+	/**
 	 * Returns the extension with the given unique identifier configured into
 	 * this extension point, or <code>null</code> if there is no such extension.
 	 * Since an extension might not have an identifier, some extensions
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterFactoryProxy.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterFactoryProxy.java
index 342d7e8..e506d1b 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterFactoryProxy.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/AdapterFactoryProxy.java
@@ -104,7 +104,7 @@
 		synchronized (this) {
 			if (factory != null || factoryLoaded)
 				return factory;
-			String bundleId = element.getNamespace();
+			String bundleId = element.getContributor().getName();
 			if (!force && Platform.getBundle(bundleId).getState() != Bundle.ACTIVE)
 				return null;
 			//set to true to prevent repeated attempts to load a broken factory
@@ -122,7 +122,7 @@
 	 * The factory extension was malformed. Log an appropriate exception
 	 */
 	private void logError() {
-		String msg = NLS.bind(Messages.adapters_badAdapterFactory, element.getNamespace());
+		String msg = NLS.bind(Messages.adapters_badAdapterFactory, element.getContributor().getName());
 		InternalPlatform.getDefault().log(new Status(IStatus.ERROR, Platform.PI_RUNTIME, 1, msg, null));
 	}
 }
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java
index 58d5575..bd7eaec 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java
@@ -47,7 +47,7 @@
 			if (key != null && value != null)
 				properties.put(key, value);
 		}
-		definingBundle = Platform.getBundle(element.getNamespace());
+		definingBundle = Platform.getBundle(element.getContributor().getName());
 	}
 
 	public Bundle getDefiningBundle() {
diff --git a/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch b/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch
index f1893c7..46badd8 100644
--- a/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch
+++ b/tests/org.eclipse.core.tests.runtime/All Runtime Tests.launch
@@ -3,30 +3,33 @@
 <stringAttribute key="product" value="org.eclipse.platform.ide"/>
 <stringAttribute key="bootstrap" value=""/>
 <booleanAttribute key="useProduct" value="false"/>
+<stringAttribute key="deselected_workspace_plugins" value="org.eclipse.core.resources,org.eclipse.osgi.services,org.eclipse.core.filesystem,org.eclipse.core.tools.resources,org.eclipse.equinox.http,org.eclipse.osgi.tests,org.eclipse.update.scheduler,org.eclipse.core.tools,org.eclipse.equinox.metatype,org.eclipse.pde.build,org.eclipse.equinox.log,org.eclipse.equinox.device,org.eclipse.core.tests.resources,org.eclipse.test,org.eclipse.platform,org.eclipse.core.boot,org.eclipse.update.ui,org.eclipse.osgi.util,org.eclipse.equinox.useradmin,org.eclipse.equinox.supplement,org.eclipse.equinox.wireadmin,org.eclipse.equinox.event,org.eclipse.update.core,org.eclipse.core.resources.compatibility,org.eclipse.update.core.win32,org.eclipse.core.resources.spysupport,org.eclipse.core.filesystem.win32.x86,org.eclipse.core.resources.win32"/>
 <booleanAttribute key="tracing" value="false"/>
 <listAttribute key="org.eclipse.debug.ui.favoriteGroups">
 <listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
 </listAttribute>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.core.commands,org.eclipse.core.expressions,org.eclipse.help,org.eclipse.jdt.junit.runtime,org.eclipse.jface,org.eclipse.pde.junit.runtime,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.ui,org.eclipse.ui.workbench,org.junit"/>
 <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="automaticValidate" value="false"/>
 <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
 <booleanAttribute key="automaticAdd" value="true"/>
 <stringAttribute key="checked" value="[NONE]"/>
 <booleanAttribute key="includeFragments" value="false"/>
-<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<stringAttribute key="location" value="c:\temp\runtime-test-workspace"/>
 <stringAttribute key="configLocation" value=""/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
 <booleanAttribute key="clearws" value="true"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.core.tests.runtime.AutomatedTests"/>
-<stringAttribute key="templateConfig" value=""/>
-<booleanAttribute key="default" value="true"/>
-<stringAttribute key="vmargs" value=""/>
+<stringAttribute key="pde.version" value="3.2a"/>
+<stringAttribute key="templateConfig" value="${workspace_loc:Configuration/config.ini}"/>
+<booleanAttribute key="default" value="false"/>
 <booleanAttribute key="clearConfig" value="true"/>
 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
 <booleanAttribute key="useDefaultConfigArea" value="true"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="progargs" value=""/>
 <booleanAttribute key="useDefaultConfig" value="true"/>
 <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.core.tests.runtime"/>
 <booleanAttribute key="askclear" value="false"/>
-<stringAttribute key="location0" value="c:\temp\runtime-test-workspace"/>
+<booleanAttribute key="includeOptional" value="true"/>
 </launchConfiguration>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/1/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/1/plugin.xml
new file mode 100644
index 0000000..a5bd665
--- /dev/null
+++ b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/1/plugin.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin id="testNamespace1" name="TestNamespace Plug-in1" version="1.0.0" provider-name="">
+  
+    <extension-point id="org.abc.xptNS1" name="Label xptNS1" schema="schema/xptNS1.exsd"/>
+    
+  	<extension point="org.abc.xptNS1" id="org.abc.extNS1">
+	</extension>
+     
+</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/2/plugin.xml b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/2/plugin.xml
new file mode 100644
index 0000000..146c2f3
--- /dev/null
+++ b/tests/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/2/plugin.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin id="testNamespace2" name="TestNamespace Plug-in2" version="1.0.0" provider-name="">
+  
+    <extension-point id="org.abc.xptNS2" name="Label xptNS2" schema="schema/xptNS2.exsd"/>
+    
+  	<extension point="org.abc.xptNS2" id="org.abc.extNS2">
+	</extension>
+     
+</plugin>
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/AllTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/AllTests.java
index 3015f59..242cd6f 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/AllTests.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/AllTests.java
@@ -25,6 +25,7 @@
 		TestSuite suite = new TestSuite(AllTests.class.getName());
 //		suite.addTest(ExtensionRegistryDynamicTest.suite());
 		suite.addTest(ExtensionRegistryStaticTest.suite());
+		suite.addTest(NamespaceTest.suite());
 		suite.addTestSuite(StaleObjects.class);
 		return suite;
 	}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java
index 6fc893d..1ef6977 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/ExtensionRegistryStaticTest.java
@@ -43,6 +43,8 @@
 		assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name));
 		assertEquals(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name).getLabel(), "Label xpt" + name);
 		assertEquals(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name).getNamespace(), "test" + name);
+		assertEquals(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name).getNamespaceIdentifier(), "test" + name);
+		assertEquals(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name).getContributor().getName(), "test" + name);
 		assertEquals(Platform.getExtensionRegistry().getExtensionPoint("test" + name + ".xpt" + name).getSchemaReference(), "schema/xpt" + name + ".exsd");
 	}
 
@@ -203,6 +205,8 @@
 		assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2"));
 		assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2").getLabel(), "Label xptG2");
 		assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2").getNamespace(), "testG1");
+		assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2").getNamespaceIdentifier(), "testG1");
+		assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2").getContributor().getName(), "testG1");
 		assertEquals(Platform.getExtensionRegistry().getExtensionPoint("testG1.xptG2").getSchemaReference(), "schema/xptG2.exsd");
 
 		//Test the namespace
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/NamespaceTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/NamespaceTest.java
new file mode 100644
index 0000000..c19486f
--- /dev/null
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/registry/NamespaceTest.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation 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
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.tests.internal.registry;
+
+import java.io.IOException;
+import junit.framework.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.tests.harness.BundleTestingHelper;
+import org.eclipse.core.tests.runtime.RuntimeTestsPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+public class NamespaceTest extends TestCase {
+
+	public NamespaceTest(String name) {
+		super(name);
+	}
+
+	public void testNamespaceBasic() throws IOException, BundleException {
+		//test the addition of an extension point
+		Bundle bundle01 = BundleTestingHelper.installBundle("Plugin", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testNamespace/1");
+		BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
+
+		// Extension point and extension should be present 
+		IExtensionPoint extpt = Platform.getExtensionRegistry().getExtensionPoint("org.abc.xptNS1");
+		assertNotNull(extpt);
+		assertTrue(extpt.getNamespaceIdentifier().equals("org.abc"));
+		assertTrue(extpt.getContributor().getName().equals("testNamespace1"));
+		assertTrue(extpt.getSimpleIdentifier().equals("xptNS1"));
+		assertTrue(extpt.getUniqueIdentifier().equals("org.abc.xptNS1"));
+
+		IExtension ext = Platform.getExtensionRegistry().getExtension("org.abc.extNS1");
+		assertNotNull(ext);
+		assertTrue(ext.getNamespaceIdentifier().equals("org.abc"));
+		assertTrue(ext.getContributor().getName().equals("testNamespace1"));
+		assertTrue(ext.getSimpleIdentifier().equals("extNS1"));
+		assertTrue(ext.getUniqueIdentifier().equals("org.abc.extNS1"));
+
+		// Check linkage extension <-> extension point
+		assertTrue(ext.getExtensionPointUniqueIdentifier().equals(extpt.getUniqueIdentifier()));
+		IExtension[] extensions = extpt.getExtensions();
+		assertTrue(extensions.length == 1);
+		assertTrue(extensions[0].equals(ext));
+
+		// Exactly one extension and one extension point in the "org.abc" namespace
+		IExtensionPoint[] namespaceExtensionPoints = Platform.getExtensionRegistry().getExtensionPoints("org.abc");
+		assertTrue(namespaceExtensionPoints.length == 1);
+		assertTrue(namespaceExtensionPoints[0].equals(extpt));
+		IExtension[] namespaceExtensions = Platform.getExtensionRegistry().getExtensions("org.abc");
+		assertTrue(namespaceExtensions.length == 1);
+		assertTrue(namespaceExtensions[0].equals(ext));
+
+		// There should not be extension points or extensions in the default namespace
+		IExtensionPoint[] defaultExtensionPoints = Platform.getExtensionRegistry().getExtensionPoints("testNamespace1");
+		assertTrue(defaultExtensionPoints.length == 0);
+		IExtension[] defaultExtensions = Platform.getExtensionRegistry().getExtensions("testNamespace1");
+		assertTrue(defaultExtensions.length == 0);
+
+		// add another bundle
+		BundleTestingHelper.installBundle("Plugin", RuntimeTestsPlugin.getContext(), RuntimeTestsPlugin.TEST_FILES_ROOT + "registry/testNamespace/2");
+		BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
+
+		// remove the first bundle
+		bundle01.uninstall();
+		BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {bundle01});
+	}
+
+	public void testNamespaceDynamic() {
+
+		// all elements from the first bundle should be gone
+		IExtensionPoint extpt_removed = Platform.getExtensionRegistry().getExtensionPoint("org.abc.xptNS1");
+		assertNull(extpt_removed);
+		IExtension ext_removed = Platform.getExtensionRegistry().getExtension("org.abc.extNS1");
+		assertNull(ext_removed);
+
+		// all elements from the second bundle should still be present
+		IExtensionPoint extpt2 = Platform.getExtensionRegistry().getExtensionPoint("org.abc.xptNS2");
+		assertNotNull(extpt2);
+		IExtension ext2 = Platform.getExtensionRegistry().getExtension("org.abc.extNS2");
+		assertNotNull(ext2);
+
+		// Exactly one extension and one extension point in the "org.abc" namespace
+		IExtensionPoint[] namespaceExtensionPoints2 = Platform.getExtensionRegistry().getExtensionPoints("org.abc");
+		assertTrue(namespaceExtensionPoints2.length == 1);
+		assertTrue(namespaceExtensionPoints2[0].equals(extpt2));
+		IExtension[] namespaceExtensions2 = Platform.getExtensionRegistry().getExtensions("org.abc");
+		assertTrue(namespaceExtensions2.length == 1);
+		assertTrue(namespaceExtensions2[0].equals(ext2));
+	}
+
+	public static Test suite() {
+		//Order is important
+		TestSuite sameSession = new TestSuite(NamespaceTest.class.getName());
+		sameSession.addTest(new NamespaceTest("testNamespaceBasic"));
+		sameSession.addTest(new NamespaceTest("testNamespaceDynamic"));
+		return sameSession;
+	}
+}
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AutomatedTests.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AutomatedTests.java
index d242616..e437238 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AutomatedTests.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/AutomatedTests.java
@@ -31,13 +31,20 @@
 	 */
 	public static Test suite() {
 		TestSuite suite = new TestSuite(AutomatedTests.class.getName());
+		
+		// Moved to the top: bug 124867
+		suite.addTest(org.eclipse.core.tests.internal.runtime.AllTests.suite());
+		
 		suite.addTest(org.eclipse.core.tests.runtime.AllTests.suite());
 		suite.addTest(org.eclipse.core.tests.runtime.compatibility.AllTests.suite());
 		suite.addTest(org.eclipse.core.tests.runtime.content.AllTests.suite());
 		suite.addTest(org.eclipse.core.tests.runtime.jobs.AllTests.suite());
 		suite.addTest(org.eclipse.core.tests.runtime.model.AllTests.suite());
 		suite.addTest(org.eclipse.core.tests.internal.preferences.AllTests.suite());
-		suite.addTest(org.eclipse.core.tests.internal.runtime.AllTests.suite());
+		
+		// Moved to the top: bug 124867
+		//suite.addTest(org.eclipse.core.tests.internal.runtime.AllTests.suite());
+		
 		suite.addTest(org.eclipse.core.tests.internal.registry.AllTests.suite());
 		suite.addTest(org.eclipse.core.tests.runtime.session.AllTests.suite());
 		return suite;