Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2011-01-25 22:00:50 +0000
committerspingel2011-01-25 22:00:50 +0000
commitd42a83c0c186fe0c17aa373cd5ac63ad30084bb4 (patch)
treec9cc018c782f0c71125cc20385c53e0d42fcfe9a
parent504ecbb36d621e76cba48005faff1da3af309132 (diff)
downloadorg.eclipse.mylyn.incubator-d42a83c0c186fe0c17aa373cd5ac63ad30084bb4.tar.gz
org.eclipse.mylyn.incubator-d42a83c0c186fe0c17aa373cd5ac63ad30084bb4.tar.xz
org.eclipse.mylyn.incubator-d42a83c0c186fe0c17aa373cd5ac63ad30084bb4.zip
NEW - bug 335097: fix test failures on hudson
https://bugs.eclipse.org/bugs/show_bug.cgi?id=335097
-rw-r--r--org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/AllSandboxTests.java1
-rw-r--r--org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/RelationProviderTest.java66
2 files changed, 67 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/AllSandboxTests.java b/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/AllSandboxTests.java
index 71fcc47c..62e51576 100644
--- a/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/AllSandboxTests.java
+++ b/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/AllSandboxTests.java
@@ -33,6 +33,7 @@ public class AllSandboxTests {
suite.addTestSuite(ActiveSearchTest.class);
suite.addTestSuite(StatisticsReportingTest.class);
suite.addTestSuite(EclipseTaskRepositoryLinkProviderTest.class);
+ suite.addTestSuite(RelationProviderTest.class);
// web connector tests
suite.addTestSuite(NamedPatternTest.class);
diff --git a/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/RelationProviderTest.java b/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/RelationProviderTest.java
new file mode 100644
index 00000000..9d8be716
--- /dev/null
+++ b/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/RelationProviderTest.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.sandbox.tests;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.mylyn.context.core.ContextCore;
+import org.eclipse.mylyn.context.core.IInteractionElement;
+import org.eclipse.mylyn.internal.context.core.AbstractRelationProvider;
+import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
+import org.eclipse.mylyn.java.tests.AbstractJavaContextTest;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Mik Kersten
+ */
+public class RelationProviderTest extends AbstractJavaContextTest {
+
+ public void testEdgeReset() throws CoreException, InterruptedException, InvocationTargetException {
+ IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
+ IMethod m1 = type1.createMethod("public void m1() { }", null, true, null);
+ IPackageFragment p2 = project.createPackage("p2");
+
+ IType type2 = project.createType(p2, "Type2.java", "public class Type2 { }");
+ IMethod m2 = type2.createMethod("void m2() { }", null, true, null);
+
+ assertTrue(m1.exists());
+ assertEquals(1, type1.getMethods().length);
+
+ monitor.selectionChanged(part, new StructuredSelection(m1));
+ IInteractionElement m1Node = ContextCore.getContextManager().getElement(m1.getHandleIdentifier());
+ assertTrue(m1Node.getInterest().isInteresting());
+ monitor.selectionChanged(part, new StructuredSelection(m2));
+ IInteractionElement m2Node = ContextCore.getContextManager().getElement(m2.getHandleIdentifier());
+ manager.processInteractionEvent(mockInterestContribution(m2.getHandleIdentifier(), scaling.getLandmark()));
+ assertTrue(m2Node.getInterest().isLandmark());
+
+ AbstractRelationProvider provider = ContextCorePlugin.getDefault()
+ .getRelationProviders("java")
+ .iterator()
+ .next();
+ provider.createEdge(m2Node, m1Node.getContentType(), m2.getHandleIdentifier());
+
+ assertEquals(1, m2Node.getRelations().size());
+
+ manager.resetLandmarkRelationshipsOfKind(provider.getId());
+
+ assertEquals(0, m2Node.getRelations().size());
+ }
+
+}

Back to the top