Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Cartaud2015-12-16 10:27:41 -0500
committerMathieu Cartaud2016-01-08 11:09:15 -0500
commit341c5b1091ce188e7703750e8b61f8196cb90838 (patch)
tree0dfa59207cb4da0bdd986e517b298a950d84c405 /plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare
parent230f8d1c3c6cc911aaea8f5fcee062193a6b9a79 (diff)
downloadorg.eclipse.emf.compare-341c5b1091ce188e7703750e8b61f8196cb90838.tar.gz
org.eclipse.emf.compare-341c5b1091ce188e7703750e8b61f8196cb90838.tar.xz
org.eclipse.emf.compare-341c5b1091ce188e7703750e8b61f8196cb90838.zip
[484579] Fix merge consequences algorithm
When computing the consequences of a merge, one must be careful when pseudo-conflict cause diffs from the other side to be merged, since then the leftToRight parameter must be negated to get the relevant consequences for these "opposite side" diffs. Bug: 484579 Change-Id: I34eb80d028068d2b80a59d42fcb3fb9ea9ed0053 Also-by: Laurent Delaigue <laurent.delaigue@obeo.fr> Signed-off-by: Mathieu Cartaud <mathieu.cartaud@obeo.fr>
Diffstat (limited to 'plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare')
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/checkers/MergeDependenciesChecker.java66
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictImplicationsTest_Bug484579.java269
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/IndividualDiffInputData.java26
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/ancestor.ecore12
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/ancestor.uml13
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/left.ecore5
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/left.uml9
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/right.ecore10
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/right.uml12
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AtLeastLunaVersionTests.java63
10 files changed, 484 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/checkers/MergeDependenciesChecker.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/checkers/MergeDependenciesChecker.java
new file mode 100644
index 000000000..f59c143b2
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/checkers/MergeDependenciesChecker.java
@@ -0,0 +1,66 @@
+package org.eclipse.emf.compare.tests.checkers;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Set;
+
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.internal.merge.MergeDependenciesUtil;
+import org.eclipse.emf.compare.merge.IMerger;
+
+@SuppressWarnings("restriction")
+public class MergeDependenciesChecker {
+
+ private IMerger.Registry registry;
+
+ private Diff diff;
+
+ private int nbMerges = 0;
+
+ private int nbDeletions = 0;
+
+ private boolean isFromRight = true;
+
+ private MergeDependenciesChecker() {
+ // Do nothing
+ }
+
+ private MergeDependenciesChecker(IMerger.Registry mergerRegistry, Diff testedDiff) {
+ this.registry = mergerRegistry;
+ this.diff = testedDiff;
+ }
+
+ public static MergeDependenciesChecker getDependenciesChecker(IMerger.Registry mergerRegistry,
+ Diff testedDiff) {
+ return new MergeDependenciesChecker(mergerRegistry, testedDiff);
+ }
+
+ public MergeDependenciesChecker implies(int nbResultingMerges) {
+ this.nbMerges = nbResultingMerges;
+ return this;
+ }
+
+ public MergeDependenciesChecker rejects(int nbResultingRejections) {
+ this.nbDeletions = nbResultingRejections;
+ return this;
+ }
+
+ public MergeDependenciesChecker rightToLeft() {
+ this.isFromRight = true;
+ return this;
+ }
+
+ public MergeDependenciesChecker leftToRight() {
+ this.isFromRight = false;
+ return this;
+ }
+
+ public void check() {
+ Set<Diff> allResultingMerges = MergeDependenciesUtil.getAllResultingMerges(diff, registry,
+ this.isFromRight);
+ Set<Diff> allResultingRejections = MergeDependenciesUtil.getAllResultingRejections(diff, registry,
+ this.isFromRight);
+ assertEquals(this.nbMerges, allResultingMerges.size());
+ assertEquals(this.nbDeletions, allResultingRejections.size());
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictImplicationsTest_Bug484579.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictImplicationsTest_Bug484579.java
new file mode 100644
index 000000000..2dbbf7e5a
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/ConflictImplicationsTest_Bug484579.java
@@ -0,0 +1,269 @@
+/**
+ * Copyright (c) 2012, 2016 Obeo and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ */
+package org.eclipse.emf.compare.tests.merge;
+
+import static org.eclipse.emf.compare.ConflictKind.PSEUDO;
+import static org.eclipse.emf.compare.ConflictKind.REAL;
+import static org.eclipse.emf.compare.DifferenceSource.LEFT;
+import static org.eclipse.emf.compare.DifferenceSource.RIGHT;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import com.google.common.collect.Collections2;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.EMFCompare;
+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.checkers.MergeDependenciesChecker;
+import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
+import org.eclipse.emf.compare.utils.EMFComparePredicates;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+/**
+ * This test class verifies that MergeDependenciesUtil computes the correct requirements. It focuses on
+ * conflicts and pseudo-conflicts with dependencies.
+ *
+ * @see bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=484579">484579</a> for more details.
+ */
+public class ConflictImplicationsTest_Bug484579 {
+
+ private IndividualDiffInputData input = new IndividualDiffInputData();
+
+ private final IMerger.Registry mergerRegistry = IMerger.RegistryImpl.createStandaloneInstance();
+
+ /**
+ * Assert that the rejection of the deletion of PackageY (right to left) will not lead to unwanted
+ * dependencies dues to the presence of a pseudo conflicts (with dependencies) on a child element of
+ * packageY.
+ *
+ * <pre>
+ * The ancestor model:
+ * - PackageA
+ * - ClassB
+ * - PackageX
+ * - PackageY
+ * - ClassZ -> ClassB
+ *
+ * The left model:
+ * - PackageX
+ *
+ * The right model:
+ * - PackageA2
+ * - ClassB2
+ * - PackageX
+ * - PackageY
+ * </pre>
+ *
+ * The comparison on those models leads to a pseudo-conflict (deletion of ClassZ -> ClassB) and two
+ * conflicts (renaming of PackageA and ClassB).
+ *
+ * @throws IOException
+ */
+ @Test
+ public void testImplicationBetweenConflicts() throws IOException {
+ Diff deletePackageY = setupImplicationBetweenConflicts();
+
+ MergeDependenciesChecker checker = getChecker(deletePackageY);
+ checker.rightToLeft().implies(1).rejects(0).check();
+ checker.leftToRight().implies(5).rejects(0).check();
+ }
+
+ /**
+ * Test the dependencies between two conflicting diffs if on one side an element is deleted (which implies
+ * other diff merging) and on the other the element is moved (which may implies other dependencies).
+ *
+ * @throws IOException
+ */
+ @Test
+ public void testImplicationsBetweenMoveAndDeleteConflicts() throws IOException {
+ Collection<Conflict> realConflicts = setupImplicationBetweenMoveAndDelete();
+
+ // Conflict should contain 2 diffs, one from left, the other from right
+ Conflict next = realConflicts.iterator().next();
+ Collection<Diff> conflict1FromLeft = Collections2.filter(next.getDifferences(), fromSide(LEFT));
+ Collection<Diff> conflict1FromRight = Collections2.filter(next.getDifferences(), fromSide(RIGHT));
+ assertEquals(1, conflict1FromLeft.size());
+ assertEquals(1, conflict1FromRight.size());
+
+ // Get each diff of the conflicts
+ Diff deletePackageD = conflict1FromLeft.iterator().next();
+ Diff movePackageD = conflict1FromRight.iterator().next();
+
+ MergeDependenciesChecker checker = getChecker(deletePackageD);
+ checker.rightToLeft().implies(1).rejects(0).check();
+ checker.leftToRight().implies(2).rejects(1).check();
+
+ checker = getChecker(movePackageD);
+ checker.rightToLeft().implies(1).rejects(1).check();
+ checker.leftToRight().implies(1).rejects(0).check();
+ }
+
+ /**
+ * Get a MergeDependenciesChecker for the diff.
+ *
+ * @param diff
+ * The diff to check
+ * @return an instance of MergeDependenciesChecker for the given diff
+ */
+ private MergeDependenciesChecker getChecker(Diff diff) {
+ return MergeDependenciesChecker.getDependenciesChecker(mergerRegistry, diff);
+ }
+
+ /**
+ * Setup the test checking the implication between conflicts. This setup will assert that the dependencies
+ * of all the diffs are correct, then return the exact diff to test in order to validate the point.
+ *
+ * @return the diff we want to check
+ * @throws IOException
+ */
+ private Diff setupImplicationBetweenConflicts() throws IOException {
+ final Resource origin = input.getConflictAndPseudoConflictImplicationsAncestor();
+ final Resource left = input.getConflictAndPseudoConflictImplicationsLeft();
+ final Resource right = input.getConflictAndPseudoConflictImplicationsRight();
+
+ MergeDependenciesChecker checker = null;
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ EList<Conflict> conflicts = comparison.getConflicts();
+ EList<Diff> differences = comparison.getDifferences();
+
+ assertEquals(9, comparison.getDifferences().size());
+ assertEquals(3, conflicts.size());
+
+ Collection<Conflict> pseudoConflicts = Collections2.filter(conflicts, EMFComparePredicates
+ .containsConflictOfTypes(PSEUDO));
+ Collection<Conflict> realConflicts = Collections2.filter(conflicts, EMFComparePredicates
+ .containsConflictOfTypes(REAL));
+
+ assertEquals(1, pseudoConflicts.size());
+ assertEquals(2, realConflicts.size());
+
+ EList<Diff> pseudoConflictDifferences = pseudoConflicts.iterator().next().getDifferences();
+ Collection<Diff> pseudoConflictsFromLeft = Collections2.filter(pseudoConflictDifferences,
+ fromSide(LEFT));
+ Collection<Diff> pseudoConflictFromRight = Collections2.filter(pseudoConflictDifferences,
+ fromSide(RIGHT));
+
+ Conflict real1 = null;
+ Conflict real2 = null;
+ for (Conflict conflict : realConflicts) {
+ if (conflict.getLeftDifferences().get(0).getMatch().getDifferences().size() == 1) {
+ real2 = conflict;
+ } else if (conflict.getLeftDifferences().get(0).getMatch().getDifferences().size() == 2) {
+ real1 = conflict;
+ }
+ }
+
+ assertNotNull(real1);
+ assertNotNull(real2);
+
+ // Conflict should contain 2 diffs, one from left, the other from right
+ Collection<Diff> conflict1FromLeft = Collections2.filter(real1.getDifferences(), fromSide(LEFT));
+ Collection<Diff> conflict1FromRight = Collections2.filter(real1.getDifferences(), fromSide(RIGHT));
+ assertEquals(1, conflict1FromLeft.size());
+ assertEquals(1, conflict1FromRight.size());
+
+ // Conflict should contain 2 diffs, one from left, the other from right
+ Collection<Diff> conflict2FromLeft = Collections2.filter(real2.getDifferences(), fromSide(LEFT));
+ Collection<Diff> conflict2FromRight = Collections2.filter(real2.getDifferences(), fromSide(RIGHT));
+ assertEquals(1, conflict2FromLeft.size());
+ assertEquals(1, conflict2FromRight.size());
+
+ // Get each diff of the conflicts
+ Diff deleteClassB = conflict1FromLeft.iterator().next();
+ differences.remove(deleteClassB);
+ Diff renameClassB = conflict1FromRight.iterator().next();
+ differences.remove(renameClassB);
+ Diff deletePackageA = conflict2FromLeft.iterator().next();
+ differences.remove(deletePackageA);
+ Diff renamePackageA = conflict2FromRight.iterator().next();
+ differences.remove(renamePackageA);
+
+ // Each pseudo-conflicting diff from left should implies 6 other diff when merging from right to left,
+ // and 3 other when merging from left to right.
+ for (Diff diff : pseudoConflictsFromLeft) {
+ differences.remove(diff);
+ checker = getChecker(diff);
+ checker.rightToLeft().implies(7).rejects(0).check();
+ checker.leftToRight().implies(4).rejects(0).check();
+ }
+
+ // Each pseudo-conflicting diff from right should implies 3 other diff when merging from right to
+ // left, and 6 other when merging from left to right.
+ for (Diff diff : pseudoConflictFromRight) {
+ differences.remove(diff);
+ checker = getChecker(diff);
+ checker.rightToLeft().implies(4).rejects(0).check();
+ checker.leftToRight().implies(7).rejects(0).check();
+ }
+
+ checker = getChecker(deleteClassB);
+ checker.rightToLeft().implies(2).rejects(0).check();
+ checker.leftToRight().implies(5).rejects(1).check();
+
+ checker = getChecker(renameClassB);
+ checker.rightToLeft().implies(1).rejects(2).check();
+ checker.leftToRight().implies(1).rejects(0).check();
+
+ checker = getChecker(deletePackageA);
+ checker.rightToLeft().implies(1).rejects(0).check();
+ checker.leftToRight().implies(6).rejects(2).check();
+
+ checker = getChecker(renamePackageA);
+ checker.rightToLeft().implies(1).rejects(1).check();
+ checker.leftToRight().implies(1).rejects(0).check();
+
+ assertEquals(1, differences.size());
+ return differences.get(0);
+ }
+
+ /**
+ * Setup the test checking implication between move and delete.
+ *
+ * @return the list of pseudoConflicts to test
+ * @throws IOException
+ */
+ private Collection<Conflict> setupImplicationBetweenMoveAndDelete() throws IOException {
+ final Resource origin = input.getMoveConflictAndPseudoConflictImplicationsAncestor();
+ final Resource left = input.getMoveConflictAndPseudoConflictImplicationsLeft();
+ final Resource right = input.getMoveConflictAndPseudoConflictImplicationsRight();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ EList<Conflict> conflicts = comparison.getConflicts();
+
+ assertEquals(17, comparison.getDifferences().size());
+ assertEquals(3, conflicts.size());
+
+ Collection<Conflict> pseudoConflicts = Collections2.filter(conflicts, EMFComparePredicates
+ .containsConflictOfTypes(PSEUDO));
+ Collection<Conflict> realConflicts = Collections2.filter(conflicts, EMFComparePredicates
+ .containsConflictOfTypes(REAL));
+
+ assertEquals(2, pseudoConflicts.size());
+ assertEquals(1, realConflicts.size());
+
+ return realConflicts;
+ }
+}
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 fb8f98a37..eab07a4fc 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
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2012, 2014 Obeo and others.
+ * Copyright (c) 2012, 2016 Obeo and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -787,4 +787,28 @@ public class IndividualDiffInputData extends AbstractInputData {
public Resource getLeftAddRightDeleteRightEEnumConflictScope() throws IOException {
return loadFromClassLoader("conflictscope/leftadd_rightdelete/eenum/right.nodes");
}
+
+ public Resource getConflictAndPseudoConflictImplicationsAncestor() throws IOException {
+ return loadFromClassLoader("dependencies/bug_484579/ancestor.ecore");
+ }
+
+ public Resource getConflictAndPseudoConflictImplicationsLeft() throws IOException {
+ return loadFromClassLoader("dependencies/bug_484579/left.ecore");
+ }
+
+ public Resource getConflictAndPseudoConflictImplicationsRight() throws IOException {
+ return loadFromClassLoader("dependencies/bug_484579/right.ecore");
+ }
+
+ public Resource getMoveConflictAndPseudoConflictImplicationsAncestor() throws IOException {
+ return loadFromClassLoader("dependencies/bug_484579/ancestor.uml");
+ }
+
+ public Resource getMoveConflictAndPseudoConflictImplicationsLeft() throws IOException {
+ return loadFromClassLoader("dependencies/bug_484579/left.uml");
+ }
+
+ public Resource getMoveConflictAndPseudoConflictImplicationsRight() throws IOException {
+ return loadFromClassLoader("dependencies/bug_484579/right.uml");
+ }
}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/ancestor.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/ancestor.ecore
new file mode 100644
index 000000000..0bab96ba6
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/ancestor.ecore
@@ -0,0 +1,12 @@
+<?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="root">
+ <eSubpackages name="packageA">
+ <eClassifiers xsi:type="ecore:EClass" name="ClassB"/>
+ </eSubpackages>
+ <eSubpackages name="PackageX">
+ <eSubpackages name="PackageY">
+ <eClassifiers xsi:type="ecore:EClass" name="ClassZ" eSuperTypes="#//packageA/ClassB"/>
+ </eSubpackages>
+ </eSubpackages>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/ancestor.uml b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/ancestor.uml
new file mode 100644
index 000000000..c8fea2fd9
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/ancestor.uml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_ELFLoKQDEeW16bbjeutN8w">
+ <packagedElement xmi:type="uml:Package" xmi:id="_Gh7HMKQDEeW16bbjeutN8w" name="pA">
+ <packagedElement xmi:type="uml:Package" xmi:id="_IpAvgKQDEeW16bbjeutN8w" name="pB">
+ <packagedElement xmi:type="uml:Package" xmi:id="_Ksu6wKQDEeW16bbjeutN8w" name="pC"/>
+ </packagedElement>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Package" xmi:id="_hQz5sKTJEeW_uZh47B1XEw" name="pD"/>
+ <packagedElement xmi:type="uml:Dependency" xmi:id="_MNjNQKQDEeW16bbjeutN8w" name="A to B" client="_IpAvgKQDEeW16bbjeutN8w" supplier="_Gh7HMKQDEeW16bbjeutN8w"/>
+ <packagedElement xmi:type="uml:Dependency" xmi:id="_Vc21cKQDEeW16bbjeutN8w" name="B to C" client="_Ksu6wKQDEeW16bbjeutN8w" supplier="_IpAvgKQDEeW16bbjeutN8w"/>
+ <packagedElement xmi:type="uml:Dependency" xmi:id="_eU9MkKTJEeW_uZh47B1XEw" name="A to C" client="_Ksu6wKQDEeW16bbjeutN8w" supplier="_Gh7HMKQDEeW16bbjeutN8w"/>
+ <packagedElement xmi:type="uml:Dependency" xmi:id="_elbRgKTJEeW_uZh47B1XEw" name="A to D" client="_hQz5sKTJEeW_uZh47B1XEw" supplier="_Gh7HMKQDEeW16bbjeutN8w"/>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/left.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/left.ecore
new file mode 100644
index 000000000..cfefd08d8
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/left.ecore
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ name="root">
+ <eSubpackages name="PackageX"/>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/left.uml b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/left.uml
new file mode 100644
index 000000000..20a37e4e8
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/left.uml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_ELFLoKQDEeW16bbjeutN8w">
+ <packagedElement xmi:type="uml:Package" xmi:id="_Gh7HMKQDEeW16bbjeutN8w" name="pA">
+ <packagedElement xmi:type="uml:Package" xmi:id="_IpAvgKQDEeW16bbjeutN8w" name="pB">
+ <packagedElement xmi:type="uml:Package" xmi:id="_Ksu6wKQDEeW16bbjeutN8w" name="pC"/>
+ </packagedElement>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Dependency" xmi:id="_MNjNQKQDEeW16bbjeutN8w" name="A to B" client="_IpAvgKQDEeW16bbjeutN8w" supplier="_Gh7HMKQDEeW16bbjeutN8w"/>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/right.ecore b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/right.ecore
new file mode 100644
index 000000000..0261e9813
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/right.ecore
@@ -0,0 +1,10 @@
+<?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="root">
+ <eSubpackages name="packageA2">
+ <eClassifiers xsi:type="ecore:EClass" name="ClassB2"/>
+ </eSubpackages>
+ <eSubpackages name="PackageX">
+ <eSubpackages name="PackageY"/>
+ </eSubpackages>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/right.uml b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/right.uml
new file mode 100644
index 000000000..68b62fe48
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/merge/data/dependencies/bug_484579/right.uml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_ELFLoKQDEeW16bbjeutN8w">
+ <packagedElement xmi:type="uml:Package" xmi:id="_Gh7HMKQDEeW16bbjeutN8w" name="pA">
+ <packagedElement xmi:type="uml:Package" xmi:id="_IpAvgKQDEeW16bbjeutN8w" name="pB">
+ <packagedElement xmi:type="uml:Package" xmi:id="_Ksu6wKQDEeW16bbjeutN8w" name="pC">
+ <packagedElement xmi:type="uml:Package" xmi:id="_hQz5sKTJEeW_uZh47B1XEw" name="pD"/>
+ </packagedElement>
+ </packagedElement>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Dependency" xmi:id="_MNjNQKQDEeW16bbjeutN8w" name="A to B" client="_IpAvgKQDEeW16bbjeutN8w" supplier="_Gh7HMKQDEeW16bbjeutN8w"/>
+ <packagedElement xmi:type="uml:Dependency" xmi:id="_elbRgKTJEeW_uZh47B1XEw" name="A to D" client="_hQz5sKTJEeW_uZh47B1XEw" supplier="_Gh7HMKQDEeW16bbjeutN8w"/>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AtLeastLunaVersionTests.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AtLeastLunaVersionTests.java
new file mode 100644
index 000000000..599e0864b
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AtLeastLunaVersionTests.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2015 Obeo and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.suite;
+
+import junit.framework.JUnit4TestAdapter;
+import junit.framework.Test;
+import junit.textui.TestRunner;
+
+import org.eclipse.emf.compare.ComparePackage;
+import org.eclipse.emf.compare.tests.merge.ConflictImplicationsTest_Bug484579;
+import org.eclipse.emf.compare.tests.nodes.NodesPackage;
+import org.eclipse.emf.compare.tests.nodes.util.NodesResourceFactoryImpl;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * This test suite allows us to launch the test which are only compatible with Eclipse Luna and newer
+ * versions.
+ *
+ * @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
+ */
+@RunWith(Suite.class)
+@SuiteClasses({ConflictImplicationsTest_Bug484579.class })
+public class AtLeastLunaVersionTests {
+ /**
+ * Standalone launcher for all of compare's tests.
+ *
+ * @generated
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+
+ /**
+ * This will return a suite populated with all tests available through this class.
+ *
+ * @generated
+ */
+ public static Test suite() {
+ return new JUnit4TestAdapter(CompareTestSuite.class);
+ }
+
+ @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());
+ }
+}

Back to the top