Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2015-06-18 05:32:40 -0400
committerAxel Richard2015-06-18 05:32:40 -0400
commit89c5855aa49fca8221665d62c5ea9f1394b3951d (patch)
tree226199a4eb80d2c10ccdb6bb24acaa6ba693b769 /plugins/org.eclipse.emf.compare.uml2.tests
parent3d76dcc75feff47c236b88764f04e6a1db394639 (diff)
downloadorg.eclipse.emf.compare-89c5855aa49fca8221665d62c5ea9f1394b3951d.tar.gz
org.eclipse.emf.compare-89c5855aa49fca8221665d62c5ea9f1394b3951d.tar.xz
org.eclipse.emf.compare-89c5855aa49fca8221665d62c5ea9f1394b3951d.zip
Fix UML DanglingStereotypeApplication detection
The detection was too permissive. Also add a new test to make sure that the problematic case is now solved. Change-Id: Iea5bc99eaa04c8a1d7c836c4b6b74396af6c5d00 Signed-off-by: Axel Richard <axel.richard@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/stereotypes/DanglingStereotypeApplicationTest.java16
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/DanglingStereotypeApplicationInputData.java8
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/case4/left.uml7
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/case4/right.uml6
4 files changed, 37 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/DanglingStereotypeApplicationTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/DanglingStereotypeApplicationTest.java
index 43fe110dc..8f59b03c1 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/DanglingStereotypeApplicationTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/DanglingStereotypeApplicationTest.java
@@ -130,6 +130,22 @@ public class DanglingStereotypeApplicationTest extends AbstractUMLProfileTest {
}
/**
+ * Case 4 : a real Resource Attachment Change (a resource has been controlled on one side), but not a
+ * dangling stereotype application because there are no profiles involved in the comparison. So, In this
+ * case, no DanglingStereotypeApplication should be detected.
+ */
+ @Test
+ public void testDetectDanglingStereotypeApplication_Case4() throws IOException {
+ Comparison comparison = compare(input.getCase4Left(), input.getCase4Right(), null);
+ Iterable<ResourceAttachmentChange> racs = filter(comparison.getDifferences(),
+ ResourceAttachmentChange.class);
+ assertEquals(1, size(racs));
+ Iterable<DanglingStereotypeApplication> danglings = filter(comparison.getDifferences(),
+ DanglingStereotypeApplication.class);
+ assertEquals(0, size(danglings));
+ }
+
+ /**
* Case 1: Dangling stereotype with nothing on the other side. A merge from left to right of the
* DanglingStereotypeApplication will lead to delete the dangling stereotype on the right model.
*/
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/DanglingStereotypeApplicationInputData.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/DanglingStereotypeApplicationInputData.java
index 447ce309d..8f0338893 100644
--- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/DanglingStereotypeApplicationInputData.java
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/DanglingStereotypeApplicationInputData.java
@@ -53,6 +53,14 @@ public class DanglingStereotypeApplicationInputData extends AbstractUMLInputData
return loadFromClassLoader("case3/right.uml"); //$NON-NLS-1$
}
+ public Resource getCase4Left() throws IOException {
+ return loadFromClassLoader("case4/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getCase4Right() throws IOException {
+ return loadFromClassLoader("case4/right.uml"); //$NON-NLS-1$
+ }
+
@Override
protected Resource loadFromClassLoader(String string) throws IOException {
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/case4/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/case4/left.uml
new file mode 100644
index 000000000..0e455adc5
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/case4/left.uml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:testProfile="http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile#//uml2comparetestprofile">
+ <uml:Model xmi:id="_6rQaMGBlEeCwQ5tRW0zUZA" name="aModel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_OEBOkPNPEeG0ipjyqWM1zA" name="Test"/>
+ </uml:Model>
+ <uml:Model xmi:id="_7sRbNHCmEeCwQ5tRW0zUZA" name="aModel2"/>
+</xmi:XMI>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/case4/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/case4/right.uml
new file mode 100644
index 000000000..01a28d292
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dangling/case4/right.uml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:testProfile="http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile http://www.eclipse.org/emf/compare/uml2/1.0.0/testprofile#//uml2comparetestprofile">
+ <uml:Model xmi:id="_6rQaMGBlEeCwQ5tRW0zUZA" name="aModel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_OEBOkPNPEeG0ipjyqWM1zA" name="Test"/>
+ </uml:Model>
+</xmi:XMI>

Back to the top