Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2017-06-12 15:09:57 +0000
committerChristian W. Damus2017-06-12 15:51:37 +0000
commite5c1907c9a8d7f682eda9fda33adc4033a960d4e (patch)
tree1b18b69e6f42d0af6d4e8ec8d18932f5679db192 /tests/junit/plugins/infra
parent53dcdceddb5b1bbe5eb75c9bb99add98eccf2763 (diff)
downloadorg.eclipse.papyrus-e5c1907c9a8d7f682eda9fda33adc4033a960d4e.tar.gz
org.eclipse.papyrus-e5c1907c9a8d7f682eda9fda33adc4033a960d4e.tar.xz
org.eclipse.papyrus-e5c1907c9a8d7f682eda9fda33adc4033a960d4e.zip
Bug 490804: [Composite Structure Diagram] copy paste properties from the diagram does not work
Ensure that the method-invocation-tracking Java proxies for UML model elements implement equals and hashCode as required by EMF. https://bugs.eclipse.org/bugs/show_bug.cgi?id=490804 Change-Id: Iaaa2cb2f86e6c14810f4b0bbf0d1c248c0f3ad51
Diffstat (limited to 'tests/junit/plugins/infra')
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/commands/tests/CustomUMLFactoryFixture.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/commands/tests/CustomUMLFactoryFixture.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/commands/tests/CustomUMLFactoryFixture.java
index 966b6ec48b4..7192db4b1c4 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/commands/tests/CustomUMLFactoryFixture.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/commands/tests/CustomUMLFactoryFixture.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
+ * Copyright (c) 2016, 2017 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 490804
*
*****************************************************************************/
@@ -120,8 +121,23 @@ public class CustomUMLFactoryFixture implements TestRule {
return Proxy.newProxyInstance(cl, new Class[] {
eClass.getInstanceClass(),
InternalEObject.class,
- }, (___, method1, args1) -> {
+ }, (proxy, method1, args1) -> {
recordInvocation(method1.getName());
+
+ // Be careful to implement equals() and hashCode() as
+ // expected by EMF
+ switch (method1.getName()) {
+ case "equals":
+ if (args.length == 1) {
+ return proxy == args1[0];
+ }
+ break;
+ case "hashCode":
+ if (args.length == 0) {
+ return System.identityHashCode(proxy);
+ }
+ break;
+ }
return method1.invoke(realObject, args1);
});
default:

Back to the top