Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fleck2017-01-20 04:36:09 -0500
committerLaurent Goubet2017-06-27 11:14:34 -0400
commitb6d0be4ef8056a11690e2d0ce514476befcf2f1b (patch)
tree8bd4ff680a14e694649e0f5b7bbafdc16b0d806f /plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests
parent8bc41b3003625c3b09dc171f0ab383929ce04d72 (diff)
downloadorg.eclipse.emf.compare-b6d0be4ef8056a11690e2d0ce514476befcf2f1b.tar.gz
org.eclipse.emf.compare-b6d0be4ef8056a11690e2d0ce514476befcf2f1b.tar.xz
org.eclipse.emf.compare-b6d0be4ef8056a11690e2d0ce514476befcf2f1b.zip
[487151] Accept all non-conflicting changes fails to merge some diffs
Adapt diff merge computer to only return diffs that actually lead to a conflict in the exception and not all connected diffs to ensure that non-conflicting diffs are merged. Includes tests. Bug: 487151 Change-Id: I3f08e09c3e67066c57d86f572dc66a2d09ca5bb2 Signed-off-by: Martin Fleck <mfleck@eclipsesource.com> Signed-off-by: Simon Delisle <simon.delisle@ericsson.com> Also-by: Simon Delisle <simon.delisle@ericsson.com>
Diffstat (limited to 'plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests')
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java16
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java12
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_left.nodes7
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_origin.nodes11
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_right.nodes5
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/useCases1
6 files changed, 52 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
index c88fb7951..258233138 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
@@ -1931,6 +1931,22 @@ public class ConflictDetectionTest {
}
@Test
+ public void testE3UseCase() throws IOException {
+ final Resource left = input.getE3Left();
+ final Resource origin = input.getE3Origin();
+ final Resource right = input.getE3Right();
+
+ final IComparisonScope scope = new DefaultComparisonScope(left, right, origin);
+ final Comparison comparison = EMFCompare.builder().build().compare(scope);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ assertEquals(3, differences.size());
+ assertEquals(1, conflicts.size());
+ }
+
+ @Test
public void testFUseCase() throws IOException {
final Resource left = input.getFLeft();
final Resource origin = input.getFOrigin();
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java
index 4438a5369..396b70b30 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java
@@ -544,6 +544,18 @@ public class ConflictInputData extends AbstractInputData {
return loadFromClassLoader("e2/conflict_e2_right.nodes");
}
+ public Resource getE3Left() throws IOException {
+ return loadFromClassLoader("e3/conflict_e3_left.nodes");
+ }
+
+ public Resource getE3Origin() throws IOException {
+ return loadFromClassLoader("e3/conflict_e3_origin.nodes");
+ }
+
+ public Resource getE3Right() throws IOException {
+ return loadFromClassLoader("e3/conflict_e3_right.nodes");
+ }
+
public Resource getFLeft() throws IOException {
return loadFromClassLoader("f/conflict_f_left.nodes");
}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_left.nodes
new file mode 100644
index 000000000..818e238da
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_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:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_SSvAAJQ_EeGUu8zWDEISZA"
+ name="root"/>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_origin.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_origin.nodes
new file mode 100644
index 000000000..f31a847a7
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_origin.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:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_SSvAAJQ_EeGUu8zWDEISZA"
+ name="root">
+ <containmentRef1
+ xmi:id="_iQJe8JQ_EeGUu8zWDEISZA"
+ name="origin"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_right.nodes
new file mode 100644
index 000000000..e2802cdb4
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/e3/conflict_e3_right.nodes
@@ -0,0 +1,5 @@
+<?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="_SSvAAJQ_EeGUu8zWDEISZA" name="root">
+ <containmentRef1 xmi:id="_iQJe8JQ_EeGUu8zWDEISZA" name="origin"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueReference" xmi:id="_kT6GcJQ_EeGUu8zWDEISZA" name="conflictHolder" singleValuedReference="_iQJe8JQ_EeGUu8zWDEISZA"/>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/useCases b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/useCases
index 037dabf81..08c00b00b 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/useCases
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/useCases
@@ -36,6 +36,7 @@ These only apply to reference changes
e - Adding reference towards deleted Notifier.
e1 - Within single-valued reference.
e2 - Within multi-valued reference.
+ e3 - Add a single-valued reference on the right side to a node that has been deleted on the left side.
f - Changing containment feature of Notifier to two distinct features in left and right.
g - Changing container of Notifier to two distinct Notifiers in left and right.

Back to the top