Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2014-06-11 10:08:42 -0400
committerMikael Barbero2014-07-07 10:58:04 -0400
commit53b2de78c5c40e4c389afa2f30504ef8b3f8dc2d (patch)
treeb3cccb6b397b4f7394c5516d11bbf3d154ab521d
parentc2a6c7534afeeace113295a3f1f1127ce6286c07 (diff)
downloadorg.eclipse.emf.compare-53b2de78c5c40e4c389afa2f30504ef8b3f8dc2d.tar.gz
org.eclipse.emf.compare-53b2de78c5c40e4c389afa2f30504ef8b3f8dc2d.tar.xz
org.eclipse.emf.compare-53b2de78c5c40e4c389afa2f30504ef8b3f8dc2d.zip
FeatureMaps: FeatureMapChanges tests
Add feature map element in nodes.ecore Add core tests Change-Id: I61becd6b8f28cb8f494951493e8367759eaa2e4b
-rw-r--r--plugins/org.eclipse.emf.compare.tests/model/nodes.ecore46
-rw-r--r--plugins/org.eclipse.emf.compare.tests/model/nodes.genmodel10
-rw-r--r--plugins/org.eclipse.emf.compare.tests/plugin.xml7
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeFeatureMapContainment.java94
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeFeatureMapNonContainment.java94
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesFactory.java18
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesPackage.java282
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeFeatureMapContainmentImpl.java228
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeFeatureMapNonContainmentImpl.java224
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesFactoryImpl.java24
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesPackageImpl.java160
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesAdapterFactory.java36
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesSwitch.java44
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMaps2wayMergeTest.java1859
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMaps3wayMergeTest.java2632
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMapsConflictsMergeTest.java1846
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMapsPseudoConflictsMergeTest.java1993
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java312
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/ancestor.nodes4
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/left.nodes6
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/right.nodes6
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/ancestor.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/left.nodes21
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/right.nodes21
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/ancestor.nodes13
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/left.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/right.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/ancestor.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/left.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/right.nodes13
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/ancestor.nodes25
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/left.nodes25
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/right.nodes25
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/ancestor.nodes23
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/left.nodes23
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/right.nodes23
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/ancestor.nodes7
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/left.nodes6
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/right.nodes6
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/ancestor.nodes7
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/left.nodes7
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/right.nodes7
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/ancestor.nodes8
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/left.nodes9
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/right.nodes9
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/ancestor.nodes8
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/left.nodes9
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/right.nodes9
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/ancestor.nodes11
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/left.nodes11
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/right.nodes11
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/ancestor.nodes13
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/left.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/right.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/ancestor.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/left.nodes13
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/right.nodes13
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/ancestor.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/left.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/right.nodes17
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/ancestor.nodes21
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/left.nodes21
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/right.nodes21
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/ancestor.nodes20
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/left.nodes20
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/right.nodes20
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/ancestor.nodes6
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/left.nodes8
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/right.nodes8
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/ancestor.nodes29
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/left.nodes29
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/right.nodes29
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/ancestor.nodes9
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/left.nodes8
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/right.nodes8
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/ancestor.nodes15
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/left.nodes15
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/right.nodes15
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/ancestor.nodes16
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/left.nodes19
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/right.nodes19
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/ancestor.nodes19
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/left.nodes16
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/right.nodes16
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/ancestor.nodes24
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/left.nodes24
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/right.nodes24
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AllTests.java10
88 files changed, 10970 insertions, 7 deletions
diff --git a/plugins/org.eclipse.emf.compare.tests/model/nodes.ecore b/plugins/org.eclipse.emf.compare.tests/model/nodes.ecore
index 8320d5450..50cc4f36c 100644
--- a/plugins/org.eclipse.emf.compare.tests/model/nodes.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/model/nodes.ecore
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="nodes"
- nsURI="http://www.eclipse.org/emf/compare/tests/nodes" nsPrefix="nodes">
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="nodes" nsURI="http://www.eclipse.org/emf/compare/tests/nodes"
+ nsPrefix="nodes">
<eClassifiers xsi:type="ecore:EClass" name="Node">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
iD="true"/>
@@ -53,4 +52,43 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="destination" upperBound="-1"
eType="#//NodeOppositeRefManyToMany" eOpposite="#//NodeOppositeRefManyToMany/source"/>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeFeatureMapContainment" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="map" upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="group"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="firstKey" upperBound="-1"
+ eType="#//Node" volatile="true" transient="true" derived="true" containment="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="group" value="#map"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="secondKey" upperBound="-1"
+ eType="#//Node" volatile="true" transient="true" derived="true" containment="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="group" value="#map"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeFeatureMapNonContainment" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="mapNC" upperBound="-1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="kind" value="group"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="firstKeyNC" upperBound="-1"
+ eType="#//Node" volatile="true" transient="true" derived="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="group" value="#mapNC"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="secondKeyNC" upperBound="-1"
+ eType="#//Node" volatile="true" transient="true" derived="true">
+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+ <details key="group" value="#mapNC"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/model/nodes.genmodel b/plugins/org.eclipse.emf.compare.tests/model/nodes.genmodel
index f71641ec5..de52f0692 100644
--- a/plugins/org.eclipse.emf.compare.tests/model/nodes.genmodel
+++ b/plugins/org.eclipse.emf.compare.tests/model/nodes.genmodel
@@ -43,5 +43,15 @@
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefManyToMany/source"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeOppositeRefManyToMany/destination"/>
</genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeFeatureMapContainment">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute nodes.ecore#//NodeFeatureMapContainment/map"/>
+ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference nodes.ecore#//NodeFeatureMapContainment/firstKey"/>
+ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference nodes.ecore#//NodeFeatureMapContainment/secondKey"/>
+ </genClasses>
+ <genClasses ecoreClass="nodes.ecore#//NodeFeatureMapNonContainment">
+ <genFeatures property="None" createChild="false" ecoreFeature="ecore:EAttribute nodes.ecore#//NodeFeatureMapNonContainment/mapNC"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeFeatureMapNonContainment/firstKeyNC"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference nodes.ecore#//NodeFeatureMapNonContainment/secondKeyNC"/>
+ </genClasses>
</genPackages>
</genmodel:GenModel>
diff --git a/plugins/org.eclipse.emf.compare.tests/plugin.xml b/plugins/org.eclipse.emf.compare.tests/plugin.xml
index cff36fcb8..0ccf4a663 100644
--- a/plugins/org.eclipse.emf.compare.tests/plugin.xml
+++ b/plugins/org.eclipse.emf.compare.tests/plugin.xml
@@ -21,6 +21,13 @@
genModel="model/nodes.genmodel"/>
</extension>
+ <extension point="org.eclipse.emf.ecore.content_parser">
+ <!-- @generated nodes -->
+ <parser
+ contentTypeIdentifier="org.eclipse.emf.compare.test.nodes.contenttype"
+ class="org.eclipse.emf.compare.tests.nodes.util.NodesResourceFactoryImpl"/>
+ </extension>
+
<extension point="org.eclipse.emf.ecore.extension_parser">
<parser
type="nodes"
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeFeatureMapContainment.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeFeatureMapContainment.java
new file mode 100644
index 000000000..9dca7dd78
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeFeatureMapContainment.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.util.FeatureMap;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Feature Map Containment</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment#getMap <em>Map</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment#getFirstKey <em>First Key</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment#getSecondKey <em>Second Key</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeFeatureMapContainment()
+ * @model
+ * @generated
+ */
+public interface NodeFeatureMapContainment extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Map</b></em>' attribute list.
+ * The list contents are of type {@link org.eclipse.emf.ecore.util.FeatureMap.Entry}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map</em>' attribute list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Map</em>' attribute list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeFeatureMapContainment_Map()
+ * @model dataType="org.eclipse.emf.ecore.EFeatureMapEntry" many="true"
+ * extendedMetaData="kind='group'"
+ * @generated
+ */
+ FeatureMap getMap();
+
+ /**
+ * Returns the value of the '<em><b>First Key</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>First Key</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>First Key</em>' containment reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeFeatureMapContainment_FirstKey()
+ * @model containment="true" resolveProxies="true" transient="true" volatile="true" derived="true"
+ * extendedMetaData="group='#map'"
+ * @generated
+ */
+ EList<Node> getFirstKey();
+
+ /**
+ * Returns the value of the '<em><b>Second Key</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Second Key</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Second Key</em>' containment reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeFeatureMapContainment_SecondKey()
+ * @model containment="true" resolveProxies="true" transient="true" volatile="true" derived="true"
+ * extendedMetaData="group='#map'"
+ * @generated
+ */
+ EList<Node> getSecondKey();
+
+} // NodeFeatureMapContainment
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeFeatureMapNonContainment.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeFeatureMapNonContainment.java
new file mode 100644
index 000000000..f625a7e78
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodeFeatureMapNonContainment.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.util.FeatureMap;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Node Feature Map Non Containment</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment#getMapNC <em>Map NC</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment#getFirstKeyNC <em>First Key NC</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment#getSecondKeyNC <em>Second Key NC</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeFeatureMapNonContainment()
+ * @model
+ * @generated
+ */
+public interface NodeFeatureMapNonContainment extends Node {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Returns the value of the '<em><b>Map NC</b></em>' attribute list.
+ * The list contents are of type {@link org.eclipse.emf.ecore.util.FeatureMap.Entry}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map NC</em>' attribute list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Map NC</em>' attribute list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeFeatureMapNonContainment_MapNC()
+ * @model dataType="org.eclipse.emf.ecore.EFeatureMapEntry" many="true"
+ * extendedMetaData="kind='group'"
+ * @generated
+ */
+ FeatureMap getMapNC();
+
+ /**
+ * Returns the value of the '<em><b>First Key NC</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>First Key NC</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>First Key NC</em>' reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeFeatureMapNonContainment_FirstKeyNC()
+ * @model transient="true" volatile="true" derived="true"
+ * extendedMetaData="group='#mapNC'"
+ * @generated
+ */
+ EList<Node> getFirstKeyNC();
+
+ /**
+ * Returns the value of the '<em><b>Second Key NC</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.emf.compare.tests.nodes.Node}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Second Key NC</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Second Key NC</em>' reference list.
+ * @see org.eclipse.emf.compare.tests.nodes.NodesPackage#getNodeFeatureMapNonContainment_SecondKeyNC()
+ * @model transient="true" volatile="true" derived="true"
+ * extendedMetaData="group='#mapNC'"
+ * @generated
+ */
+ EList<Node> getSecondKeyNC();
+
+} // NodeFeatureMapNonContainment
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesFactory.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesFactory.java
index 00e88b927..14ad95ff5 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesFactory.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesFactory.java
@@ -127,6 +127,24 @@ public interface NodesFactory extends EFactory {
NodeOppositeRefManyToMany createNodeOppositeRefManyToMany();
/**
+ * Returns a new object of class '<em>Node Feature Map Containment</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Feature Map Containment</em>'.
+ * @generated
+ */
+ NodeFeatureMapContainment createNodeFeatureMapContainment();
+
+ /**
+ * Returns a new object of class '<em>Node Feature Map Non Containment</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Node Feature Map Non Containment</em>'.
+ * @generated
+ */
+ NodeFeatureMapNonContainment createNodeFeatureMapNonContainment();
+
+ /**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesPackage.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesPackage.java
index d5d0bff03..1ab82e1e8 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesPackage.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/NodesPackage.java
@@ -569,6 +569,134 @@ public interface NodesPackage extends EPackage {
int NODE_OPPOSITE_REF_MANY_TO_MANY_FEATURE_COUNT = NODE_FEATURE_COUNT + 2;
/**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapContainmentImpl <em>Node Feature Map Containment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapContainmentImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeFeatureMapContainment()
+ * @generated
+ */
+ int NODE_FEATURE_MAP_CONTAINMENT = 10;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_CONTAINMENT__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_CONTAINMENT__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Map</b></em>' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_CONTAINMENT__MAP = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>First Key</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_CONTAINMENT__FIRST_KEY = NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Second Key</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_CONTAINMENT__SECOND_KEY = NODE_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Node Feature Map Containment</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_CONTAINMENT_FEATURE_COUNT = NODE_FEATURE_COUNT + 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapNonContainmentImpl <em>Node Feature Map Non Containment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapNonContainmentImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeFeatureMapNonContainment()
+ * @generated
+ */
+ int NODE_FEATURE_MAP_NON_CONTAINMENT = 11;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_NON_CONTAINMENT__NAME = NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Containment Ref1</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_NON_CONTAINMENT__CONTAINMENT_REF1 = NODE__CONTAINMENT_REF1;
+
+ /**
+ * The feature id for the '<em><b>Map NC</b></em>' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_NON_CONTAINMENT__MAP_NC = NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>First Key NC</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_NON_CONTAINMENT__FIRST_KEY_NC = NODE_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Second Key NC</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_NON_CONTAINMENT__SECOND_KEY_NC = NODE_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Node Feature Map Non Containment</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NODE_FEATURE_MAP_NON_CONTAINMENT_FEATURE_COUNT = NODE_FEATURE_COUNT + 3;
+
+ /**
* Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.Node <em>Node</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -834,6 +962,92 @@ public interface NodesPackage extends EPackage {
EReference getNodeOppositeRefManyToMany_Destination();
/**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment <em>Node Feature Map Containment</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Feature Map Containment</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment
+ * @generated
+ */
+ EClass getNodeFeatureMapContainment();
+
+ /**
+ * Returns the meta object for the attribute list '{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment#getMap <em>Map</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute list '<em>Map</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment#getMap()
+ * @see #getNodeFeatureMapContainment()
+ * @generated
+ */
+ EAttribute getNodeFeatureMapContainment_Map();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment#getFirstKey <em>First Key</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>First Key</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment#getFirstKey()
+ * @see #getNodeFeatureMapContainment()
+ * @generated
+ */
+ EReference getNodeFeatureMapContainment_FirstKey();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment#getSecondKey <em>Second Key</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Second Key</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment#getSecondKey()
+ * @see #getNodeFeatureMapContainment()
+ * @generated
+ */
+ EReference getNodeFeatureMapContainment_SecondKey();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment <em>Node Feature Map Non Containment</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Node Feature Map Non Containment</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment
+ * @generated
+ */
+ EClass getNodeFeatureMapNonContainment();
+
+ /**
+ * Returns the meta object for the attribute list '{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment#getMapNC <em>Map NC</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute list '<em>Map NC</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment#getMapNC()
+ * @see #getNodeFeatureMapNonContainment()
+ * @generated
+ */
+ EAttribute getNodeFeatureMapNonContainment_MapNC();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment#getFirstKeyNC <em>First Key NC</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>First Key NC</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment#getFirstKeyNC()
+ * @see #getNodeFeatureMapNonContainment()
+ * @generated
+ */
+ EReference getNodeFeatureMapNonContainment_FirstKeyNC();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment#getSecondKeyNC <em>Second Key NC</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Second Key NC</em>'.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment#getSecondKeyNC()
+ * @see #getNodeFeatureMapNonContainment()
+ * @generated
+ */
+ EReference getNodeFeatureMapNonContainment_SecondKeyNC();
+
+ /**
* Returns the factory that creates the instances of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1075,6 +1289,74 @@ public interface NodesPackage extends EPackage {
*/
EReference NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION = eINSTANCE.getNodeOppositeRefManyToMany_Destination();
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapContainmentImpl <em>Node Feature Map Containment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapContainmentImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeFeatureMapContainment()
+ * @generated
+ */
+ EClass NODE_FEATURE_MAP_CONTAINMENT = eINSTANCE.getNodeFeatureMapContainment();
+
+ /**
+ * The meta object literal for the '<em><b>Map</b></em>' attribute list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute NODE_FEATURE_MAP_CONTAINMENT__MAP = eINSTANCE.getNodeFeatureMapContainment_Map();
+
+ /**
+ * The meta object literal for the '<em><b>First Key</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_FEATURE_MAP_CONTAINMENT__FIRST_KEY = eINSTANCE.getNodeFeatureMapContainment_FirstKey();
+
+ /**
+ * The meta object literal for the '<em><b>Second Key</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_FEATURE_MAP_CONTAINMENT__SECOND_KEY = eINSTANCE.getNodeFeatureMapContainment_SecondKey();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapNonContainmentImpl <em>Node Feature Map Non Containment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapNonContainmentImpl
+ * @see org.eclipse.emf.compare.tests.nodes.impl.NodesPackageImpl#getNodeFeatureMapNonContainment()
+ * @generated
+ */
+ EClass NODE_FEATURE_MAP_NON_CONTAINMENT = eINSTANCE.getNodeFeatureMapNonContainment();
+
+ /**
+ * The meta object literal for the '<em><b>Map NC</b></em>' attribute list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute NODE_FEATURE_MAP_NON_CONTAINMENT__MAP_NC = eINSTANCE.getNodeFeatureMapNonContainment_MapNC();
+
+ /**
+ * The meta object literal for the '<em><b>First Key NC</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_FEATURE_MAP_NON_CONTAINMENT__FIRST_KEY_NC = eINSTANCE.getNodeFeatureMapNonContainment_FirstKeyNC();
+
+ /**
+ * The meta object literal for the '<em><b>Second Key NC</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference NODE_FEATURE_MAP_NON_CONTAINMENT__SECOND_KEY_NC = eINSTANCE.getNodeFeatureMapNonContainment_SecondKeyNC();
+
}
} //NodesPackage
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeFeatureMapContainmentImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeFeatureMapContainmentImpl.java
new file mode 100644
index 000000000..d38033309
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeFeatureMapContainmentImpl.java
@@ -0,0 +1,228 @@
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.compare.tests.nodes.Node;
+import org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.util.BasicFeatureMap;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Feature Map Containment</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapContainmentImpl#getMap <em>Map</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapContainmentImpl#getFirstKey <em>First Key</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapContainmentImpl#getSecondKey <em>Second Key</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class NodeFeatureMapContainmentImpl extends NodeImpl implements NodeFeatureMapContainment {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached value of the '{@link #getMap() <em>Map</em>}' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMap()
+ * @generated
+ * @ordered
+ */
+ protected FeatureMap map;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeFeatureMapContainmentImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_FEATURE_MAP_CONTAINMENT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FeatureMap getMap() {
+ if (map == null) {
+ map = new BasicFeatureMap(this, NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__MAP);
+ }
+ return map;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Node> getFirstKey() {
+ return getMap().list(NodesPackage.Literals.NODE_FEATURE_MAP_CONTAINMENT__FIRST_KEY);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Node> getSecondKey() {
+ return getMap().list(NodesPackage.Literals.NODE_FEATURE_MAP_CONTAINMENT__SECOND_KEY);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__MAP:
+ return ((InternalEList<?>)getMap()).basicRemove(otherEnd, msgs);
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__FIRST_KEY:
+ return ((InternalEList<?>)getFirstKey()).basicRemove(otherEnd, msgs);
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__SECOND_KEY:
+ return ((InternalEList<?>)getSecondKey()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__MAP:
+ if (coreType) return getMap();
+ return ((FeatureMap.Internal)getMap()).getWrapper();
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__FIRST_KEY:
+ return getFirstKey();
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__SECOND_KEY:
+ return getSecondKey();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__MAP:
+ ((FeatureMap.Internal)getMap()).set(newValue);
+ return;
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__FIRST_KEY:
+ getFirstKey().clear();
+ getFirstKey().addAll((Collection<? extends Node>)newValue);
+ return;
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__SECOND_KEY:
+ getSecondKey().clear();
+ getSecondKey().addAll((Collection<? extends Node>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__MAP:
+ getMap().clear();
+ return;
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__FIRST_KEY:
+ getFirstKey().clear();
+ return;
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__SECOND_KEY:
+ getSecondKey().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__MAP:
+ return map != null && !map.isEmpty();
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__FIRST_KEY:
+ return !getFirstKey().isEmpty();
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT__SECOND_KEY:
+ return !getSecondKey().isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (map: "); //$NON-NLS-1$
+ result.append(map);
+ result.append(')');
+ return result.toString();
+ }
+
+} //NodeFeatureMapContainmentImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeFeatureMapNonContainmentImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeFeatureMapNonContainmentImpl.java
new file mode 100644
index 000000000..02151ceea
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodeFeatureMapNonContainmentImpl.java
@@ -0,0 +1,224 @@
+/**
+ * Copyright (c) 2011, 2012 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.nodes.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.compare.tests.nodes.Node;
+import org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.util.BasicFeatureMap;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Node Feature Map Non Containment</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapNonContainmentImpl#getMapNC <em>Map NC</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapNonContainmentImpl#getFirstKeyNC <em>First Key NC</em>}</li>
+ * <li>{@link org.eclipse.emf.compare.tests.nodes.impl.NodeFeatureMapNonContainmentImpl#getSecondKeyNC <em>Second Key NC</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class NodeFeatureMapNonContainmentImpl extends NodeImpl implements NodeFeatureMapNonContainment {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2011, 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The cached value of the '{@link #getMapNC() <em>Map NC</em>}' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapNC()
+ * @generated
+ * @ordered
+ */
+ protected FeatureMap mapNC;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NodeFeatureMapNonContainmentImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return NodesPackage.Literals.NODE_FEATURE_MAP_NON_CONTAINMENT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FeatureMap getMapNC() {
+ if (mapNC == null) {
+ mapNC = new BasicFeatureMap(this, NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__MAP_NC);
+ }
+ return mapNC;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Node> getFirstKeyNC() {
+ return getMapNC().list(NodesPackage.Literals.NODE_FEATURE_MAP_NON_CONTAINMENT__FIRST_KEY_NC);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Node> getSecondKeyNC() {
+ return getMapNC().list(NodesPackage.Literals.NODE_FEATURE_MAP_NON_CONTAINMENT__SECOND_KEY_NC);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__MAP_NC:
+ return ((InternalEList<?>)getMapNC()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__MAP_NC:
+ if (coreType) return getMapNC();
+ return ((FeatureMap.Internal)getMapNC()).getWrapper();
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__FIRST_KEY_NC:
+ return getFirstKeyNC();
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__SECOND_KEY_NC:
+ return getSecondKeyNC();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__MAP_NC:
+ ((FeatureMap.Internal)getMapNC()).set(newValue);
+ return;
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__FIRST_KEY_NC:
+ getFirstKeyNC().clear();
+ getFirstKeyNC().addAll((Collection<? extends Node>)newValue);
+ return;
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__SECOND_KEY_NC:
+ getSecondKeyNC().clear();
+ getSecondKeyNC().addAll((Collection<? extends Node>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__MAP_NC:
+ getMapNC().clear();
+ return;
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__FIRST_KEY_NC:
+ getFirstKeyNC().clear();
+ return;
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__SECOND_KEY_NC:
+ getSecondKeyNC().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__MAP_NC:
+ return mapNC != null && !mapNC.isEmpty();
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__FIRST_KEY_NC:
+ return !getFirstKeyNC().isEmpty();
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT__SECOND_KEY_NC:
+ return !getSecondKeyNC().isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (mapNC: "); //$NON-NLS-1$
+ result.append(mapNC);
+ result.append(')');
+ return result.toString();
+ }
+
+} //NodeFeatureMapNonContainmentImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesFactoryImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesFactoryImpl.java
index 2894e4dae..1bc0eb362 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesFactoryImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesFactoryImpl.java
@@ -42,7 +42,7 @@ public class NodesFactoryImpl extends EFactoryImpl implements NodesFactory {
*/
public static NodesFactory init() {
try {
- NodesFactory theNodesFactory = (NodesFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/compare/tests/nodes"); //$NON-NLS-1$
+ NodesFactory theNodesFactory = (NodesFactory)EPackage.Registry.INSTANCE.getEFactory(NodesPackage.eNS_URI);
if (theNodesFactory != null) {
return theNodesFactory;
}
@@ -81,6 +81,8 @@ public class NodesFactoryImpl extends EFactoryImpl implements NodesFactory {
case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_ONE: return createNodeOppositeRefOneToOne();
case NodesPackage.NODE_OPPOSITE_REF_ONE_TO_MANY: return createNodeOppositeRefOneToMany();
case NodesPackage.NODE_OPPOSITE_REF_MANY_TO_MANY: return createNodeOppositeRefManyToMany();
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT: return createNodeFeatureMapContainment();
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT: return createNodeFeatureMapNonContainment();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -191,6 +193,26 @@ public class NodesFactoryImpl extends EFactoryImpl implements NodesFactory {
* <!-- end-user-doc -->
* @generated
*/
+ public NodeFeatureMapContainment createNodeFeatureMapContainment() {
+ NodeFeatureMapContainmentImpl nodeFeatureMapContainment = new NodeFeatureMapContainmentImpl();
+ return nodeFeatureMapContainment;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NodeFeatureMapNonContainment createNodeFeatureMapNonContainment() {
+ NodeFeatureMapNonContainmentImpl nodeFeatureMapNonContainment = new NodeFeatureMapNonContainmentImpl();
+ return nodeFeatureMapNonContainment;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public NodesPackage getNodesPackage() {
return (NodesPackage)getEPackage();
}
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesPackageImpl.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesPackageImpl.java
index 4f02cf6cd..55e18645f 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesPackageImpl.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/impl/NodesPackageImpl.java
@@ -11,6 +11,8 @@
package org.eclipse.emf.compare.tests.nodes.impl;
import org.eclipse.emf.compare.tests.nodes.Node;
+import org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment;
+import org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment;
import org.eclipse.emf.compare.tests.nodes.NodeMultiValueReference;
import org.eclipse.emf.compare.tests.nodes.NodeMultiValuedAttribute;
import org.eclipse.emf.compare.tests.nodes.NodeMultipleContainment;
@@ -100,6 +102,20 @@ public class NodesPackageImpl extends EPackageImpl implements NodesPackage {
private EClass nodeOppositeRefManyToManyEClass = null;
/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeFeatureMapContainmentEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass nodeFeatureMapNonContainmentEClass = null;
+
+ /**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
@@ -358,6 +374,78 @@ public class NodesPackageImpl extends EPackageImpl implements NodesPackage {
}
/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeFeatureMapContainment() {
+ return nodeFeatureMapContainmentEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getNodeFeatureMapContainment_Map() {
+ return (EAttribute)nodeFeatureMapContainmentEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeFeatureMapContainment_FirstKey() {
+ return (EReference)nodeFeatureMapContainmentEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeFeatureMapContainment_SecondKey() {
+ return (EReference)nodeFeatureMapContainmentEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNodeFeatureMapNonContainment() {
+ return nodeFeatureMapNonContainmentEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getNodeFeatureMapNonContainment_MapNC() {
+ return (EAttribute)nodeFeatureMapNonContainmentEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeFeatureMapNonContainment_FirstKeyNC() {
+ return (EReference)nodeFeatureMapNonContainmentEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getNodeFeatureMapNonContainment_SecondKeyNC() {
+ return (EReference)nodeFeatureMapNonContainmentEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@@ -416,6 +504,16 @@ public class NodesPackageImpl extends EPackageImpl implements NodesPackage {
nodeOppositeRefManyToManyEClass = createEClass(NODE_OPPOSITE_REF_MANY_TO_MANY);
createEReference(nodeOppositeRefManyToManyEClass, NODE_OPPOSITE_REF_MANY_TO_MANY__SOURCE);
createEReference(nodeOppositeRefManyToManyEClass, NODE_OPPOSITE_REF_MANY_TO_MANY__DESTINATION);
+
+ nodeFeatureMapContainmentEClass = createEClass(NODE_FEATURE_MAP_CONTAINMENT);
+ createEAttribute(nodeFeatureMapContainmentEClass, NODE_FEATURE_MAP_CONTAINMENT__MAP);
+ createEReference(nodeFeatureMapContainmentEClass, NODE_FEATURE_MAP_CONTAINMENT__FIRST_KEY);
+ createEReference(nodeFeatureMapContainmentEClass, NODE_FEATURE_MAP_CONTAINMENT__SECOND_KEY);
+
+ nodeFeatureMapNonContainmentEClass = createEClass(NODE_FEATURE_MAP_NON_CONTAINMENT);
+ createEAttribute(nodeFeatureMapNonContainmentEClass, NODE_FEATURE_MAP_NON_CONTAINMENT__MAP_NC);
+ createEReference(nodeFeatureMapNonContainmentEClass, NODE_FEATURE_MAP_NON_CONTAINMENT__FIRST_KEY_NC);
+ createEReference(nodeFeatureMapNonContainmentEClass, NODE_FEATURE_MAP_NON_CONTAINMENT__SECOND_KEY_NC);
}
/**
@@ -453,6 +551,8 @@ public class NodesPackageImpl extends EPackageImpl implements NodesPackage {
nodeOppositeRefOneToOneEClass.getESuperTypes().add(this.getNode());
nodeOppositeRefOneToManyEClass.getESuperTypes().add(this.getNode());
nodeOppositeRefManyToManyEClass.getESuperTypes().add(this.getNode());
+ nodeFeatureMapContainmentEClass.getESuperTypes().add(this.getNode());
+ nodeFeatureMapNonContainmentEClass.getESuperTypes().add(this.getNode());
// Initialize classes and features; add operations and parameters
initEClass(nodeEClass, Node.class, "Node", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
@@ -490,8 +590,68 @@ public class NodesPackageImpl extends EPackageImpl implements NodesPackage {
initEReference(getNodeOppositeRefManyToMany_Source(), this.getNodeOppositeRefManyToMany(), this.getNodeOppositeRefManyToMany_Destination(), "source", null, 0, -1, NodeOppositeRefManyToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(getNodeOppositeRefManyToMany_Destination(), this.getNodeOppositeRefManyToMany(), this.getNodeOppositeRefManyToMany_Source(), "destination", null, 0, -1, NodeOppositeRefManyToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEClass(nodeFeatureMapContainmentEClass, NodeFeatureMapContainment.class, "NodeFeatureMapContainment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(getNodeFeatureMapContainment_Map(), ecorePackage.getEFeatureMapEntry(), "map", null, 0, -1, NodeFeatureMapContainment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getNodeFeatureMapContainment_FirstKey(), this.getNode(), null, "firstKey", null, 0, -1, NodeFeatureMapContainment.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getNodeFeatureMapContainment_SecondKey(), this.getNode(), null, "secondKey", null, 0, -1, NodeFeatureMapContainment.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
+ initEClass(nodeFeatureMapNonContainmentEClass, NodeFeatureMapNonContainment.class, "NodeFeatureMapNonContainment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(getNodeFeatureMapNonContainment_MapNC(), ecorePackage.getEFeatureMapEntry(), "mapNC", null, 0, -1, NodeFeatureMapNonContainment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getNodeFeatureMapNonContainment_FirstKeyNC(), this.getNode(), null, "firstKeyNC", null, 0, -1, NodeFeatureMapNonContainment.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getNodeFeatureMapNonContainment_SecondKeyNC(), this.getNode(), null, "secondKeyNC", null, 0, -1, NodeFeatureMapNonContainment.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+
// Create resource
createResource(eNS_URI);
+
+ // Create annotations
+ // http:///org/eclipse/emf/ecore/util/ExtendedMetaData
+ createExtendedMetaDataAnnotations();
+ }
+
+ /**
+ * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void createExtendedMetaDataAnnotations() {
+ String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; //$NON-NLS-1$
+ addAnnotation
+ (getNodeFeatureMapContainment_Map(),
+ source,
+ new String[] {
+ "kind", "group" //$NON-NLS-1$ //$NON-NLS-2$
+ });
+ addAnnotation
+ (getNodeFeatureMapContainment_FirstKey(),
+ source,
+ new String[] {
+ "group", "#map" //$NON-NLS-1$ //$NON-NLS-2$
+ });
+ addAnnotation
+ (getNodeFeatureMapContainment_SecondKey(),
+ source,
+ new String[] {
+ "group", "#map" //$NON-NLS-1$ //$NON-NLS-2$
+ });
+ addAnnotation
+ (getNodeFeatureMapNonContainment_MapNC(),
+ source,
+ new String[] {
+ "kind", "group" //$NON-NLS-1$ //$NON-NLS-2$
+ });
+ addAnnotation
+ (getNodeFeatureMapNonContainment_FirstKeyNC(),
+ source,
+ new String[] {
+ "group", "#mapNC" //$NON-NLS-1$ //$NON-NLS-2$
+ });
+ addAnnotation
+ (getNodeFeatureMapNonContainment_SecondKeyNC(),
+ source,
+ new String[] {
+ "group", "#mapNC" //$NON-NLS-1$ //$NON-NLS-2$
+ });
}
} // NodesPackageImpl
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesAdapterFactory.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesAdapterFactory.java
index 46337637a..63e4bc30a 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesAdapterFactory.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesAdapterFactory.java
@@ -123,6 +123,14 @@ public class NodesAdapterFactory extends AdapterFactoryImpl {
return createNodeOppositeRefManyToManyAdapter();
}
@Override
+ public Adapter caseNodeFeatureMapContainment(NodeFeatureMapContainment object) {
+ return createNodeFeatureMapContainmentAdapter();
+ }
+ @Override
+ public Adapter caseNodeFeatureMapNonContainment(NodeFeatureMapNonContainment object) {
+ return createNodeFeatureMapNonContainmentAdapter();
+ }
+ @Override
public Adapter defaultCase(EObject object) {
return createEObjectAdapter();
}
@@ -283,6 +291,34 @@ public class NodesAdapterFactory extends AdapterFactoryImpl {
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment <em>Node Feature Map Containment</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeFeatureMapContainment
+ * @generated
+ */
+ public Adapter createNodeFeatureMapContainmentAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment <em>Node Feature Map Non Containment</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.tests.nodes.NodeFeatureMapNonContainment
+ * @generated
+ */
+ public Adapter createNodeFeatureMapNonContainmentAdapter() {
+ return null;
+ }
+
+ /**
* Creates a new adapter for the default case.
* <!-- begin-user-doc -->
* This default implementation returns null.
diff --git a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesSwitch.java b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesSwitch.java
index 91ab17f99..dd37e5e23 100644
--- a/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesSwitch.java
+++ b/plugins/org.eclipse.emf.compare.tests/src-gen/org/eclipse/emf/compare/tests/nodes/util/NodesSwitch.java
@@ -169,6 +169,20 @@ public class NodesSwitch<T> {
if (result == null) result = defaultCase(theEObject);
return result;
}
+ case NodesPackage.NODE_FEATURE_MAP_CONTAINMENT: {
+ NodeFeatureMapContainment nodeFeatureMapContainment = (NodeFeatureMapContainment)theEObject;
+ T result = caseNodeFeatureMapContainment(nodeFeatureMapContainment);
+ if (result == null) result = caseNode(nodeFeatureMapContainment);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case NodesPackage.NODE_FEATURE_MAP_NON_CONTAINMENT: {
+ NodeFeatureMapNonContainment nodeFeatureMapNonContainment = (NodeFeatureMapNonContainment)theEObject;
+ T result = caseNodeFeatureMapNonContainment(nodeFeatureMapNonContainment);
+ if (result == null) result = caseNode(nodeFeatureMapNonContainment);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
default: return defaultCase(theEObject);
}
}
@@ -324,6 +338,36 @@ public class NodesSwitch<T> {
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>Node Feature Map Containment</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Feature Map Containment</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeFeatureMapContainment(NodeFeatureMapContainment object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Node Feature Map Non Containment</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Node Feature Map Non Containment</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNodeFeatureMapNonContainment(NodeFeatureMapNonContainment object) {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMaps2wayMergeTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMaps2wayMergeTest.java
new file mode 100644
index 000000000..72e24f0d4
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMaps2wayMergeTest.java
@@ -0,0 +1,1859 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.merge;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.FeatureMapChange;
+import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.ecore.util.BasicFeatureMap;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.junit.Test;
+
+/**
+ * A FeatureMapChange is always associated with a ReferenceChange. The FeatureMapChange is equivalent to his
+ * ReferenceChange and vice-versa. Each case will be done on the FeatureMapChange and on the ReferenceChange.
+ */
+@SuppressWarnings({"nls", "rawtypes" })
+public class FeatureMaps2wayMergeTest {
+
+ private IndividualDiffInputData input = new IndividualDiffInputData();
+
+ private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+
+ @Test
+ public void test2wayContainmentAdd_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (delete diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right add detected in 3-way is a delete in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.ADD),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey add] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentAdd_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (delete diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right add detected in 3-way is a delete in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.ADD),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map add] from left to right : the ReferenceChange
+ // Node node1[firstKey add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentAdd_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (delete diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right add detected in 3-way is a delete in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.ADD),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey add] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still doesn't exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertEquals(0, ((Collection)firstKey).size());
+ // mapNode1 doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(0, ((BasicFeatureMap)map).size(eSFFirstKey));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentAdd_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (delete diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right add detected in 3-way is a delete in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.ADD),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map add] from right to left : the
+ // ReferenceChange Node node1[firstKey add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still doesn't exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertEquals(0, ((Collection)firstKey).size());
+ // mapNode1 doesn't contains node1 through the map in right
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(0, ((BasicFeatureMap)map).size(eSFFirstKey));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentDelete_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 delete diffs, 2 add diffs (add diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right delete detected in 3-way is a add in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.DELETE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2[firstKey delete] from left to right : the FeatureMapChange
+ // <firstKey> Node node2 [map delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 doesn't still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNull(leftNode2);
+ // node2 doesn't exists anymore in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNull(rightNode2);
+ // mapNode1 doesn't contains node2 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertEquals(0, ((Collection)firstKey).size());
+ // mapNode1 doesn't contains node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(0, ((BasicFeatureMap)map).size(eSFFirstKey));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentDelete_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 delete diffs, 2 add diffs (add diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right delete detected in 3-way is a add in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.DELETE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map delete] from left to right : the
+ // ReferenceChange Node node2[firstKey delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 doesn't still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNull(leftNode2);
+ // node2 doesn't exists anymore in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNull(rightNode2);
+ // mapNode1 doesn't contains node2 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertEquals(0, ((Collection)firstKey).size());
+ // mapNode1 doesn't contains node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(0, ((BasicFeatureMap)map).size(eSFFirstKey));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentDelete_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 delete diffs, 2 add diffs (add diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right delete detected in 3-way is a add in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.DELETE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2[firstKey delete] from right to left: the FeatureMapChange
+ // <firstKey> Node node2 [map delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // node2 exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // mapNode1 contains node2 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(leftNode2));
+ // mapNode1 contains node2 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, leftNode2));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentDelete_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 delete diffs, 2 add diffs (add diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right delete detected in 3-way is a add in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.DELETE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the ReferenceChange Node node2[firstKey delete] from right to left: the FeatureMapChange
+ // <firstKey> Node node2 [map delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // node2 exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // mapNode1 contains node2 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(leftNode2));
+ // mapNode1 contains node2 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, leftNode2));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentKeyChange_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 move diffs, 2 key change diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right move/key changes detected in 3-way are a simple move/key changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map entry key change] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentKeyChange_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 move diffs, 2 key change diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right move/key changes detected in 3-way are a simple move/key changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.CHANGE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map entry key change] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentKeyChange_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 move diffs, 2 key change diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right move/key changes detected in 3-way are a simple move/key changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map entry key change] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode1 contains node1 through the feature secondKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFSecondKey = leftMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object secondKey = leftMapNode1.eGet(eSFSecondKey);
+ assertTrue(secondKey instanceof Collection);
+ assertTrue(((Collection)secondKey).contains(leftNode1));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFSecondKey, leftNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentKeyChange_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 move diffs, 2 key change diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right move/key changes detected in 3-way are a simple move/key changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.CHANGE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map entry key change] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode1 contains node1 through the feature secondKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFSecondKey = leftMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object secondKey = leftMapNode1.eGet(eSFSecondKey);
+ assertTrue(secondKey instanceof Collection);
+ assertTrue(((Collection)secondKey).contains(leftNode1));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFSecondKey, leftNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMove_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMove_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMove_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode2 contains node1 through the feature firstKey in left
+ final EObject leftMapNode2 = getNodeNamed(left, "mapNode2");
+ assertNotNull(leftMapNode2);
+ final EStructuralFeature eSFFirstKey = leftMapNode2.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode2.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(leftNode1));
+ // mapNode2 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode2.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode2.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, leftNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMove_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from right to left : the
+ // ReferenceChange Node node1[firstKey move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode2 contains node1 through the feature firstKey in left
+ final EObject leftMapNode2 = getNodeNamed(left, "mapNode2");
+ assertNotNull(leftMapNode2);
+ final EStructuralFeature eSFFirstKey = leftMapNode2.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode2.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(leftNode1));
+ // mapNode2 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode2.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode2.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, leftNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMoveOrder_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right, in the last position
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof List);
+ assertEquals(2, ((List)firstKey).size());
+ assertEquals(rightNode1, ((List)firstKey).get(1));
+ // mapNode1 contains node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMoveOrder_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right, in the last position
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof List);
+ assertEquals(2, ((List)firstKey).size());
+ assertEquals(rightNode1, ((List)firstKey).get(1));
+ // mapNode1 contains node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMoveOrder_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode1 contains node1 through the feature firstKey in left, in the first position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof List);
+ assertEquals(2, ((List)firstKey).size());
+ assertEquals(leftNode1, ((List)firstKey).get(0));
+ // mapNode1 contains node1 through the map in left, in the first position
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMoveOrder_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from right to left : the
+ // ReferenceChange Node node1[firstKey move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode1 contains node1 through the feature firstKey in left, in the first position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof List);
+ assertEquals(2, ((List)firstKey).size());
+ assertEquals(leftNode1, ((List)firstKey).get(0));
+ // mapNode1 contains node1 through the map in left, in the first position
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMoveKeyChange_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMoveKeyChange_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMoveKeyChange_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode2 contains node1 through the feature secondKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode2");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFSecondKey = rightMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object firstKey = rightMapNode1.eGet(eSFSecondKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode2 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFSecondKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayContainmentMoveKeyChange_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode2 contains node1 through the feature secondKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode2");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFSecondKey = rightMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object firstKey = rightMapNode1.eGet(eSFSecondKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode2 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFSecondKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentAdd_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (delete diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right add detected in 3-way is a delete in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.ADD),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey add] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(0));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(1));
+ // mapNode1 references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 0, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentAdd_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (delete diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right add detected in 3-way is a delete in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.ADD),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map add] from left to right : the ReferenceChange
+ // Node node1[firstKey add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(0));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(1));
+ // mapNode1 references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 0, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentAdd_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (delete diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right add detected in 3-way is a delete in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.ADD),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey add] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(0, ((List)leftFirstKey).size());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ // mapNode1 references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(0, ((BasicFeatureMap)leftMap).size());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentAdd_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (delete diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the right add detected in 3-way is a delete in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.ADD),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map add] from right to left : the ReferenceChange
+ // Node node1[firstKey add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(0, ((List)leftFirstKey).size());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ // mapNode1 references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(0, ((BasicFeatureMap)leftMap).size());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentDelete_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (add diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the left delete detected in 3-way is a add in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.DELETE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2[firstKey delete] from left to right : the FeatureMapChange
+ // <firstKey> Node node2 [map delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(0, ((List)rightFirstKey).size());
+ // mapNode1 references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(0, ((BasicFeatureMap)rightMap).size());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentDelete_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (add diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the left delete detected in 3-way is a add in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.DELETE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map delete] from left to right : the
+ // ReferenceChange Node node2[firstKey delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(0, ((List)rightFirstKey).size());
+ // mapNode1 references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(0, ((BasicFeatureMap)rightMap).size());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentDelete_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (add diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the left delete detected in 3-way is a add in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.DELETE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2[firstKey delete] from right to left : the FeatureMapChange
+ // <firstKey> Node node2 [map delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode2, ((List)leftFirstKey).get(1));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ assertEquals(rightNode2, ((List)rightFirstKey).get(0));
+ // mapNode1 references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode2, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 1, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode2, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentDelete_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 2 add diffs, 2 delete diffs (add diffs are detected because same models are used for 2-way
+ // and 3-way comparison, so the left delete detected in 3-way is a add in 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.DELETE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map delete] from right to left : the
+ // ReferenceChange Node node2[firstKey delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode2, ((List)leftFirstKey).get(1));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ assertEquals(rightNode2, ((List)rightFirstKey).get(0));
+ // mapNode1 references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode2, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 1, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode2, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentMoveOrder_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right, in the last position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(1));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(1));
+ // mapNode1 references node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 1, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentMoveOrder_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right, in the last position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(1));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(1));
+ // mapNode1 references node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 1, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentMoveOrder_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right, in the last position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(0));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(0));
+ // mapNode1 references node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 0, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test2wayNonContainmentMoveOrder_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, null);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // 4 moves diffs (detected because same models are used for 2-way and 3-way
+ // comparison, so the right moves changes detected in 3-way are the same changes in
+ // 2-way).
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(ofKind(DifferenceKind.MOVE),
+ instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from right to left : the
+ // ReferenceChange Node node1[firstKey move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right, in the last position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(0));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(0));
+ // mapNode1 references node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 0, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ private EObject getNodeNamed(Resource res, String name) {
+ final Iterator<EObject> iterator = EcoreUtil.getAllProperContents(res, false);
+ while (iterator.hasNext()) {
+ final EObject next = iterator.next();
+ final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
+ if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
+ return next;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMaps3wayMergeTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMaps3wayMergeTest.java
new file mode 100644
index 000000000..6764d2d64
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMaps3wayMergeTest.java
@@ -0,0 +1,2632 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.merge;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.ComparePackage;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.FeatureMapChange;
+import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+import org.eclipse.emf.compare.tests.nodes.util.NodesResourceFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.ecore.util.BasicFeatureMap;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * A FeatureMapChange is always associated with a ReferenceChange. The FeatureMapChange is equivalent to his
+ * ReferenceChange and vice-versa. Each case will be done on the FeatureMapChange and on the ReferenceChange.
+ */
+@SuppressWarnings({"nls", "rawtypes", "unchecked" })
+public class FeatureMaps3wayMergeTest {
+
+ @BeforeClass
+ public static void fillEMFRegistries() {
+ EPackage.Registry.INSTANCE.put(ComparePackage.eNS_URI, ComparePackage.eINSTANCE);
+ EPackage.Registry.INSTANCE.put(NodesPackage.eNS_URI, NodesPackage.eINSTANCE);
+
+ Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("nodes", //$NON-NLS-1$
+ new NodesResourceFactoryImpl());
+ }
+
+ private IndividualDiffInputData input = new IndividualDiffInputData();
+
+ private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+
+ @Test
+ public void test3wayContainmentAdd_Left_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey add] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentAdd_Right_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2[firstKey add] from left to right : the FeatureMapChange
+ // <firstKey> Node node2 [map add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 still doesn't exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNull(leftNode2);
+ // node2 doesn't exists anymore in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNull(rightNode2);
+ // mapNode1 contains node2 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).isEmpty());
+ // mapNode1 contains node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentAdd_Left_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map add] from left to right : the ReferenceChange
+ // Node node1[firstKey add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentAdd_Right_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map add] from left to right : the ReferenceChange
+ // Node node2 [firstKey add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 doesn't still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNull(leftNode2);
+ // node2 doesn't exists anymore in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNull(rightNode2);
+ // mapNode1 doesn't contains node2 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).isEmpty());
+ // mapNode1 doesn't contains node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentAdd_Left_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey add] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still doesn't exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentAdd_Right_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2 [firstKey add] from right to left : the FeatureMapChange
+ // <firstKey> Node node2 [map add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // node2 exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // mapNode1 contains node2 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(leftNode2));
+ // mapNode1 contains node2 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).contains(eSFFirstKey, leftNode2));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentAdd_Left_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map add] from right to left : the
+ // ReferenceChange Node node1[firstKey add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still doesn't exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentAdd_Right_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftAddScope();
+ final Resource right = input.getFeatureMapContainmentRightAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map add] from right to left : the
+ // ReferenceChange Node node2 [firstKey add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // node2 exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // mapNode1 contains node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(leftNode2));
+ // mapNode1 contains node2 through the map in right
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).contains(eSFFirstKey, leftNode2));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentDelete_Left_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2 [firstKey delete] from left to right : the FeatureMapChange
+ // <firstKey> Node node2 [map delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 doesn't still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNull(leftNode2);
+ // node2 deosn't exists anymore in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNull(rightNode2);
+ // mapNode1 doesn't contains node2 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).isEmpty());
+ // mapNode1 doesn't contains node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentDelete_Right_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1 [firstKey delete] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).contains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentDelete_Left_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map delete] from left to right : the
+ // ReferenceChange Node node2 [firstKey delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 doesn't still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNull(leftNode2);
+ // node2 deosn't exists anymore in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNull(rightNode2);
+ // mapNode1 doesn't contains node2 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).isEmpty());
+ // mapNode1 doesn't contains node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentDelete_Right_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map delete] from left to right : the
+ // ReferenceChange Node node2 [firstKey delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).contains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentDelete_Left_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2 [firstKey delete] from right to left: the FeatureMapChange
+ // <firstKey> Node node2 [map delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // node2 exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // mapNode1 contains node2 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(leftNode2));
+ // mapNode1 contains node2 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, leftNode2));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentDelete_Right_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1 [firstKey delete] from right to left: the FeatureMapChange
+ // <firstKey> Node node1 [map delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 doesn't still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentDelete_Left_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map delete] from right to left: the
+ // ReferenceChange Node node2 [firstKey delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // node2 exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // mapNode1 contains node2 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(leftNode2));
+ // mapNode1 contains node2 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, leftNode2));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentDelete_Right_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map delete] from right to left: the
+ // ReferenceChange Node node1 [firstKey delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 doesn't still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentKeyChange_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map entry key change] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentKeyChange_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.CHANGE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map entry key change] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentKeyChange_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map entry key change] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode1 contains node1 through the feature secondKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFSecondKey = leftMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object secondKey = leftMapNode1.eGet(eSFSecondKey);
+ assertTrue(secondKey instanceof Collection);
+ assertTrue(((Collection)secondKey).contains(leftNode1));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFSecondKey, leftNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentKeyChange_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.CHANGE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map entry key change] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode1 contains node1 through the feature secondKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFSecondKey = leftMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object secondKey = leftMapNode1.eGet(eSFSecondKey);
+ assertTrue(secondKey instanceof Collection);
+ assertTrue(((Collection)secondKey).contains(leftNode1));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFSecondKey, leftNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMove_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMove_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMove_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode2 contains node1 through the feature firstKey in left
+ final EObject leftMapNode2 = getNodeNamed(left, "mapNode2");
+ assertNotNull(leftMapNode2);
+ final EStructuralFeature eSFFirstKey = leftMapNode2.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode2.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(leftNode1));
+ // mapNode2 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode2.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode2.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, leftNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMove_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from right to left : the
+ // ReferenceChange Node node1[firstKey move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode2 contains node1 through the feature firstKey in left
+ final EObject leftMapNode2 = getNodeNamed(left, "mapNode2");
+ assertNotNull(leftMapNode2);
+ final EStructuralFeature eSFFirstKey = leftMapNode2.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode2.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(leftNode1));
+ // mapNode2 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode2.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode2.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, leftNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMoveOrder_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveOrderScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1 [firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right, in the last position
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof List);
+ assertEquals(2, ((List)firstKey).size());
+ assertEquals(rightNode1, ((List)firstKey).get(1));
+ // mapNode1 contains node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMoveOrder_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveOrderScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right, in the last position
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof List);
+ assertEquals(2, ((List)firstKey).size());
+ assertEquals(rightNode1, ((List)firstKey).get(1));
+ // mapNode1 contains node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMoveOrder_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveOrderScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode1 contains node1 through the feature firstKey in left, in the first position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof List);
+ assertEquals(2, ((List)firstKey).size());
+ assertEquals(leftNode1, ((List)firstKey).get(0));
+ // mapNode1 contains node1 through the map in left, in the first position
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMoveOrder_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveOrderScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from right to left : the
+ // ReferenceChange Node node1[firstKey move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // mapNode1 contains node1 through the feature firstKey in left, in the first position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof List);
+ assertEquals(2, ((List)firstKey).size());
+ assertEquals(leftNode1, ((List)firstKey).get(0));
+ // mapNode1 contains node1 through the map in left, in the first position
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = leftMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMoveKeyChange_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMoveKeyChange_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey move] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode2 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode2");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFSecondKey = rightMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object firstKey = rightMapNode1.eGet(eSFSecondKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode2 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFSecondKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMoveKeyChange_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from right to left : the
+ // ReferenceChange Node node1[firstKey move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode2 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode2");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFSecondKey = rightMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object firstKey = rightMapNode1.eGet(eSFSecondKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode2 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFSecondKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayContainmentMoveKeyChange_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftMoveKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightMoveKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginMoveKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object firstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(firstKey instanceof Collection);
+ assertTrue(((Collection)firstKey).contains(rightNode1));
+ // mapNode1 contains node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object map = rightMapNode1.eGet(eSFmap);
+ assertTrue(map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)map).basicContains(eSFFirstKey, rightNode1));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentAdd_Left_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey add] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(0));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(1));
+ // mapNode1 references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 0, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentAdd_Right_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2 [firstKey add] from left to right : the FeatureMapChange
+ // <firstKey> Node node2 [map add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 doesn't references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ assertFalse(((List)leftFirstKey).contains(leftNode2));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertTrue(((List)rightFirstKey).isEmpty());
+ // mapNode1 doesn't references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ assertFalse(((BasicFeatureMap)leftMap).contains(eSFFirstKey, leftNode2));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMap).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentAdd_Left_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map add] from left to right : the ReferenceChange
+ // Node node1[firstKey add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(0));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(1));
+ // mapNode1 references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 0, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentAdd_Right_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map add] from left to right : the ReferenceChange
+ // Node node1[firstKey add] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 doesn't references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ assertFalse(((List)leftFirstKey).contains(leftNode2));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertTrue(((List)rightFirstKey).isEmpty());
+ // mapNode1 doesn't references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ assertFalse(((BasicFeatureMap)leftMap).contains(eSFFirstKey, leftNode2));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMap).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentAdd_Left_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1[firstKey add] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(0, ((List)leftFirstKey).size());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ // mapNode1 references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(0, ((BasicFeatureMap)leftMap).size());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentAdd_Right_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2 [firstKey add] from right to left : the FeatureMapChange
+ // <firstKey> Node node2 [map add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode2, ((List)leftFirstKey).get(1));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ assertEquals(rightNode2, ((List)rightFirstKey).get(0));
+ // mapNode1 references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode2, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 1, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode2, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentAdd_Left_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map add] from right to left : the ReferenceChange
+ // Node node1[firstKey add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(0, ((List)leftFirstKey).size());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ // mapNode1 references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(0, ((BasicFeatureMap)leftMap).size());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentAdd_Right_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map add] from right to left : the ReferenceChange
+ // Node node1[firstKey add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode2, ((List)leftFirstKey).get(1));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ assertEquals(rightNode2, ((List)rightFirstKey).get(0));
+ // mapNode1 references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode2, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 1, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode2, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentDelete_Left_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2 [firstKey delete] from left to right : the FeatureMapChange
+ // <firstKey> Node node2 [map delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 doesn't references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertTrue(((List)rightFirstKey).isEmpty());
+ // mapNode1 doesn't references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMap).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentDelete_Right_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1 [firstKey delete] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(1));
+ // mapNode1 references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentDelete_Left_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map delete] from left to right : the
+ // ReferenceChange Node node2 [firstKey delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 doesn't references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertTrue(((List)rightFirstKey).isEmpty());
+ // mapNode1 doesn't references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMap).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentDelete_Right_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map delete] from left to right : the
+ // ReferenceChange Node node1 [firstKey delete] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(1, ((List)leftFirstKey).size());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(1));
+ // mapNode1 references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMap).size());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentDelete_Left_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node2 [firstKey delete] from right to left : the FeatureMapChange
+ // <firstKey> Node node2 [map delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode2, ((List)leftFirstKey).get(1));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ assertEquals(rightNode2, ((List)rightFirstKey).get(0));
+ // mapNode1 references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode2, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 1, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode2, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentDelete_Right_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1 [firstKey delete] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertTrue(((List)leftFirstKey).isEmpty());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ // mapNode1 doesn't references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMap).isEmpty());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentDelete_Left_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map delete] from right to left : the
+ // ReferenceChange Node node2 [firstKey delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node2 still exists in left
+ final EObject leftNode2 = getNodeNamed(left, "node2");
+ assertNotNull(leftNode2);
+ // node2 still exists in right
+ final EObject rightNode2 = getNodeNamed(right, "node2");
+ assertNotNull(rightNode2);
+ // mapNode1 references node2 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode2, ((List)leftFirstKey).get(1));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ assertEquals(rightNode2, ((List)rightFirstKey).get(0));
+ // mapNode1 references node2 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode2, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 1, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode2, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentDelete_Right_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node2 [map delete] from right to left : the
+ // ReferenceChange Node node2 [firstKey delete] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't references node1 through the feature firstKey in right
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertTrue(((List)leftFirstKey).isEmpty());
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(1, ((List)rightFirstKey).size());
+ // mapNode1 doesn't references node1 through the map in right
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMap).isEmpty());
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMap).size());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentMoveOrder_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightMoveOrderScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1 [firstKey move] from left to right : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right, in the last position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(1));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(1));
+ // mapNode1 references node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 1, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentMoveOrder_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightMoveOrderScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from left to right : the
+ // ReferenceChange Node node1[firstKey move] will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right, in the last position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(1));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(1));
+ // mapNode1 references node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 1, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(6), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentMoveOrder_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightMoveOrderScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the ReferenceChange Node node1 [firstKey move] from right to left : the FeatureMapChange
+ // <firstKey> Node node1 [map move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right, in the last position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(0));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(0));
+ // mapNode1 references node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 0, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void test3wayNonContainmentMoveOrder_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightMoveOrderScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // In this case, left and right diffs represent the same case. There is no need to test both sides.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map move] from right to left : the
+ // ReferenceChange Node node1[firstKey move] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in right, in the last position
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = rightMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftFirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftFirstKey instanceof List);
+ assertEquals(2, ((List)leftFirstKey).size());
+ assertEquals(leftNode1, ((List)leftFirstKey).get(0));
+ final Object rightFirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightFirstKey instanceof List);
+ assertEquals(2, ((List)rightFirstKey).size());
+ assertEquals(rightNode1, ((List)rightFirstKey).get(0));
+ // mapNode1 references node1 through the map in right, in the last position
+ final EStructuralFeature eSFmap = rightMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMap = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMap).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMap).get(eSFFirstKey, 0, true));
+ final Object rightMap = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMap instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMap).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMap).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ private EObject getNodeNamed(Resource res, String name) {
+ final Iterator<EObject> iterator = EcoreUtil.getAllProperContents(res, false);
+ while (iterator.hasNext()) {
+ final EObject next = iterator.next();
+ final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
+ if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
+ return next;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMapsConflictsMergeTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMapsConflictsMergeTest.java
new file mode 100644
index 000000000..1a5fd97fa
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMapsConflictsMergeTest.java
@@ -0,0 +1,1846 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.merge;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.FeatureMapChange;
+import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.ecore.util.BasicFeatureMap;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.junit.Test;
+
+/**
+ * A FeatureMapChange is always associated with a ReferenceChange. The FeatureMapChange is equivalent to his
+ * ReferenceChange and vice-versa. Each case will be done on the FeatureMapChange and on the ReferenceChange.
+ */
+@SuppressWarnings({"nls", "rawtypes", "unchecked" })
+public class FeatureMapsConflictsMergeTest {
+
+ private IndividualDiffInputData input = new IndividualDiffInputData();
+
+ private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+
+ @Test
+ public void testConflictContainmentLeftAddRightAddWithSameKey_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftAddRightAddWithSameKeyScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftAddRightAddWithSameKeyScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftAddRightAddWithSameKeyScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, is contained under mapNode2 in left, and contained under
+ // mapNode1 in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from left to right too.
+ // The rights diffs will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode2 contains node1 through the feature firstKey in left
+ final EObject leftMapNode2 = getNodeNamed(left, "mapNode2");
+ assertNotNull(leftMapNode2);
+ final Object leftMapNode2FirstKey = leftMapNode2.eGet(eSFFirstKey);
+ assertTrue(leftMapNode2FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode2FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode2FirstKey).get(0));
+ // mapNode2 contains node1 through the feature firstKey in right
+ final EObject rightMapNode2 = getNodeNamed(right, "mapNode2");
+ assertNotNull(rightMapNode2);
+ final Object rightMapNode2FirstKey = rightMapNode2.eGet(eSFFirstKey);
+ assertTrue(rightMapNode2FirstKey instanceof List);
+ assertEquals(1, ((List)rightMapNode2FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode2FirstKey).get(0));
+ // mapNode1 doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+ // mapNode2 contains node1 through the map in left
+ final Object leftMapNode2Map = leftMapNode2.eGet(eSFmap);
+ assertTrue(leftMapNode2Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode2Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode2Map).get(eSFFirstKey, 0, true));
+ // mapNode2 contains node1 through the map in right
+ final Object rightMapNode2Map = rightMapNode2.eGet(eSFmap);
+ assertTrue(rightMapNode2Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode2Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode2Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftAddRightAddWithSameKey_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftAddRightAddWithSameKeyScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftAddRightAddWithSameKeyScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftAddRightAddWithSameKeyScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, is contained under mapNode2 in left, and contained under
+ // mapNode1 in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from left to right : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from left to right too.
+ // The rights diffs will be merge from left to right too.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode2 contains node1 through the feature firstKey in left
+ final EObject leftMapNode2 = getNodeNamed(left, "mapNode2");
+ assertNotNull(leftMapNode2);
+ final Object leftMapNode2FirstKey = leftMapNode2.eGet(eSFFirstKey);
+ assertTrue(leftMapNode2FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode2FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode2FirstKey).get(0));
+ // mapNode2 contains node1 through the feature firstKey in right
+ final EObject rightMapNode2 = getNodeNamed(right, "mapNode2");
+ assertNotNull(rightMapNode2);
+ final Object rightMapNode2FirstKey = rightMapNode2.eGet(eSFFirstKey);
+ assertTrue(rightMapNode2FirstKey instanceof List);
+ assertEquals(1, ((List)rightMapNode2FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode2FirstKey).get(0));
+ // mapNode1 doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+ // mapNode2 contains node1 through the map in left
+ final Object leftMapNode2Map = leftMapNode2.eGet(eSFmap);
+ assertTrue(leftMapNode2Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode2Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode2Map).get(eSFFirstKey, 0, true));
+ // mapNode2 contains node1 through the map in right
+ final Object rightMapNode2Map = rightMapNode2.eGet(eSFmap);
+ assertTrue(rightMapNode2Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode2Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode2Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftAddRightAddWithSameKey_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftAddRightAddWithSameKeyScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftAddRightAddWithSameKeyScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftAddRightAddWithSameKeyScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, is contained under mapNode2 in left, and contained under
+ // mapNode1 in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from right to left too.
+ // The rights diffs won't be merge from right to left.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode2 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode2 = getNodeNamed(left, "mapNode2");
+ assertNotNull(leftMapNode2);
+ final Object leftMapNode2FirstKey = leftMapNode2.eGet(eSFFirstKey);
+ assertTrue(leftMapNode2FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode2FirstKey).isEmpty());
+ // mapNode2 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode2 = getNodeNamed(right, "mapNode2");
+ assertNotNull(rightMapNode2);
+ final Object rightMapNode2FirstKey = rightMapNode2.eGet(eSFFirstKey);
+ assertTrue(rightMapNode2FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode2FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode2 doesn't contains node1 through the map in left
+ final Object leftMapNode2Map = leftMapNode2.eGet(eSFmap);
+ assertTrue(leftMapNode2Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode2Map).isEmpty());
+ // mapNode2 doesn't contains node1 through the map in right
+ final Object rightMapNode2Map = rightMapNode2.eGet(eSFmap);
+ assertTrue(rightMapNode2Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode2Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftAddRightAddWithSameKey_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftAddRightAddWithSameKeyScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftAddRightAddWithSameKeyScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftAddRightAddWithSameKeyScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, is contained under mapNode2 in left, and contained under
+ // mapNode1 in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from right to left : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from right to left too.
+ // The rights diffs won't be merge from right to left.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode2 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode2 = getNodeNamed(left, "mapNode2");
+ assertNotNull(leftMapNode2);
+ final Object leftMapNode2FirstKey = leftMapNode2.eGet(eSFFirstKey);
+ assertTrue(leftMapNode2FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode2FirstKey).isEmpty());
+ // mapNode2 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode2 = getNodeNamed(right, "mapNode2");
+ assertNotNull(rightMapNode2);
+ final Object rightMapNode2FirstKey = rightMapNode2.eGet(eSFFirstKey);
+ assertTrue(rightMapNode2FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode2FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode2 doesn't contains node1 through the map in left
+ final Object leftMapNode2Map = leftMapNode2.eGet(eSFmap);
+ assertTrue(leftMapNode2Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode2Map).isEmpty());
+ // mapNode2 doesn't contains node1 through the map in right
+ final Object rightMapNode2Map = rightMapNode2.eGet(eSFmap);
+ assertTrue(rightMapNode2Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode2Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftAddRightAddWithDifferentKey_LtR_1() throws IOException {
+ final Resource left = input
+ .getFeatureMapContainmentLeftConflictLeftAddRightAddWithDifferentKeyScope();
+ final Resource right = input
+ .getFeatureMapContainmentRightConflictLeftAddRightAddWithDifferentKeyScope();
+ final Resource origin = input
+ .getFeatureMapContainmentOriginConflictLeftAddRightAddWithDifferentKeyScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, has firstKey in left, and secondKey in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftAddRightAddWithDifferentKey_LtR_2() throws IOException {
+ final Resource left = input
+ .getFeatureMapContainmentLeftConflictLeftAddRightAddWithDifferentKeyScope();
+ final Resource right = input
+ .getFeatureMapContainmentRightConflictLeftAddRightAddWithDifferentKeyScope();
+ final Resource origin = input
+ .getFeatureMapContainmentOriginConflictLeftAddRightAddWithDifferentKeyScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, has firstKey in left, and secondKey in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from left to right : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftAddRightAddWithDifferentKey_RtL_1() throws IOException {
+ final Resource left = input
+ .getFeatureMapContainmentLeftConflictLeftAddRightAddWithDifferentKeyScope();
+ final Resource right = input
+ .getFeatureMapContainmentRightConflictLeftAddRightAddWithDifferentKeyScope();
+ final Resource origin = input
+ .getFeatureMapContainmentOriginConflictLeftAddRightAddWithDifferentKeyScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, has firstKey in left, and secondKey in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't contains node1 in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFSecondKey = leftMapNode1.eClass().getEStructuralFeature("secondKey");
+ final Object leftMapNode1SecondKey = leftMapNode1.eGet(eSFSecondKey);
+ assertTrue(leftMapNode1SecondKey instanceof List);
+ assertTrue(((List)leftMapNode1SecondKey).isEmpty());
+ // mapNode1 contains node1 through the feature secondKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1SecondKey = rightMapNode1.eGet(eSFSecondKey);
+ assertTrue(rightMapNode1SecondKey instanceof List);
+ assertEquals(1, ((List)rightMapNode1SecondKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1SecondKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFSecondKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftAddRightAddWithDifferentKey_RtL_2() throws IOException {
+ final Resource left = input
+ .getFeatureMapContainmentLeftConflictLeftAddRightAddWithDifferentKeyScope();
+ final Resource right = input
+ .getFeatureMapContainmentRightConflictLeftAddRightAddWithDifferentKeyScope();
+ final Resource origin = input
+ .getFeatureMapContainmentOriginConflictLeftAddRightAddWithDifferentKeyScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, has firstKey in left, and secondKey in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from right to left : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from right to left too.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't contains node1 in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFSecondKey = leftMapNode1.eClass().getEStructuralFeature("secondKey");
+ final Object leftMapNode1SecondKey = leftMapNode1.eGet(eSFSecondKey);
+ assertTrue(leftMapNode1SecondKey instanceof List);
+ assertTrue(((List)leftMapNode1SecondKey).isEmpty());
+ // mapNode1 contains node1 through the feature secondKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1SecondKey = rightMapNode1.eGet(eSFSecondKey);
+ assertTrue(rightMapNode1SecondKey instanceof List);
+ assertEquals(1, ((List)rightMapNode1SecondKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1SecondKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFSecondKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftKeyChangeRightDelete_Left_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftKeyChangeRightDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftKeyChangeRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftKeyChangeRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 has firstKey in the ancestor, has secondKey in left, and doesn't exists in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [secondKey move] from left to right : the left
+ // FeatureMapChange <secondKey> Node node1 [map entry key change] will be merge from left to right
+ // too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature secondKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFSecondKey = leftMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object leftMapNode1SecondKey = leftMapNode1.eGet(eSFSecondKey);
+ assertTrue(leftMapNode1SecondKey instanceof List);
+ assertEquals(leftNode1, ((List)leftMapNode1SecondKey).get(0));
+ // mapNode1 contains node1 through the feature secondKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1SecondKey = rightMapNode1.eGet(eSFSecondKey);
+ assertTrue(rightMapNode1SecondKey instanceof List);
+ assertEquals(rightNode1, ((List)rightMapNode1SecondKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFSecondKey, 0, true));
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFSecondKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftKeyChangeRightDelete_Right_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftKeyChangeRightDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftKeyChangeRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftKeyChangeRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 has firstKey in the ancestor, has secondKey in left, and doesn't exists in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the right ReferenceChange Node node1 [firstKey delete] from left to right : the right
+ // FeatureMapChange <firstKey> Node node1 [map delete] will be merge from left to right
+ // too.
+ // The rights diffs will remains unmerged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature secondKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFSecondKey = leftMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object leftMapNode1SecondKey = leftMapNode1.eGet(eSFSecondKey);
+ assertTrue(leftMapNode1SecondKey instanceof List);
+ assertEquals(leftNode1, ((List)leftMapNode1SecondKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFSecondKey, 0, true));
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftKeyChangeRightDelete_Left_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftKeyChangeRightDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftKeyChangeRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftKeyChangeRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 has firstKey in the ancestor, has secondKey in left, and doesn't exists in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.CHANGE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <secondKey> Node node1 [map entry key change] from left to right :
+ // the left ReferenceChange Node node1 [secondKey move] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature secondKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFSecondKey = leftMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object leftMapNode1SecondKey = leftMapNode1.eGet(eSFSecondKey);
+ assertTrue(leftMapNode1SecondKey instanceof List);
+ assertEquals(leftNode1, ((List)leftMapNode1SecondKey).get(0));
+ // mapNode1 contains node1 through the feature secondKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1SecondKey = rightMapNode1.eGet(eSFSecondKey);
+ assertTrue(rightMapNode1SecondKey instanceof List);
+ assertEquals(rightNode1, ((List)rightMapNode1SecondKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFSecondKey, 0, true));
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFSecondKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftKeyChangeRightDelete_Right_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftKeyChangeRightDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftKeyChangeRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftKeyChangeRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 has firstKey in the ancestor, has secondKey in left, and doesn't exists in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the right FeatureMapChange <firstKey> Node node1 [map delete] from left to right : the right
+ // ReferenceChange Node node1 [firstKey delete] will be merge from left to right too.
+ // The rights diffs will remains unmerged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature secondKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFSecondKey = leftMapNode1.eClass().getEStructuralFeature("secondKey");
+ assertNotNull(eSFSecondKey);
+ final Object leftMapNode1SecondKey = leftMapNode1.eGet(eSFSecondKey);
+ assertTrue(leftMapNode1SecondKey instanceof List);
+ assertEquals(leftNode1, ((List)leftMapNode1SecondKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFSecondKey, 0, true));
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftKeyChangeRightDelete_Left_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftKeyChangeRightDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftKeyChangeRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftKeyChangeRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 has firstKey in the ancestor, has secondKey in left, and doesn't exists in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [secondKey move] from right to left : the left
+ // FeatureMapChange <secondKey> Node node1 [map entry key change] will be merge from right to left
+ // too.
+ // The rights diffs will remains unmerged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 doesn't exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 doesn't contains node1 in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftKeyChangeRightDelete_Right_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftKeyChangeRightDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftKeyChangeRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftKeyChangeRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 has firstKey in the ancestor, has secondKey in left, and doesn't exists in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey delete] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map delete] will be merge from right to left
+ // too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // node1 doesn't exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // mapNode1 doesn't contains node1 in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftKeyChangeRightDelete_Left_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftKeyChangeRightDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftKeyChangeRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftKeyChangeRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 has firstKey in the ancestor, has secondKey in left, and doesn't exists in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.CHANGE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <secondKey> Node node1 [map entry key change] from right to left :
+ // the left ReferenceChange Node node1 [secondKey move] will be merge from right to left too.
+ // The rights diffs will remains unmerged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 doesn't exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 doesn't contains node1 in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftKeyChangeRightDelete_Right_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftKeyChangeRightDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftKeyChangeRightDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftKeyChangeRightDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 has firstKey in the ancestor, has secondKey in left, and doesn't exists in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.RIGHT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the right FeatureMapChange <firstKey> Node node1 [map delete] from right to left :
+ // the right ReferenceChange Node node1 [firstKey delete] will be merge from right to left
+ // too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 doesn't exists anymore in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // node1 doesn't exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // mapNode1 doesn't contains node1 in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmenLeftMoveRightMove_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftMoveRightMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftMoveRightMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftMoveRightMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is contained under mapNode1 in the ancestor, under mapNode2 in left, and
+ // under mapNode3 in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode2 contains node1 through the feature firstKey in left
+ final EObject leftMapNode2 = getNodeNamed(left, "mapNode2");
+ assertNotNull(leftMapNode2);
+ final EStructuralFeature eSFFirstKey = leftMapNode2.eClass().getEStructuralFeature("firstKey");
+ final Object leftMapNode2FirstKey = leftMapNode2.eGet(eSFFirstKey);
+ assertTrue(leftMapNode2FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode2FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode2FirstKey).get(0));
+ // mapNode2 contains node1 through the feature firstKey in right
+ final EObject rightMapNode2 = getNodeNamed(right, "mapNode2");
+ assertNotNull(rightMapNode2);
+ final Object rightMapNode2FirstKey = rightMapNode2.eGet(eSFFirstKey);
+ assertTrue(rightMapNode2FirstKey instanceof List);
+ assertEquals(1, ((List)rightMapNode2FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode2FirstKey).get(0));
+ // mapNode2 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode2.eClass().getEStructuralFeature("map");
+ final Object leftMapNode2Map = leftMapNode2.eGet(eSFmap);
+ assertTrue(leftMapNode2Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode2Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode2Map).get(eSFFirstKey, 0, true));
+ // mapNode2 contains node1 through the map in right
+ final Object rightMapNode2Map = rightMapNode2.eGet(eSFmap);
+ assertTrue(rightMapNode2Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode2Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode2Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmenLeftMoveRightMove_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftMoveRightMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftMoveRightMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftMoveRightMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is contained under mapNode1 in the ancestor, under mapNode2 in left, and
+ // under mapNode3 in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from left to right : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode2 contains node1 through the feature firstKey in left
+ final EObject leftMapNode2 = getNodeNamed(left, "mapNode2");
+ assertNotNull(leftMapNode2);
+ final EStructuralFeature eSFFirstKey = leftMapNode2.eClass().getEStructuralFeature("firstKey");
+ final Object leftMapNode2FirstKey = leftMapNode2.eGet(eSFFirstKey);
+ assertTrue(leftMapNode2FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode2FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode2FirstKey).get(0));
+ // mapNode2 contains node1 through the feature firstKey in right
+ final EObject rightMapNode2 = getNodeNamed(right, "mapNode2");
+ assertNotNull(rightMapNode2);
+ final Object rightMapNode2FirstKey = rightMapNode2.eGet(eSFFirstKey);
+ assertTrue(rightMapNode2FirstKey instanceof List);
+ assertEquals(1, ((List)rightMapNode2FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode2FirstKey).get(0));
+ // mapNode2 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode2.eClass().getEStructuralFeature("map");
+ final Object leftMapNode2Map = leftMapNode2.eGet(eSFmap);
+ assertTrue(leftMapNode2Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode2Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode2Map).get(eSFFirstKey, 0, true));
+ // mapNode2 contains node1 through the map in right
+ final Object rightMapNode2Map = rightMapNode2.eGet(eSFmap);
+ assertTrue(rightMapNode2Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode2Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode2Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmenLeftMoveRightMove_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftMoveRightMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftMoveRightMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftMoveRightMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is contained under mapNode1 in the ancestor, under mapNode2 in left, and
+ // under mapNode3 in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from right to left too.
+ // The rights diffs will remains unmerged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode3 contains node1 through the feature firstKey in left
+ final EObject leftMapNode3 = getNodeNamed(left, "mapNode3");
+ assertNotNull(leftMapNode3);
+ final EStructuralFeature eSFFirstKey = leftMapNode3.eClass().getEStructuralFeature("firstKey");
+ final Object leftMapNode3FirstKey = leftMapNode3.eGet(eSFFirstKey);
+ assertTrue(leftMapNode3FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode3FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode3FirstKey).get(0));
+ // mapNode3 contains node1 through the feature firstKey in right
+ final EObject rightMapNode3 = getNodeNamed(right, "mapNode3");
+ assertNotNull(rightMapNode3);
+ final Object rightMapNode3FirstKey = rightMapNode3.eGet(eSFFirstKey);
+ assertTrue(rightMapNode3FirstKey instanceof List);
+ assertEquals(1, ((List)rightMapNode3FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode3FirstKey).get(0));
+ // mapNode3 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode3.eClass().getEStructuralFeature("map");
+ final Object leftMapNode3Map = leftMapNode3.eGet(eSFmap);
+ assertTrue(leftMapNode3Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode3Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode3Map).get(eSFFirstKey, 0, true));
+ // mapNode3 contains node1 through the map in right
+ final Object rightMapNode3Map = rightMapNode3.eGet(eSFmap);
+ assertTrue(rightMapNode3Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode3Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode3Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmenLeftMoveRightMove_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftMoveRightMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftMoveRightMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginConflictLeftMoveRightMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is contained under mapNode1 in the ancestor, under mapNode2 in left, and
+ // under mapNode3 in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from right to left : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from right to left too.
+ // The rights diffs will remains unmerged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode3 contains node1 through the feature firstKey in left
+ final EObject leftMapNode3 = getNodeNamed(left, "mapNode3");
+ assertNotNull(leftMapNode3);
+ final EStructuralFeature eSFFirstKey = leftMapNode3.eClass().getEStructuralFeature("firstKey");
+ final Object leftMapNode3FirstKey = leftMapNode3.eGet(eSFFirstKey);
+ assertTrue(leftMapNode3FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode3FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode3FirstKey).get(0));
+ // mapNode3 contains node1 through the feature firstKey in right
+ final EObject rightMapNode3 = getNodeNamed(right, "mapNode3");
+ assertNotNull(rightMapNode3);
+ final Object rightMapNode3FirstKey = rightMapNode3.eGet(eSFFirstKey);
+ assertTrue(rightMapNode3FirstKey instanceof List);
+ assertEquals(1, ((List)rightMapNode3FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode3FirstKey).get(0));
+ // mapNode3 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode3.eClass().getEStructuralFeature("map");
+ final Object leftMapNode3Map = leftMapNode3.eGet(eSFmap);
+ assertTrue(leftMapNode3Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode3Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode3Map).get(eSFFirstKey, 0, true));
+ // mapNode3 contains node1 through the map in right
+ final Object rightMapNode3Map = rightMapNode3.eGet(eSFmap);
+ assertTrue(rightMapNode3Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode3Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode3Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftMoveOrderRightMoveOrder_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftMoveOrderRightMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftMoveOrderRightMoveOrderScope();
+ final Resource origin = input
+ .getFeatureMapContainmentOriginConflictLeftMoveOrderRightMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is in the first position in the ancestor, in the second position in left, and in third
+ // position in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey move] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map move] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 at the second position in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 at the second position in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 at the second position of the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 contains node1 at the second position of the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftMoveOrderRightMoveOrder_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftMoveOrderRightMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftMoveOrderRightMoveOrderScope();
+ final Resource origin = input
+ .getFeatureMapContainmentOriginConflictLeftMoveOrderRightMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is in the first position in the ancestor, in the second position in left, and in third
+ // position in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map move] from left to right : the left
+ // ReferenceChange Node node1 [firstKey move] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 at the second position in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 at the second position in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 at the second position of the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 contains node1 at the second position of the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftMoveOrderRightMoveOrder_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftMoveOrderRightMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftMoveOrderRightMoveOrderScope();
+ final Resource origin = input
+ .getFeatureMapContainmentOriginConflictLeftMoveOrderRightMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is in the first position in the ancestor, in the second position in left, and in third
+ // position in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey move] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map move] will be merge from right to left too.
+ // The rights diffs will remains unmerged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 at the first position in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 at the first position in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(2));
+ // mapNode1 contains node1 at the first position of the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 at the first position of the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 2, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentLeftMoveOrderRightMoveOrder_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftConflictLeftMoveOrderRightMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightConflictLeftMoveOrderRightMoveOrderScope();
+ final Resource origin = input
+ .getFeatureMapContainmentOriginConflictLeftMoveOrderRightMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is in the first position in the ancestor, in the second position in left, and in third
+ // position in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map move] from right to left : the left
+ // ReferenceChange Node node1 [firstKey move] will be merge from right to left too.
+ // The rights diffs will remains unmerged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 at the first position in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 at the first position in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(2));
+ // mapNode1 contains node1 at the first position of the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 at the first position of the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 2, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentLeftMoveOrderRightMoveOrder_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input
+ .getFeatureMapNonContainmentLeftConflictLeftMoveOrderRightMoveOrderScope(rs);
+ final Resource right = input
+ .getFeatureMapNonContainmentRightConflictLeftMoveOrderRightMoveOrderScope(rs);
+ final Resource origin = input
+ .getFeatureMapNonContainmentOriginConflictLeftMoveOrderRightMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is in the first position in the ancestor, in the second position in left, and in third
+ // position in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey move] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map move] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 at the second position in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 at the second position in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 at the second position of the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 contains node1 at the second position of the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentLeftMoveOrderRightMoveOrder_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input
+ .getFeatureMapNonContainmentLeftConflictLeftMoveOrderRightMoveOrderScope(rs);
+ final Resource right = input
+ .getFeatureMapNonContainmentRightConflictLeftMoveOrderRightMoveOrderScope(rs);
+ final Resource origin = input
+ .getFeatureMapNonContainmentOriginConflictLeftMoveOrderRightMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is in the first position in the ancestor, in the second position in left, and in third
+ // position in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map move] from left to right : the left
+ // ReferenceChange Node node1 [firstKey move] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 at the second position in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 at the second position in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 at the second position of the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 contains node1 at the second position of the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentLeftMoveOrderRightMoveOrder_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input
+ .getFeatureMapNonContainmentLeftConflictLeftMoveOrderRightMoveOrderScope(rs);
+ final Resource right = input
+ .getFeatureMapNonContainmentRightConflictLeftMoveOrderRightMoveOrderScope(rs);
+ final Resource origin = input
+ .getFeatureMapNonContainmentOriginConflictLeftMoveOrderRightMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is in the first position in the ancestor, in the second position in left, and in third
+ // position in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey move] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map move] will be merge from right to left too.
+ // The rights diffs will remains unmerged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 at the first position in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 at the first position in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(2));
+ // mapNode1 contains node1 at the first position of the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 at the first position of the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 2, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentLeftMoveOrderRightMoveOrder_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input
+ .getFeatureMapNonContainmentLeftConflictLeftMoveOrderRightMoveOrderScope(rs);
+ final Resource right = input
+ .getFeatureMapNonContainmentRightConflictLeftMoveOrderRightMoveOrderScope(rs);
+ final Resource origin = input
+ .getFeatureMapNonContainmentOriginConflictLeftMoveOrderRightMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is in the first position in the ancestor, in the second position in left, and in third
+ // position in right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map move] from right to left : the left
+ // ReferenceChange Node node1 [firstKey move] will be merge from right to left too.
+ // The rights diffs will remains unmerged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 at the first position in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 at the first position in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof List);
+ assertEquals(3, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(2));
+ // mapNode1 contains node1 at the first position of the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 at the first position of the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(3, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 2, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(2), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ private EObject getNodeNamed(Resource res, String name) {
+ final Iterator<EObject> iterator = EcoreUtil.getAllProperContents(res, false);
+ while (iterator.hasNext()) {
+ final EObject next = iterator.next();
+ final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
+ if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
+ return next;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMapsPseudoConflictsMergeTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMapsPseudoConflictsMergeTest.java
new file mode 100644
index 000000000..f939b4c54
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/FeatureMapsPseudoConflictsMergeTest.java
@@ -0,0 +1,1993 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.merge;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.instanceOf;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.FeatureMapChange;
+import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.scope.DefaultComparisonScope;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+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.ecore.util.BasicFeatureMap;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.junit.Test;
+
+/**
+ * A FeatureMapChange is always associated with a ReferenceChange. The FeatureMapChange is equivalent to his
+ * ReferenceChange and vice-versa. Each case will be done on the FeatureMapChange and on the ReferenceChange.
+ */
+@SuppressWarnings({"nls", "rawtypes", "unchecked" })
+public class FeatureMapsPseudoConflictsMergeTest {
+
+ private IndividualDiffInputData input = new IndividualDiffInputData();
+
+ private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+
+ @Test
+ public void testConflictContainmentPseudoConflictAdd_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictAddScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, exists in left and right under mapNode1.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictAdd_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictAddScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, exists in left and right under mapNode1.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from left to right : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictAdd_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictAddScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, exists in left and right under mapNode1.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictAdd_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictAddScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictAddScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictAddScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't exists in the ancestor, exists in left and right under mapNode1.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from right to left : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictDelete_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1, but not in left and right .
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey delete] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map delete] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 doesn't still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // node1 doesn't still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictDelete_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1, but not in left and right .
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map delete] from left to right : the left
+ // ReferenceChange Node node1 [firstKey delete] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 doesn't still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // node1 doesn't still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictDelete_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1, but not in left and right .
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey delete] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map delete] will be merge from right to left too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 doesn't still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // node1 doesn't still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictDelete_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictDeleteScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictDeleteScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictDeleteScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1, but not in left and right .
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map delete] from right to left : the left
+ // ReferenceChange Node node1 [firstKey delete] will be merge from right to left too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 doesn't still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNull(leftNode1);
+ // node1 doesn't still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictKeyChange_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 with key secondKey, exists in left and right under
+ // mapNode1 with key fisrtKey.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey move] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map entry key change] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictKeyChange_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 with key secondKey, exists in left and right under
+ // mapNode1 with key fisrtKey.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.CHANGE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map entry key change] from left to right :
+ // the left ReferenceChange Node node1 [firstKey move] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictKeyChange_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 with key secondKey, exists in left and right under
+ // mapNode1 with key fisrtKey.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey move] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map entry key change] will be merge from right to left too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictKeyChange_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictKeyChangeScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictKeyChangeScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictKeyChangeScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 with key secondKey, exists in left and right under
+ // mapNode1 with key fisrtKey.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.CHANGE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the FeatureMapChange <firstKey> Node node1 [map entry key change] left from right to left :
+ // the left ReferenceChange Node node1 [firstKey move] will be merge from right to left too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictMoveOrder_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictMoveOrderScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 in first position, exists in left and right under
+ // mapNode1 in last position.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey move] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map move] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(2, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(2, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictMoveOrder_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictMoveOrderScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 in first position, exists in left and right under
+ // mapNode1 in last position.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map move] from left to right : the left
+ // ReferenceChange Node node1 [firstKey move] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(2, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(2, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictMoveOrder_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictMoveOrderScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 in first position, exists in left and right under
+ // mapNode1 in last position.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey move] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map move] will be merge from right to left too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(2, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(2, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictMoveOrder_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictMoveOrderScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictMoveOrderScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictMoveOrderScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 in first position, exists in left and right under
+ // mapNode1 in last position.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map move] from right to left : the left
+ // ReferenceChange Node node1 [firstKey move] will be merge from right to left too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(2, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(2, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictMove_LtR_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode2, exists in left and right under mapNode1.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey move] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map move] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictMove_LtR_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode2, exists in left and right under mapNode1.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map move] from left to right : the left
+ // ReferenceChange Node node1 [firstKey move] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictMove_RtL_1() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode2, exists in left and right under mapNode1.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey move] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map move] will be merge from right to left too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictContainmentPseudoConflictMove_RtL_2() throws IOException {
+ final Resource left = input.getFeatureMapContainmentLeftPseudoConflictMoveScope();
+ final Resource right = input.getFeatureMapContainmentRightPseudoConflictMoveScope();
+ final Resource origin = input.getFeatureMapContainmentOriginPseudoConflictMoveScope();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode2, exists in left and right under mapNode1.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map move] from right to left : the left
+ // ReferenceChange Node node1 [firstKey move] will be merge from right to left too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNode1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKey");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNode1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("map");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictAdd_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't referenced by mapNC1 in the ancestor, referenced in left and right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 references node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 references node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictAdd_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't referenced by mapNC1 in the ancestor, referenced in left and right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from left to right : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 references node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 references node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictAdd_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't referenced by mapNC1 in the ancestor, referenced in left and right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 references node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 references node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictAdd_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictAddScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictAddScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictAddScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 doesn't referenced by mapNC1 in the ancestor, referenced in left and right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.ADD), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from right to left : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(1, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(0));
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(1, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(0));
+ // mapNode1 references node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 0, true));
+ // mapNode1 references node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(1, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 0, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictDelete_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is referenced by mapNC1 in the ancestor, not referenced in left and right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey delete] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map delete] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictDelete_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is referenced by mapNC1 in the ancestor, not referenced in left and right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map delete] from left to right : the left
+ // ReferenceChange Node node1 [firstKey delete] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictDelete_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is referenced by mapNC1 in the ancestor, not referenced in left and right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey delete] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map delete] will be merge from right to left too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictDelete_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictDeleteScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictDeleteScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictDeleteScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 is referenced by mapNC1 in the ancestor, not referenced in left and right.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.DELETE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map delete] from right to left : the left
+ // ReferenceChange Node node1 [firstKey delete] will be merge from right to left too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 doesn't contains node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)leftMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't contains node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertTrue(((Collection)rightMapNode1FirstKey).isEmpty());
+ // mapNode1 doesn't doesn't contains node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)leftMapNode1Map).isEmpty());
+ // mapNode1 doesn't contains node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertTrue(((BasicFeatureMap)rightMapNode1Map).isEmpty());
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictMoveOrder_LtR_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictMoveOrderScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 in first position, exists in left and right under
+ // mapNode1 in last position.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from left to right : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(2, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(2, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 references node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 references node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictMoveOrder_LtR_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictMoveOrderScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 in first position, exists in left and right under
+ // mapNode1 in last position.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from left to right : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyLeftToRight(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(2, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(2, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 references node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 references node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictMoveOrder_RtL_1() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictMoveOrderScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 in first position, exists in left and right under
+ // mapNode1 in last position.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(ReferenceChange.class)));
+
+ // Merge the left ReferenceChange Node node1 [firstKey add] from right to left : the left
+ // FeatureMapChange <firstKey> Node node1 [map add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(2, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(2, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 references node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 references node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ @Test
+ public void testConflictNonContainmentPseudoConflictMoveOrder_RtL_2() throws IOException {
+ final ResourceSet rs = new ResourceSetImpl();
+ final Resource left = input.getFeatureMapNonContainmentLeftPseudoConflictMoveOrderScope(rs);
+ final Resource right = input.getFeatureMapNonContainmentRightPseudoConflictMoveOrderScope(rs);
+ final Resource origin = input.getFeatureMapNonContainmentOriginPseudoConflictMoveOrderScope(rs);
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ // the node1 exists in the ancestor under mapNode1 in first position, exists in left and right under
+ // mapNode1 in last position.
+ List<Diff> differences = comparison.getDifferences();
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
+
+ final Diff diff = Iterators.find(differences.iterator(), and(fromSide(DifferenceSource.LEFT),
+ ofKind(DifferenceKind.MOVE), instanceOf(FeatureMapChange.class)));
+
+ // Merge the left FeatureMapChange <firstKey> Node node1 [map add] from right to left : the left
+ // ReferenceChange Node node1 [firstKey add] will be merge from left to right too.
+ // The rights diffs will be mark as merged.
+ mergerRegistry.getHighestRankingMerger(diff).copyRightToLeft(diff, new BasicMonitor());
+
+ // node1 still exists in left
+ final EObject leftNode1 = getNodeNamed(left, "node1");
+ assertNotNull(leftNode1);
+ // node1 still exists in right
+ final EObject rightNode1 = getNodeNamed(right, "node1");
+ assertNotNull(rightNode1);
+ // mapNode1 references node1 through the feature firstKey in left
+ final EObject leftMapNode1 = getNodeNamed(left, "mapNC1");
+ assertNotNull(leftMapNode1);
+ final EStructuralFeature eSFFirstKey = leftMapNode1.eClass().getEStructuralFeature("firstKeyNC");
+ assertNotNull(eSFFirstKey);
+ final Object leftMapNode1FirstKey = leftMapNode1.eGet(eSFFirstKey);
+ assertTrue(leftMapNode1FirstKey instanceof List);
+ assertEquals(2, ((List)leftMapNode1FirstKey).size());
+ assertEquals(leftNode1, ((List)leftMapNode1FirstKey).get(1));
+ // mapNode1 references node1 through the feature firstKey in right
+ final EObject rightMapNode1 = getNodeNamed(right, "mapNC1");
+ assertNotNull(rightMapNode1);
+ final Object rightMapNode1FirstKey = rightMapNode1.eGet(eSFFirstKey);
+ assertTrue(rightMapNode1FirstKey instanceof Collection);
+ assertEquals(2, ((List)rightMapNode1FirstKey).size());
+ assertEquals(rightNode1, ((List)rightMapNode1FirstKey).get(1));
+ // mapNode1 references node1 through the map in left
+ final EStructuralFeature eSFmap = leftMapNode1.eClass().getEStructuralFeature("mapNC");
+ assertNotNull(eSFmap);
+ final Object leftMapNode1Map = leftMapNode1.eGet(eSFmap);
+ assertTrue(leftMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)leftMapNode1Map).size());
+ assertEquals(leftNode1, ((BasicFeatureMap)leftMapNode1Map).get(eSFFirstKey, 1, true));
+ // mapNode1 references node1 through the map in right
+ final Object rightMapNode1Map = rightMapNode1.eGet(eSFmap);
+ assertTrue(rightMapNode1Map instanceof BasicFeatureMap);
+ assertEquals(2, ((BasicFeatureMap)rightMapNode1Map).size());
+ assertEquals(rightNode1, ((BasicFeatureMap)rightMapNode1Map).get(eSFFirstKey, 1, true));
+
+ comparison = EMFCompare.builder().build().compare(scope);
+ assertSame(Integer.valueOf(4), Integer.valueOf(comparison.getDifferences().size()));
+ }
+
+ private EObject getNodeNamed(Resource res, String name) {
+ final Iterator<EObject> iterator = EcoreUtil.getAllProperContents(res, false);
+ while (iterator.hasNext()) {
+ final EObject next = iterator.next();
+ final EStructuralFeature nameFeature = next.eClass().getEStructuralFeature("name");
+ if (nameFeature != null && name.equals(next.eGet(nameFeature))) {
+ return next;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java
index 61d01ed32..765b9add9 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java
@@ -14,6 +14,7 @@ import java.io.IOException;
import org.eclipse.emf.compare.tests.framework.AbstractInputData;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
/**
* Provides input models to the unit tests of the matching by id.
@@ -389,4 +390,315 @@ public class IndividualDiffInputData extends AbstractInputData {
public Resource getRightPseudoConflictFullScope() throws IOException {
return loadFromClassLoader("pseudoconflictscope/fullscope/right.nodes");
}
+
+ public Resource getFeatureMapContainmentLeftAddScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/add/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightAddScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/add/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginAddScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/add/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftDeleteScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/delete/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightDeleteScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/delete/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginDeleteScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/delete/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftKeyChangeScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/keychange/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightKeyChangeScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/keychange/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginKeyChangeScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/keychange/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftMoveScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/move/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightMoveScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/move/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginMoveScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/move/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftMoveOrderScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/moveorder/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightMoveOrderScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/moveorder/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginMoveOrderScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/moveorder/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftMoveKeyChangeScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/movekeychange/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightMoveKeyChangeScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/movekeychange/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginMoveKeyChangeScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/movekeychange/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapNonContainmentLeftAddScope(ResourceSet resourceSet) throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/add/left.nodes", resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentRightAddScope(ResourceSet resourceSet) throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/add/right.nodes", resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentOriginAddScope(ResourceSet resourceSet) throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/add/ancestor.nodes", resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentLeftDeleteScope(ResourceSet resourceSet) throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/delete/left.nodes", resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentRightDeleteScope(ResourceSet resourceSet) throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/delete/right.nodes", resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentOriginDeleteScope(ResourceSet resourceSet) throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/delete/ancestor.nodes", resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentLeftMoveOrderScope(ResourceSet resourceSet) throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/moveorder/left.nodes", resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentRightMoveOrderScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/moveorder/right.nodes", resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentOriginMoveOrderScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/moveorder/ancestor.nodes", resourceSet);
+ }
+
+ public Resource getFeatureMapContainmentLeftConflictLeftAddRightAddWithSameKeyScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftadd_rightadd/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightConflictLeftAddRightAddWithSameKeyScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftadd_rightadd/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginConflictLeftAddRightAddWithSameKeyScope()
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftadd_rightadd/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftConflictLeftAddRightAddWithDifferentKeyScope()
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftadd_rightadd_2/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightConflictLeftAddRightAddWithDifferentKeyScope()
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftadd_rightadd_2/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginConflictLeftAddRightAddWithDifferentKeyScope()
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftadd_rightadd_2/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftConflictLeftKeyChangeRightDeleteScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftkeychange_rightdelete/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightConflictLeftKeyChangeRightDeleteScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftkeychange_rightdelete/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginConflictLeftKeyChangeRightDeleteScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftkeychange_rightdelete/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftConflictLeftMoveRightMoveScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftmove_rightmove/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightConflictLeftMoveRightMoveScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftmove_rightmove/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginConflictLeftMoveRightMoveScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftmove_rightmove/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftConflictLeftMoveOrderRightMoveOrderScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightConflictLeftMoveOrderRightMoveOrderScope()
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginConflictLeftMoveOrderRightMoveOrderScope()
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapNonContainmentLeftConflictLeftMoveOrderRightMoveOrderScope(
+ ResourceSet resourceSet) throws IOException {
+ return loadFromClassLoader(
+ "featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/left.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentRightConflictLeftMoveOrderRightMoveOrderScope(
+ ResourceSet resourceSet) throws IOException {
+ return loadFromClassLoader(
+ "featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/right.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentOriginConflictLeftMoveOrderRightMoveOrderScope(
+ ResourceSet resourceSet) throws IOException {
+ return loadFromClassLoader(
+ "featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/ancestor.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapContainmentLeftPseudoConflictAddScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/add/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightPseudoConflictAddScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/add/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginPseudoConflictAddScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/add/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftPseudoConflictDeleteScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/delete/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightPseudoConflictDeleteScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/delete/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginPseudoConflictDeleteScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/delete/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftPseudoConflictKeyChangeScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/keychange/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightPseudoConflictKeyChangeScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/keychange/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginPseudoConflictKeyChangeScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/keychange/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftPseudoConflictMoveScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/move/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightPseudoConflictMoveScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/move/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginPseudoConflictMoveScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/move/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapContainmentLeftPseudoConflictMoveOrderScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/moveorder/left.nodes");
+ }
+
+ public Resource getFeatureMapContainmentRightPseudoConflictMoveOrderScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/moveorder/right.nodes");
+ }
+
+ public Resource getFeatureMapContainmentOriginPseudoConflictMoveOrderScope() throws IOException {
+ return loadFromClassLoader("featuremapscope/containment/pseudoconflicts/moveorder/ancestor.nodes");
+ }
+
+ public Resource getFeatureMapNonContainmentLeftPseudoConflictAddScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/pseudoconflicts/add/left.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentRightPseudoConflictAddScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/pseudoconflicts/add/right.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentOriginPseudoConflictAddScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/pseudoconflicts/add/ancestor.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentLeftPseudoConflictDeleteScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/pseudoconflicts/delete/left.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentRightPseudoConflictDeleteScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/pseudoconflicts/delete/right.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentOriginPseudoConflictDeleteScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/pseudoconflicts/delete/ancestor.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentLeftPseudoConflictMoveOrderScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/pseudoconflicts/moveorder/left.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentRightPseudoConflictMoveOrderScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/pseudoconflicts/moveorder/right.nodes",
+ resourceSet);
+ }
+
+ public Resource getFeatureMapNonContainmentOriginPseudoConflictMoveOrderScope(ResourceSet resourceSet)
+ throws IOException {
+ return loadFromClassLoader("featuremapscope/noncontainment/pseudoconflicts/moveorder/ancestor.nodes",
+ resourceSet);
+ }
}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/ancestor.nodes
new file mode 100644
index 000000000..28d30c87e
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/ancestor.nodes
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/left.nodes
new file mode 100644
index 000000000..7834a94b8
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/left.nodes
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_YgOUsM7TEeOlS6AUBGqBsw" name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/right.nodes
new file mode 100644
index 000000000..c4193171d
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/add/right.nodes
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_Z1W7oM7TEeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/ancestor.nodes
new file mode 100644
index 000000000..3eb9ee131
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/ancestor.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1"/>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_y3KZgNQ0EeOj9Mzli6N-pQ"
+ name="mapNode2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/left.nodes
new file mode 100644
index 000000000..6e2e8a5be
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/left.nodes
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1"/>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_y3KZgNQ0EeOj9Mzli6N-pQ"
+ name="mapNode2">
+ <firstKey
+ xmi:id="_xMSWoNQ1EeOj9Mzli6N-pQ"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/right.nodes
new file mode 100644
index 000000000..5885be095
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd/right.nodes
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_xMSWoNQ1EeOj9Mzli6N-pQ"
+ name="node1"/>
+ </containmentRef1>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_y3KZgNQ0EeOj9Mzli6N-pQ"
+ name="mapNode2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/ancestor.nodes
new file mode 100644
index 000000000..38ea24568
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/ancestor.nodes
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/left.nodes
new file mode 100644
index 000000000..a2caaaa0c
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/left.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_xMSWoNQ1EeOj9Mzli6N-pQ"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/right.nodes
new file mode 100644
index 000000000..a3579e281
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftadd_rightadd_2/right.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <secondKey
+ xmi:id="_xMSWoNQ1EeOj9Mzli6N-pQ"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/ancestor.nodes
new file mode 100644
index 000000000..632aef16c
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/ancestor.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_HdfnIM7REeOlS6AUBGqBsw"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_A2X7oM7TEeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/left.nodes
new file mode 100644
index 000000000..ef8545c5d
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/left.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_HdfnIM7REeOlS6AUBGqBsw"
+ name="mapNode1">
+ <secondKey
+ xmi:id="_A2X7oM7TEeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/right.nodes
new file mode 100644
index 000000000..07c039ae1
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftkeychange_rightdelete/right.nodes
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_HdfnIM7REeOlS6AUBGqBsw"
+ name="mapNode1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/ancestor.nodes
new file mode 100644
index 000000000..e3141c74a
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/ancestor.nodes
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_EackIM7REeOlS6AUBGqBsw"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_Hq2N0M7REeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode2"/>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_xvyKoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode3"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/left.nodes
new file mode 100644
index 000000000..48863c6da
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/left.nodes
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_EackIM7REeOlS6AUBGqBsw"
+ name="mapNode1"/>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode2">
+ <firstKey
+ xmi:id="_Hq2N0M7REeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_xvyKoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode3"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/right.nodes
new file mode 100644
index 000000000..ec00d71cd
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmove_rightmove/right.nodes
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_EackIM7REeOlS6AUBGqBsw"
+ name="mapNode1"/>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode2"/>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_xvyKoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode3">
+ <firstKey
+ xmi:id="_Hq2N0M7REeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/ancestor.nodes
new file mode 100644
index 000000000..a7f54fbb3
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/ancestor.nodes
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_ywzLoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_kk4EQM7REeOlS6AUBGqBsw"
+ name="node1"/>
+ <firstKey
+ xmi:id="_lGhYwM7REeOlS6AUBGqBsw"
+ name="node2"/>
+ <firstKey
+ xmi:id="_mHyZxM7REeOlS6AUBGqBsw"
+ name="node3"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/left.nodes
new file mode 100644
index 000000000..e6780fedf
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/left.nodes
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_ywzLoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_lGhYwM7REeOlS6AUBGqBsw"
+ name="node2"/>
+ <firstKey
+ xmi:id="_kk4EQM7REeOlS6AUBGqBsw"
+ name="node1"/>
+ <firstKey
+ xmi:id="_mHyZxM7REeOlS6AUBGqBsw"
+ name="node3"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/right.nodes
new file mode 100644
index 000000000..9ba81b3a7
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/conflicts/leftmoveorder_rightmoveorder/right.nodes
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_ywzLoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_lGhYwM7REeOlS6AUBGqBsw"
+ name="node2"/>
+ <firstKey
+ xmi:id="_mHyZxM7REeOlS6AUBGqBsw"
+ name="node3"/>
+ <firstKey
+ xmi:id="_kk4EQM7REeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/ancestor.nodes
new file mode 100644
index 000000000..94c52cf18
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/ancestor.nodes
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node1"/>
+ <firstKey xmi:id="_XqsFwM7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/left.nodes
new file mode 100644
index 000000000..a0a284518
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/left.nodes
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/right.nodes
new file mode 100644
index 000000000..83b5813dc
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/delete/right.nodes
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_XqsFwM7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/ancestor.nodes
new file mode 100644
index 000000000..94c52cf18
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/ancestor.nodes
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node1"/>
+ <firstKey xmi:id="_XqsFwM7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/left.nodes
new file mode 100644
index 000000000..1041514e3
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/left.nodes
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node1"/>
+ <secondKey xmi:id="_XqsFwM7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/right.nodes
new file mode 100644
index 000000000..8c79b5141
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/keychange/right.nodes
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <secondKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node1"/>
+ <firstKey xmi:id="_XqsFwM7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/ancestor.nodes
new file mode 100644
index 000000000..f11353509
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/ancestor.nodes
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_GKLcYM7REeOlS6AUBGqBsw" name="node1"/>
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ" name="mapNode2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/left.nodes
new file mode 100644
index 000000000..3901db822
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/left.nodes
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_GKLcYM7REeOlS6AUBGqBsw" name="node1"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ" name="mapNode2">
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/right.nodes
new file mode 100644
index 000000000..41b674785
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/move/right.nodes
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ" name="mapNode2">
+ <firstKey xmi:id="_GKLcYM7REeOlS6AUBGqBsw" name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/ancestor.nodes
new file mode 100644
index 000000000..f11353509
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/ancestor.nodes
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_GKLcYM7REeOlS6AUBGqBsw" name="node1"/>
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ" name="mapNode2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/left.nodes
new file mode 100644
index 000000000..9764c3eff
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/left.nodes
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_GKLcYM7REeOlS6AUBGqBsw" name="node1"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ" name="mapNode2">
+ <secondKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/right.nodes
new file mode 100644
index 000000000..23b82d8da
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/movekeychange/right.nodes
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ" name="mapNode2">
+ <secondKey xmi:id="_GKLcYM7REeOlS6AUBGqBsw" name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/ancestor.nodes
new file mode 100644
index 000000000..000def130
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/ancestor.nodes
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_GKLcYM7REeOlS6AUBGqBsw" name="node1"/>
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ" name="mapNode2">
+ <firstKey xmi:id="_Hq2N0M7REeOlS6AUBGqBsw" name="node3"/>
+ <firstKey xmi:id="_U28R4NRaEeObpPu6zkzk9g" name="node4"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/left.nodes
new file mode 100644
index 000000000..5204e040d
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/left.nodes
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node2"/>
+ <firstKey xmi:id="_GKLcYM7REeOlS6AUBGqBsw" name="node1"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ" name="mapNode2">
+ <firstKey xmi:id="_Hq2N0M7REeOlS6AUBGqBsw" name="node3"/>
+ <firstKey xmi:id="_U28R4NRaEeObpPu6zkzk9g" name="node4"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/right.nodes
new file mode 100644
index 000000000..0fe563e01
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/moveorder/right.nodes
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_EackIM7REeOlS6AUBGqBsw" name="mapNode1">
+ <firstKey xmi:id="_GKLcYM7REeOlS6AUBGqBsw" name="node1"/>
+ <firstKey xmi:id="_Gp1M0M7REeOlS6AUBGqBsw" name="node2"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapContainment" xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ" name="mapNode2">
+ <firstKey xmi:id="_U28R4NRaEeObpPu6zkzk9g" name="node4"/>
+ <firstKey xmi:id="_Hq2N0M7REeOlS6AUBGqBsw" name="node3"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/ancestor.nodes
new file mode 100644
index 000000000..38ea24568
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/ancestor.nodes
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/left.nodes
new file mode 100644
index 000000000..6b42fa664
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/left.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_CeIPIM7WEeO6I5Ugr2XkhA"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/right.nodes
new file mode 100644
index 000000000..6b42fa664
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/add/right.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_CeIPIM7WEeO6I5Ugr2XkhA"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/ancestor.nodes
new file mode 100644
index 000000000..6b42fa664
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/ancestor.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_CeIPIM7WEeO6I5Ugr2XkhA"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/left.nodes
new file mode 100644
index 000000000..38ea24568
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/left.nodes
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/right.nodes
new file mode 100644
index 000000000..38ea24568
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/delete/right.nodes
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_wuxJoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/ancestor.nodes
new file mode 100644
index 000000000..b32a3256f
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/ancestor.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_FbdlIM7REeOlS6AUBGqBsw"
+ name="mapNode1">
+ <secondKey
+ xmi:id="_YgOUsM7TEeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/left.nodes
new file mode 100644
index 000000000..81818d51b
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/left.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_FbdlIM7REeOlS6AUBGqBsw"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_YgOUsM7TEeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/right.nodes
new file mode 100644
index 000000000..81818d51b
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/keychange/right.nodes
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_FbdlIM7REeOlS6AUBGqBsw"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_YgOUsM7TEeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/ancestor.nodes
new file mode 100644
index 000000000..6dee10f9c
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/ancestor.nodes
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_EackIM7REeOlS6AUBGqBsw"
+ name="mapNode2">
+ <firstKey
+ xmi:id="_U28R4NRaEeObpPu6zkzk9g"
+ name="node1"/>
+ </containmentRef1>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_xvyKoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/left.nodes
new file mode 100644
index 000000000..e03dc9a88
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/left.nodes
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_EackIM7REeOlS6AUBGqBsw"
+ name="mapNode2"/>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_xvyKoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_U28R4NRaEeObpPu6zkzk9g"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/right.nodes
new file mode 100644
index 000000000..e03dc9a88
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/move/right.nodes
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_EackIM7REeOlS6AUBGqBsw"
+ name="mapNode2"/>
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_xvyKoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_U28R4NRaEeObpPu6zkzk9g"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/ancestor.nodes
new file mode 100644
index 000000000..07f30b1ae
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/ancestor.nodes
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_xvyKoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_jvFrwM7REeOlS6AUBGqBsw"
+ name="node1"/>
+ <firstKey
+ xmi:id="_kLUUwM7REeOlS6AUBGqBsw"
+ name="node2"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/left.nodes
new file mode 100644
index 000000000..25ab0135d
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/left.nodes
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_xvyKoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_kLUUwM7REeOlS6AUBGqBsw"
+ name="node2"/>
+ <firstKey
+ xmi:id="_jvFrwM7REeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/right.nodes
new file mode 100644
index 000000000..25ab0135d
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/containment/pseudoconflicts/moveorder/right.nodes
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapContainment"
+ xmi:id="_xvyKoNQ0EeOj9Mzli6N-pQ"
+ name="mapNode1">
+ <firstKey
+ xmi:id="_kLUUwM7REeOlS6AUBGqBsw"
+ name="node2"/>
+ <firstKey
+ xmi:id="_jvFrwM7REeOlS6AUBGqBsw"
+ name="node1"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/ancestor.nodes
new file mode 100644
index 000000000..1c76ae01c
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/ancestor.nodes
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_cc7swM7REeOlS6AUBGqBsw" name="mapNC1"/>
+ <containmentRef1 xmi:id="_jvFrwM7REeOlS6AUBGqBsw" name="node1"/>
+ <containmentRef1 xmi:id="_kLUUwM7REeOlS6AUBGqBsw" name="node2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/left.nodes
new file mode 100644
index 000000000..ea8e9b916
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/left.nodes
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_cc7swM7REeOlS6AUBGqBsw" name="mapNC1">
+ <firstKeyNC href="#_jvFrwM7REeOlS6AUBGqBsw"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_jvFrwM7REeOlS6AUBGqBsw" name="node1"/>
+ <containmentRef1 xmi:id="_kLUUwM7REeOlS6AUBGqBsw" name="node2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/right.nodes
new file mode 100644
index 000000000..e3d61af67
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/add/right.nodes
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_cc7swM7REeOlS6AUBGqBsw" name="mapNC1">
+ <firstKeyNC href="#_kLUUwM7REeOlS6AUBGqBsw"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_jvFrwM7REeOlS6AUBGqBsw" name="node1"/>
+ <containmentRef1 xmi:id="_kLUUwM7REeOlS6AUBGqBsw" name="node2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/ancestor.nodes
new file mode 100644
index 000000000..f319c3380
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/ancestor.nodes
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_VtNNsNRpEeOZ_K3DPNcuBQ"
+ name="mapNC1">
+ <firstKeyNC
+ href="#_k7yQsNRpEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC
+ href="#_lNZlINRpEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC
+ href="#_ldblMNRpEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1
+ xmi:id="_k7yQsNRpEeOZ_K3DPNcuBQ"
+ name="node1"/>
+ <containmentRef1
+ xmi:id="_lNZlINRpEeOZ_K3DPNcuBQ"
+ name="node2"/>
+ <containmentRef1
+ xmi:id="_ldblMNRpEeOZ_K3DPNcuBQ"
+ name="node3"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/left.nodes
new file mode 100644
index 000000000..ab0456fc2
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/left.nodes
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_VtNNsNRpEeOZ_K3DPNcuBQ"
+ name="mapNC1">
+ <firstKeyNC
+ href="#_lNZlINRpEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC
+ href="#_k7yQsNRpEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC
+ href="#_ldblMNRpEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1
+ xmi:id="_k7yQsNRpEeOZ_K3DPNcuBQ"
+ name="node1"/>
+ <containmentRef1
+ xmi:id="_lNZlINRpEeOZ_K3DPNcuBQ"
+ name="node2"/>
+ <containmentRef1
+ xmi:id="_ldblMNRpEeOZ_K3DPNcuBQ"
+ name="node3"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/right.nodes
new file mode 100644
index 000000000..d84a0f309
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/conflicts/leftmoveorder_rightmoveorder/right.nodes
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_VtNNsNRpEeOZ_K3DPNcuBQ"
+ name="mapNC1">
+ <firstKeyNC
+ href="#_lNZlINRpEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC
+ href="#_ldblMNRpEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC
+ href="#_k7yQsNRpEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1
+ xmi:id="_k7yQsNRpEeOZ_K3DPNcuBQ"
+ name="node1"/>
+ <containmentRef1
+ xmi:id="_lNZlINRpEeOZ_K3DPNcuBQ"
+ name="node2"/>
+ <containmentRef1
+ xmi:id="_ldblMNRpEeOZ_K3DPNcuBQ"
+ name="node3"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/ancestor.nodes
new file mode 100644
index 000000000..45f67bb72
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/ancestor.nodes
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_cc7swM7REeOlS6AUBGqBsw" name="mapNC1">
+ <firstKeyNC href="#_jvFrwM7REeOlS6AUBGqBsw"/>
+ <firstKeyNC href="#_kLUUwM7REeOlS6AUBGqBsw"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_jvFrwM7REeOlS6AUBGqBsw" name="node1"/>
+ <containmentRef1 xmi:id="_kLUUwM7REeOlS6AUBGqBsw" name="node2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/left.nodes
new file mode 100644
index 000000000..ea8e9b916
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/left.nodes
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_cc7swM7REeOlS6AUBGqBsw" name="mapNC1">
+ <firstKeyNC href="#_jvFrwM7REeOlS6AUBGqBsw"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_jvFrwM7REeOlS6AUBGqBsw" name="node1"/>
+ <containmentRef1 xmi:id="_kLUUwM7REeOlS6AUBGqBsw" name="node2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/right.nodes
new file mode 100644
index 000000000..e3d61af67
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/delete/right.nodes
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_cc7swM7REeOlS6AUBGqBsw" name="mapNC1">
+ <firstKeyNC href="#_kLUUwM7REeOlS6AUBGqBsw"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_jvFrwM7REeOlS6AUBGqBsw" name="node1"/>
+ <containmentRef1 xmi:id="_kLUUwM7REeOlS6AUBGqBsw" name="node2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/ancestor.nodes
new file mode 100644
index 000000000..0670160fc
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/ancestor.nodes
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_7aUIsNRoEeOZ_K3DPNcuBQ" name="mapNC1">
+ <firstKeyNC href="#__CBPMNRoEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC href="#__TQwMNRoEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_9ecjoNRoEeOZ_K3DPNcuBQ" name="mapNC2">
+ <firstKeyNC href="#__j0UsNRoEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC href="#__3DZwNRoEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="__CBPMNRoEeOZ_K3DPNcuBQ" name="node1"/>
+ <containmentRef1 xmi:id="__TQwMNRoEeOZ_K3DPNcuBQ" name="node2"/>
+ <containmentRef1 xmi:id="__j0UsNRoEeOZ_K3DPNcuBQ" name="node3"/>
+ <containmentRef1 xmi:id="__3DZwNRoEeOZ_K3DPNcuBQ" name="node4"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/left.nodes
new file mode 100644
index 000000000..17cc93d70
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/left.nodes
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_7aUIsNRoEeOZ_K3DPNcuBQ" name="mapNC1">
+ <firstKeyNC href="#__TQwMNRoEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC href="#__CBPMNRoEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_9ecjoNRoEeOZ_K3DPNcuBQ" name="mapNC2">
+ <firstKeyNC href="#__j0UsNRoEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC href="#__3DZwNRoEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="__CBPMNRoEeOZ_K3DPNcuBQ" name="node1"/>
+ <containmentRef1 xmi:id="__TQwMNRoEeOZ_K3DPNcuBQ" name="node2"/>
+ <containmentRef1 xmi:id="__j0UsNRoEeOZ_K3DPNcuBQ" name="node3"/>
+ <containmentRef1 xmi:id="__3DZwNRoEeOZ_K3DPNcuBQ" name="node4"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/right.nodes
new file mode 100644
index 000000000..ea312b6db
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/moveorder/right.nodes
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_CEv4EM7REeOlS6AUBGqBsw" name="root">
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_7aUIsNRoEeOZ_K3DPNcuBQ" name="mapNC1">
+ <firstKeyNC href="#__CBPMNRoEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC href="#__TQwMNRoEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeFeatureMapNonContainment" xmi:id="_9ecjoNRoEeOZ_K3DPNcuBQ" name="mapNC2">
+ <firstKeyNC href="#__3DZwNRoEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC href="#__j0UsNRoEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="__CBPMNRoEeOZ_K3DPNcuBQ" name="node1"/>
+ <containmentRef1 xmi:id="__TQwMNRoEeOZ_K3DPNcuBQ" name="node2"/>
+ <containmentRef1 xmi:id="__j0UsNRoEeOZ_K3DPNcuBQ" name="node3"/>
+ <containmentRef1 xmi:id="__3DZwNRoEeOZ_K3DPNcuBQ" name="node4"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/ancestor.nodes
new file mode 100644
index 000000000..46aef674c
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/ancestor.nodes
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_tvyoUNQ6EeOj9Mzli6N-pQ"
+ name="mapNC1"/>
+ <containmentRef1
+ xmi:id="_NlnIYM9vEeOdILz30bQ-pA"
+ name="node1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/left.nodes
new file mode 100644
index 000000000..a7d812dba
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/left.nodes
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_tvyoUNQ6EeOj9Mzli6N-pQ"
+ name="mapNC1">
+ <firstKeyNC
+ href="#_NlnIYM9vEeOdILz30bQ-pA"/>
+ </containmentRef1>
+ <containmentRef1
+ xmi:id="_NlnIYM9vEeOdILz30bQ-pA"
+ name="node1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/right.nodes
new file mode 100644
index 000000000..a7d812dba
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/add/right.nodes
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_tvyoUNQ6EeOj9Mzli6N-pQ"
+ name="mapNC1">
+ <firstKeyNC
+ href="#_NlnIYM9vEeOdILz30bQ-pA"/>
+ </containmentRef1>
+ <containmentRef1
+ xmi:id="_NlnIYM9vEeOdILz30bQ-pA"
+ name="node1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/ancestor.nodes
new file mode 100644
index 000000000..a7d812dba
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/ancestor.nodes
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_tvyoUNQ6EeOj9Mzli6N-pQ"
+ name="mapNC1">
+ <firstKeyNC
+ href="#_NlnIYM9vEeOdILz30bQ-pA"/>
+ </containmentRef1>
+ <containmentRef1
+ xmi:id="_NlnIYM9vEeOdILz30bQ-pA"
+ name="node1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/left.nodes
new file mode 100644
index 000000000..46aef674c
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/left.nodes
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_tvyoUNQ6EeOj9Mzli6N-pQ"
+ name="mapNC1"/>
+ <containmentRef1
+ xmi:id="_NlnIYM9vEeOdILz30bQ-pA"
+ name="node1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/right.nodes
new file mode 100644
index 000000000..46aef674c
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/delete/right.nodes
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_tvyoUNQ6EeOj9Mzli6N-pQ"
+ name="mapNC1"/>
+ <containmentRef1
+ xmi:id="_NlnIYM9vEeOdILz30bQ-pA"
+ name="node1"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/ancestor.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/ancestor.nodes
new file mode 100644
index 000000000..3ae921a64
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/ancestor.nodes
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_U8h-sNRpEeOZ_K3DPNcuBQ"
+ name="mapNC1">
+ <firstKeyNC
+ href="#_Ym1GMNRpEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC
+ href="#_gLSWINRpEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1
+ xmi:id="_Ym1GMNRpEeOZ_K3DPNcuBQ"
+ name="node1"/>
+ <containmentRef1
+ xmi:id="_gLSWINRpEeOZ_K3DPNcuBQ"
+ name="node2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/left.nodes
new file mode 100644
index 000000000..8a7f71605
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/left.nodes
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_U8h-sNRpEeOZ_K3DPNcuBQ"
+ name="mapNC1">
+ <firstKeyNC
+ href="#_gLSWINRpEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC
+ href="#_Ym1GMNRpEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1
+ xmi:id="_Ym1GMNRpEeOZ_K3DPNcuBQ"
+ name="node1"/>
+ <containmentRef1
+ xmi:id="_gLSWINRpEeOZ_K3DPNcuBQ"
+ name="node2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/right.nodes
new file mode 100644
index 000000000..8a7f71605
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/featuremapscope/noncontainment/pseudoconflicts/moveorder/right.nodes
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_CEv4EM7REeOlS6AUBGqBsw"
+ name="root">
+ <containmentRef1
+ xsi:type="nodes:NodeFeatureMapNonContainment"
+ xmi:id="_U8h-sNRpEeOZ_K3DPNcuBQ"
+ name="mapNC1">
+ <firstKeyNC
+ href="#_gLSWINRpEeOZ_K3DPNcuBQ"/>
+ <firstKeyNC
+ href="#_Ym1GMNRpEeOZ_K3DPNcuBQ"/>
+ </containmentRef1>
+ <containmentRef1
+ xmi:id="_Ym1GMNRpEeOZ_K3DPNcuBQ"
+ name="node1"/>
+ <containmentRef1
+ xmi:id="_gLSWINRpEeOZ_K3DPNcuBQ"
+ name="node2"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AllTests.java
index 6f7953bae..ca965c0ea 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AllTests.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Obeo.
+ * Copyright (c) 2012, 2014 Obeo.
* 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
@@ -32,6 +32,10 @@ import org.eclipse.emf.compare.tests.match.MatchEngineFactoryRegistryTest;
import org.eclipse.emf.compare.tests.match.ProximityIndexTest;
import org.eclipse.emf.compare.tests.merge.ConflictMergeTest;
import org.eclipse.emf.compare.tests.merge.ExtensionMergeTest;
+import org.eclipse.emf.compare.tests.merge.FeatureMaps2wayMergeTest;
+import org.eclipse.emf.compare.tests.merge.FeatureMaps3wayMergeTest;
+import org.eclipse.emf.compare.tests.merge.FeatureMapsConflictsMergeTest;
+import org.eclipse.emf.compare.tests.merge.FeatureMapsPseudoConflictsMergeTest;
import org.eclipse.emf.compare.tests.merge.IndividualMergeOutOfScopeValuesTest;
import org.eclipse.emf.compare.tests.merge.IndividualMergeTest;
import org.eclipse.emf.compare.tests.merge.MultipleMergeTest;
@@ -62,7 +66,9 @@ import org.junit.runners.Suite.SuiteClasses;
IndividualMergeOutOfScopeValuesTest.class, ProximityComparisonTest.class,
DynamicInstanceComparisonTest.class, URIDistanceTest.class, FragmentationTest.class,
AllEditTests.class, CommandStackTestSuite.class, MatchEngineFactoryRegistryTest.class,
- ConflictMergeTest.class, PseudoConflictMergeTest.class, ProximityIndexTest.class, AllRCPTests.class })
+ ConflictMergeTest.class, PseudoConflictMergeTest.class, ProximityIndexTest.class, AllRCPTests.class,
+ FeatureMaps2wayMergeTest.class, FeatureMaps3wayMergeTest.class, FeatureMapsConflictsMergeTest.class,
+ FeatureMapsPseudoConflictsMergeTest.class })
public class AllTests {
/**
* Standalone launcher for all of compare's tests.

Back to the top