Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2015-01-14 19:26:45 +0000
committerMarkus Keller2015-01-14 19:32:59 +0000
commit6715f597963523a39a579e80fb579953fbe7fe15 (patch)
treeaaf8c6bff738dc2efa22152379de8ef9884ce4a2 /org.eclipse.ui.editors.tests
parent83d48d8e25fcde38af87c234a9450953d1488b2a (diff)
downloadeclipse.platform.text-6715f597963523a39a579e80fb579953fbe7fe15.tar.gz
eclipse.platform.text-6715f597963523a39a579e80fb579953fbe7fe15.tar.xz
eclipse.platform.text-6715f597963523a39a579e80fb579953fbe7fe15.zip
Bug 454488: Test failure due to conflicting marker updaters from EditorTestPlugin
Signed-off-by: Sarika Sinha <sarika.sinha@in.ibm.com>
Diffstat (limited to 'org.eclipse.ui.editors.tests')
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EditorTestPlugin.java25
-rw-r--r--org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java42
2 files changed, 42 insertions, 25 deletions
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EditorTestPlugin.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EditorTestPlugin.java
index 3550478f31b..fc602e869ae 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EditorTestPlugin.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/EditorTestPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 IBM Corporation and others.
+ * Copyright (c) 2014, 2015 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
@@ -10,15 +10,8 @@
*******************************************************************************/
package org.eclipse.ui.editors.tests;
-import java.io.BufferedInputStream;
-import java.lang.reflect.Field;
-
import org.osgi.framework.BundleContext;
-import org.eclipse.core.runtime.ContributorFactorySimple;
-import org.eclipse.core.runtime.IContributor;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
public class EditorTestPlugin extends Plugin {
@@ -43,22 +36,6 @@ public class EditorTestPlugin extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
fgPlugin= this;
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IContributor pointContributor= ContributorFactorySimple.createContributor(Long.toString(fgPlugin.getBundle().getBundleId()));
-
- try{
- BufferedInputStream bis= new BufferedInputStream(getClass().getResourceAsStream("plugin.xml"));
-
- Field field=
- org.eclipse.core.internal.registry.ExtensionRegistry.class
- .getDeclaredField("masterToken");
- field.setAccessible(true);
- Object masterToken= field.get(registry);
- registry.addContribution(bis, pointContributor, true, null, null, masterToken);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
}
public EditorTestPlugin() {
diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java
index 82a963471b7..c5172f57289 100644
--- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java
+++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/MarkerAnnotationOrderTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 IBM Corporation and others.
+ * Copyright (c) 2014, 2015 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.ui.editors.tests;
+import java.io.BufferedInputStream;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import junit.framework.Test;
@@ -18,7 +20,11 @@ import junit.framework.TestSuite;
import org.osgi.framework.Bundle;
+import org.eclipse.core.runtime.ContributorFactorySimple;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IContributor;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
@@ -36,10 +42,44 @@ import org.eclipse.ui.editors.text.EditorsUI;
public class MarkerAnnotationOrderTest extends TestCase {
+ IContributor pointContributor= null;
+
+ Object masterToken= null;
+
public static Test suite() {
return new TestSuite(MarkerAnnotationOrderTest.class);
}
+ protected void setUp() throws Exception {
+ //add the marker updater extension point
+ IExtensionRegistry registry= Platform.getExtensionRegistry();
+ pointContributor= ContributorFactorySimple.createContributor(Long.toString(EditorTestPlugin.getDefault().getBundle().getBundleId()));
+
+ try {
+ BufferedInputStream bis= new BufferedInputStream(getClass().getResourceAsStream("plugin.xml"));
+
+ Field field=
+ org.eclipse.core.internal.registry.ExtensionRegistry.class
+ .getDeclaredField("masterToken");
+ field.setAccessible(true);
+ masterToken= field.get(registry);
+ registry.addContribution(bis, pointContributor, true, null, null, masterToken);
+ } catch (Exception ex) {
+ fail("update marker setup failed to execute");
+ EditorTestPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, EditorTestPlugin.PLUGIN_ID, ex.getMessage()));
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ // remove the marker updater extension point
+ IExtensionRegistry registry= Platform.getExtensionRegistry();
+ IExtension[] extensions = registry.getExtensions(pointContributor);
+ for (int i= 0; i < extensions.length; i++) {
+ if ("org.eclipse.ui.editors.markerUpdaters".equals(extensions[i].getExtensionPointUniqueIdentifier()))
+ registry.removeExtension(extensions[i], masterToken);
+ }
+ }
+
public void testDirectDependency() {
final ArrayList list= new ArrayList(2);
Bundle bundle= Platform.getBundle(EditorsUI.PLUGIN_ID);

Back to the top