Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Delaigue2015-12-16 10:26:20 -0500
committerLaurent Delaigue2016-01-05 08:09:55 -0500
commit72f4e844338af831fca31ec7e807681fe32dcf9e (patch)
tree2e55b97e9d9ad95d17e414c5f69e37c1d772d642 /plugins/org.eclipse.emf.compare.uml2.tests
parent6e901be5ab8674072fab250add2f996d4298a17f (diff)
downloadorg.eclipse.emf.compare-72f4e844338af831fca31ec7e807681fe32dcf9e.tar.gz
org.eclipse.emf.compare-72f4e844338af831fca31ec7e807681fe32dcf9e.tar.xz
org.eclipse.emf.compare-72f4e844338af831fca31ec7e807681fe32dcf9e.zip
[484576] Fix bug on pseudo-conflict computation
All references that pointed to the same object were added to the same pseudo-conflict. Bug: 484576 Change-Id: Iff88dd0d9e573db86bfd26d5a4f1fd51ceca7ba7 Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
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/nonreg/bug484576_pseudoconflicts/TestNonRegPseudoConflict_484576.java49
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/NonReg484576Data.java21
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/ancestor.uml13
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/left.uml9
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/right.uml12
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/suite/AllTests.java4
6 files changed, 107 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/TestNonRegPseudoConflict_484576.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/TestNonRegPseudoConflict_484576.java
new file mode 100644
index 000000000..b3e8bcbd2
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/TestNonRegPseudoConflict_484576.java
@@ -0,0 +1,49 @@
+package org.eclipse.emf.compare.uml2.tests.nonreg.bug484576_pseudoconflicts;
+
+import static com.google.common.collect.Collections2.filter;
+import static org.junit.Assert.assertEquals;
+
+import com.google.common.base.Predicate;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.ConflictKind;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
+import org.eclipse.emf.compare.uml2.tests.nonreg.bug484576_pseudoconflicts.data.NonReg484576Data;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.junit.Test;
+
+/**
+ * This test makes sure that bug 484576 is fixed. It means checking that pseudo-conflicts contain only
+ * equivalent diffs on each side and don't aggregate several unrelated diffs.
+ *
+ * @author <a href="mailto:laurent.delaigue@obeo.fr">Laurent Delaigue</a>
+ */
+public class TestNonRegPseudoConflict_484576 extends AbstractUMLTest {
+
+ private NonReg484576Data input = new NonReg484576Data();
+
+ @Test
+ public void testOnePseudoConflictPerDiff() throws IOException {
+ final Resource ancestor = input.getAncestor();
+ final Resource left = input.getLeft();
+ final Resource right = input.getRight();
+
+ final Comparison comparison = compare(left, right, ancestor);
+
+ assertEquals(3, comparison.getConflicts().size());
+ assertEquals(2, filter(comparison.getConflicts(), new Predicate<Conflict>() {
+ public boolean apply(Conflict conflict) {
+ return conflict.getKind() == ConflictKind.PSEUDO;
+ }
+ }).size());
+ }
+
+ @Override
+ protected AbstractUMLInputData getInput() {
+ return input;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/NonReg484576Data.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/NonReg484576Data.java
new file mode 100644
index 000000000..00e733074
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/NonReg484576Data.java
@@ -0,0 +1,21 @@
+package org.eclipse.emf.compare.uml2.tests.nonreg.bug484576_pseudoconflicts.data;
+
+import java.io.IOException;
+
+import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class NonReg484576Data extends AbstractUMLInputData {
+
+ public Resource getLeft() throws IOException {
+ return loadFromClassLoader("left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getRight() throws IOException {
+ return loadFromClassLoader("right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getAncestor() throws IOException {
+ return loadFromClassLoader("ancestor.uml"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/ancestor.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/ancestor.uml
new file mode 100644
index 000000000..c8fea2fd9
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/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.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/left.uml
new file mode 100644
index 000000000..20a37e4e8
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/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.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/right.uml
new file mode 100644
index 000000000..68b62fe48
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/nonreg/bug484576_pseudoconflicts/data/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.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 1fe3e2719..d20020be0 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
@@ -42,6 +42,7 @@ import org.eclipse.emf.compare.uml2.tests.include.AddIncludeTest;
import org.eclipse.emf.compare.uml2.tests.merge.ExtensionMergeTest;
import org.eclipse.emf.compare.uml2.tests.merge.MergeDiffInvolvingRefineDiffTest;
import org.eclipse.emf.compare.uml2.tests.message.AddMessageTest;
+import org.eclipse.emf.compare.uml2.tests.nonreg.bug484576_pseudoconflicts.TestNonRegPseudoConflict_484576;
import org.eclipse.emf.compare.uml2.tests.opaque.OpaqueElementBodyChangeDiffTest;
import org.eclipse.emf.compare.uml2.tests.opaque.OpaqueElementBodyChangeMergeTest;
import org.eclipse.emf.compare.uml2.tests.profiles.DynamicProfileTest;
@@ -75,7 +76,8 @@ import org.junit.runners.Suite.SuiteClasses;
ImplicationsTransitionTest.class, ImplicationsInterfaceRealizationTest.class,
StaticStereotypedElementItemProviderTest.class, DynamicStereotypedElementItemProviderTest.class,
OpaqueElementBodyChangeDiffTest.class, OpaqueElementBodyChangeMergeTest.class,
- DanglingStereotypeApplicationTest.class, MergeDiffInvolvingRefineDiffTest.class })
+ DanglingStereotypeApplicationTest.class, MergeDiffInvolvingRefineDiffTest.class,
+ TestNonRegPseudoConflict_484576.class })
public class AllTests {
/**

Back to the top