Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Dirix2015-05-06 06:42:07 -0400
committerAxel RICHARD2015-05-11 13:17:28 -0400
commit0c29d5db83bea1868aabfac3fb44d30ef95fc05e (patch)
tree2d10acf2e3a10075eb5c2c0206f130fe958cde3e /plugins/org.eclipse.emf.compare.uml2.tests
parent947f278f8c9abe7f5ca2493a76d9a0adbec5fd48 (diff)
downloadorg.eclipse.emf.compare-0c29d5db83bea1868aabfac3fb44d30ef95fc05e.tar.gz
org.eclipse.emf.compare-0c29d5db83bea1868aabfac3fb44d30ef95fc05e.tar.xz
org.eclipse.emf.compare-0c29d5db83bea1868aabfac3fb44d30ef95fc05e.zip
[466552] Increase priorities of conflict mergers
Increases the priority of the PseudoConflictMerger to 75 and the priority of the ConflictMerger to 100. This fixes merging issues originating from a too small PseudoConflictMerger priority value. Also offers a lot more possibilities for merger prioritizations by clients. Includes a testcase for UML models. Bug: 466552 Signed-off-by: Stefan Dirix <sdirix@eclipsesource.com> Change-Id: I29f964a47fb80d34cc6546afadab52d45204c12d
Diffstat (limited to 'plugins/org.eclipse.emf.compare.uml2.tests')
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLTest.java5
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/PseudoConflictTest.java78
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/ConflictInputData.java31
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/left.uml15
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/origin.uml5
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/right.uml15
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java17
7 files changed, 157 insertions, 9 deletions
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLTest.java
index ef7edc245..dd252f74b 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2012, 2014 Obeo.
+ * 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Stefan Dirix - update priority value for UML merger
*/
package org.eclipse.emf.compare.uml2.tests;
@@ -116,7 +117,7 @@ public abstract class AbstractUMLTest {
final IMerger umlMerger = new UMLMerger();
final IMerger umlReferenceChangeMerger = new UMLReferenceChangeMerger();
final IMerger opaqueElementBodyChangeMerger = new OpaqueElementBodyChangeMerger();
- umlMerger.setRanking(11);
+ umlMerger.setRanking(20);
umlReferenceChangeMerger.setRanking(25);
opaqueElementBodyChangeMerger.setRanking(25);
mergerRegistry.add(umlMerger);
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/PseudoConflictTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/PseudoConflictTest.java
new file mode 100644
index 000000000..68e4e6d73
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/PseudoConflictTest.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2015 EclipseSource Muenchen GmbH 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:
+ * Stefan Dirix - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.uml2.tests.conflict;
+
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import com.google.common.collect.Iterators;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.ConflictKind;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.merge.IMerger.Registry;
+import org.eclipse.emf.compare.merge.PseudoConflictMerger;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.conflict.data.ConflictInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+/**
+ * Tests the handling of pseudo conflicts within UML models.
+ *
+ * @author Stefan Dirix <sdirix@eclipsesource.com>
+ */
+public class PseudoConflictTest extends AbstractUMLTest {
+
+ /**
+ * Test input data.
+ */
+ private ConflictInputData input = new ConflictInputData();
+
+ /**
+ * Tests if EMF Compare uses the {@link PseudoConflictMerger} when merging pseudo conflicts of UML models.
+ *
+ * @throws IOException
+ * When an error is thrown while reading the models.
+ */
+ @Test
+ public void testPseudoConflictMergerPriority() throws IOException {
+ final Resource left = input.getA1Left();
+ final Resource right = input.getA1Right();
+ final Resource origin = input.getA1Origin();
+
+ final Comparison comparison = compare(left, right, origin);
+ final EList<Diff> differences = comparison.getDifferences();
+
+ Iterator<Diff> conflicts = Iterators.filter(differences.iterator(), hasConflict(ConflictKind.PSEUDO));
+
+ final Registry registry = getMergerRegistry();
+
+ while (conflicts.hasNext()) {
+ Diff conflict = conflicts.next();
+ IMerger merger = registry.getHighestRankingMerger(conflict);
+
+ assertThat(merger, instanceOf(PseudoConflictMerger.class));
+ }
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/ConflictInputData.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/ConflictInputData.java
new file mode 100644
index 000000000..c8eb9b0fb
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/ConflictInputData.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2015 EclipseSource Muenchen GmbH 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:
+ * Stefan Dirix - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.uml2.tests.conflict.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+@SuppressWarnings("nls")
+public class ConflictInputData extends AbstractUMLInputData {
+ public Resource getA1Left() throws IOException {
+ return loadFromClassLoader("a1/left.uml");
+ }
+
+ public Resource getA1Right() throws IOException {
+ return loadFromClassLoader("a1/right.uml");
+ }
+
+ public Resource getA1Origin() throws IOException {
+ return loadFromClassLoader("a1/origin.uml");
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/left.uml
new file mode 100644
index 000000000..189c8a695
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/left.uml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_Wo9kcV9kEeC2jdN7B1dxQw" name="myModel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_eOr_sF9kEeC2jdN7B1dxQw" name="Class1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_epJuIF9kEeC2jdN7B1dxQw" name="Class2"/>
+ <packagedElement xmi:type="uml:Association" xmi:id="_n8aCMF9kEeC2jdN7B1dxQw" name="class1sToClass2s" memberEnd="_n8bQUF9kEeC2jdN7B1dxQw _n8e6sF9kEeC2jdN7B1dxQw" navigableOwnedEnd="_n8bQUF9kEeC2jdN7B1dxQw _n8e6sF9kEeC2jdN7B1dxQw">
+ <ownedEnd xmi:id="_n8bQUF9kEeC2jdN7B1dxQw" name="class1s" type="_eOr_sF9kEeC2jdN7B1dxQw" association="_n8aCMF9kEeC2jdN7B1dxQw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_n8dskF9kEeC2jdN7B1dxQw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_n8eToF9kEeC2jdN7B1dxQw" value="*"/>
+ </ownedEnd>
+ <ownedEnd xmi:id="_n8e6sF9kEeC2jdN7B1dxQw" name="class2s" type="_epJuIF9kEeC2jdN7B1dxQw" association="_n8aCMF9kEeC2jdN7B1dxQw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_n8gv4F9kEeC2jdN7B1dxQw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_n8hW8F9kEeC2jdN7B1dxQw" value="*"/>
+ </ownedEnd>
+ </packagedElement>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/origin.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/origin.uml
new file mode 100644
index 000000000..24765c3f8
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/origin.uml
@@ -0,0 +1,5 @@
+<?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="_Wo9kcV9kEeC2jdN7B1dxQw" name="myModel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_eOr_sF9kEeC2jdN7B1dxQw" name="Class1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_epJuIF9kEeC2jdN7B1dxQw" name="Class2"/>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/right.uml
new file mode 100644
index 000000000..189c8a695
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/conflict/data/a1/right.uml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_Wo9kcV9kEeC2jdN7B1dxQw" name="myModel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_eOr_sF9kEeC2jdN7B1dxQw" name="Class1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_epJuIF9kEeC2jdN7B1dxQw" name="Class2"/>
+ <packagedElement xmi:type="uml:Association" xmi:id="_n8aCMF9kEeC2jdN7B1dxQw" name="class1sToClass2s" memberEnd="_n8bQUF9kEeC2jdN7B1dxQw _n8e6sF9kEeC2jdN7B1dxQw" navigableOwnedEnd="_n8bQUF9kEeC2jdN7B1dxQw _n8e6sF9kEeC2jdN7B1dxQw">
+ <ownedEnd xmi:id="_n8bQUF9kEeC2jdN7B1dxQw" name="class1s" type="_eOr_sF9kEeC2jdN7B1dxQw" association="_n8aCMF9kEeC2jdN7B1dxQw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_n8dskF9kEeC2jdN7B1dxQw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_n8eToF9kEeC2jdN7B1dxQw" value="*"/>
+ </ownedEnd>
+ <ownedEnd xmi:id="_n8e6sF9kEeC2jdN7B1dxQw" name="class2s" type="_epJuIF9kEeC2jdN7B1dxQw" association="_n8aCMF9kEeC2jdN7B1dxQw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_n8gv4F9kEeC2jdN7B1dxQw"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_n8hW8F9kEeC2jdN7B1dxQw" value="*"/>
+ </ownedEnd>
+ </packagedElement>
+</uml:Model>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java
index 0dc9c70b2..44bf7997f 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo and others.
+ * 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
@@ -8,6 +8,7 @@
* Contributors:
* Obeo - initial API and implementation
* Philip Langer - addition of OpaqueTest
+ * Stefan Dirix - addition of PseudoConflictTest
*******************************************************************************/
package org.eclipse.emf.compare.uml2.tests.suite;
@@ -19,6 +20,7 @@ import org.eclipse.emf.compare.uml2.tests.association.AddAssociation2Test;
import org.eclipse.emf.compare.uml2.tests.association.AddAssociation3Test;
import org.eclipse.emf.compare.uml2.tests.association.AddAssociationTest;
import org.eclipse.emf.compare.uml2.tests.association.ChangeAssociationTest;
+import org.eclipse.emf.compare.uml2.tests.conflict.PseudoConflictTest;
import org.eclipse.emf.compare.uml2.tests.dependency.AddAbstractionTest;
import org.eclipse.emf.compare.uml2.tests.dependency.AddDependencyTest;
import org.eclipse.emf.compare.uml2.tests.dependency.AddInterfaceRealizationTest;
@@ -60,12 +62,13 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({AddDependencyTest.class, AddAbstractionTest.class, AddAssociationTest.class,
ExtensionMergeTest.class, AddAssociation2Test.class, ChangeAssociationTest.class,
- ChangeDependencyTest.class, ChangeUsageTest.class, AddAssociation3Test.class, AddExtendTest.class,
- AddGeneralizationSetTest.class, AddInterfaceRealizationTest.class, AddRealizationTest.class,
- AddSubstitutionTest.class, AddUsageTest.class, AddMessageTest.class,
- AddActionExecutionSpecificationTest.class, AddBehaviorExecutionSpecificationTest.class,
- AddIncludeTest.class, AddTimeConstraintTest.class, StaticProfileTest.class, DynamicProfileTest.class,
- StaticStereotypeTest.class, StaticStereotypedElementChangeTests.class, DynamicStereotypeTest.class,
+ PseudoConflictTest.class, ChangeDependencyTest.class, ChangeUsageTest.class,
+ AddAssociation3Test.class, AddExtendTest.class, AddGeneralizationSetTest.class,
+ AddInterfaceRealizationTest.class, AddRealizationTest.class, AddSubstitutionTest.class,
+ AddUsageTest.class, AddMessageTest.class, AddActionExecutionSpecificationTest.class,
+ AddBehaviorExecutionSpecificationTest.class, AddIncludeTest.class, AddTimeConstraintTest.class,
+ StaticProfileTest.class, DynamicProfileTest.class, StaticStereotypeTest.class,
+ StaticStereotypedElementChangeTests.class, DynamicStereotypeTest.class,
DynamicStereotypedElementChangeTests.class, ImplicationsAssociationTest.class,
ImplicationsTransitionTest.class, ImplicationsInterfaceRealizationTest.class,
StaticStereotypedElementItemProviderTest.class, DynamicStereotypedElementItemProviderTest.class,

Back to the top