Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2021-06-10 09:15:35 +0000
committerVincent Lorenzo2021-10-19 16:11:46 +0000
commitcb46a01da24d68a9d2a667b0dee75ec025753448 (patch)
tree1bffbe6ac35a247797edab9f68e7df024d336ab6 /tests/junit/plugins/infra/gmfdiag
parentf0aac4760efb80c37b0b62a569a158c22b38464a (diff)
downloadorg.eclipse.papyrus-cb46a01da24d68a9d2a667b0dee75ec025753448.tar.gz
org.eclipse.papyrus-cb46a01da24d68a9d2a667b0dee75ec025753448.tar.xz
org.eclipse.papyrus-cb46a01da24d68a9d2a667b0dee75ec025753448.zip
Bug 569174: [Toolsmiths] Papyrus integration of GMF Tooling - Fix Junit Tests
L1.2 clean up - FIX Junit tests org.eclipse.papyrus.infra.gmfdiag.canonical.tests.EditingInClassDiagramRegressionTest.createDependencyInClass (execute/undo/redo) Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr> Signed-off-by: Etienne Allogo <etienne.allogo@artal.fr> Change-Id: I50e5fb46c7f7dc286d977b60d5b1ea578d306000
Diffstat (limited to 'tests/junit/plugins/infra/gmfdiag')
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java70
1 files changed, 48 insertions, 22 deletions
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java
index 22c2d0b5816..5c5df93098c 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java
@@ -10,7 +10,7 @@
*
* Contributors:
* Christian W. Damus - Initial API and implementation
- * Vincent LORENZO (CEA LIST) - vincent.lorenzo@cea.fr - bug 569174
+ * Vincent LORENZO (CEA LIST) - vincent.lorenzo@cea.fr - bug 569174 - FIX Junit tests
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
@@ -43,6 +43,7 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.edit.command.AddCommand;
@@ -131,6 +132,7 @@ import com.google.common.util.concurrent.Futures;
/**
* Common implementation of canonical test cases.
*/
+@SuppressWarnings("deprecation")
public class AbstractCanonicalTest extends AbstractPapyrusTest {
@Rule
public final HouseKeeper houseKeeper = new HouseKeeper();
@@ -762,30 +764,54 @@ public class AbstractCanonicalTest extends AbstractPapyrusTest {
try {
URI classdiagram = URI.createPlatformPluginURI(String.format("/%s/model/classdiagram.gmfgen", UMLDiagramEditorPlugin.ID), true);
VisualIDOverride ov = UML2Util.load(rset, classdiagram, GenExtensionPackage.eINSTANCE.getVisualIDOverride());
- PapyrusgmfgenextensionSwitch<Class<? extends View>> typeSwitch = new PapyrusgmfgenextensionSwitch<>() {
-
- @Override
- public Class<? extends View> caseVisualIDOverride(VisualIDOverride object) {
- Class<? extends View> result = null;
- GenCommonBase base = object.getGenView();
- if (base instanceof GenDiagram) {
- result = Diagram.class;
- } else if (base instanceof GenTopLevelNode) {
- result = Node.class;
- } else if (base instanceof GenChildNode) {
- result = Node.class;
- } else if (base instanceof GenLink) {
- result = Edge.class;
- }
- if (result != null) {
- map.put(object.getVisualID(), result);
+ if (ov != null) {
+ PapyrusgmfgenextensionSwitch<Class<? extends View>> typeSwitch = new PapyrusgmfgenextensionSwitch<>() {
+
+ @Override
+ public Class<? extends View> caseVisualIDOverride(VisualIDOverride object) {
+ Class<? extends View> result = null;
+ GenCommonBase base = object.getGenView();
+ if (base instanceof GenDiagram) {
+ result = Diagram.class;
+ } else if (base instanceof GenTopLevelNode) {
+ result = Node.class;
+ } else if (base instanceof GenChildNode) {
+ result = Node.class;
+ } else if (base instanceof GenLink) {
+ result = Edge.class;
+ }
+ if (result != null) {
+ map.put(object.getVisualID(), result);
+ }
+ return result;
}
- return result;
+ };
+
+ for (Iterator<? extends EObject> iter = ov.eAllContents(); iter.hasNext();) {
+ typeSwitch.doSwitch(iter.next());
}
- };
+ } else {
+ Resource res = rset.getResource(classdiagram, true);
+ final TreeIterator<EObject> iter = res.getAllContents();
+ while (iter.hasNext()) {
+ final EObject base = iter.next();
+ if (base instanceof GenCommonBase) {
+ Class<? extends View> result = null;
+ if (base instanceof GenDiagram) {
+ result = Diagram.class;
+ } else if (base instanceof GenTopLevelNode) {
+ result = Node.class;
+ } else if (base instanceof GenChildNode) {
+ result = Node.class;
+ } else if (base instanceof GenLink) {
+ result = Edge.class;
+ }
+ if (result != null) {
+ map.put(((GenCommonBase) base).getVisualIDOverride(), result);
+ }
+ }
- for (Iterator<? extends EObject> iter = ov.eAllContents(); iter.hasNext();) {
- typeSwitch.doSwitch(iter.next());
+ }
}
} finally {
EMFHelper.unload(rset);

Back to the top