Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorvlorenzo2012-07-18 07:18:57 +0000
committervlorenzo2012-07-18 07:18:57 +0000
commite2ce831c65ede7976cf784a6ae36fc51bcb32413 (patch)
treeb5f390a7b12db43abcd21e98e2f05886e738c781 /tests
parenta08bd5094397934264b66d51fd8d343a7884b405 (diff)
downloadorg.eclipse.papyrus-e2ce831c65ede7976cf784a6ae36fc51bcb32413.tar.gz
org.eclipse.papyrus-e2ce831c65ede7976cf784a6ae36fc51bcb32413.tar.xz
org.eclipse.papyrus-e2ce831c65ede7976cf784a6ae36fc51bcb32413.zip
383880: [UML Compare] Profile and stereotyped element management
https://bugs.eclipse.org/bugs/show_bug.cgi?id=383880 Complete the tests for UMLStereotypeUpdateReference
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/resources/uml_standalone/stereotypeUpdateReference_1/left.uml4
-rw-r--r--tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/resources/uml_standalone/stereotypeUpdateReference_1/right.uml4
-rw-r--r--tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/src/org/eclipse/papyrus/uml/compare/diff/tests/uml/profile/standalone/UMLStereotypeUpdateReference_1_LeftToRight.java30
-rw-r--r--tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/src/org/eclipse/papyrus/uml/compare/diff/tests/uml/profile/standalone/UMLStereotypeUpdateReference_1_RightToLeft.java34
4 files changed, 63 insertions, 9 deletions
diff --git a/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/resources/uml_standalone/stereotypeUpdateReference_1/left.uml b/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/resources/uml_standalone/stereotypeUpdateReference_1/left.uml
index 14cd586226b..c1236edf4f8 100644
--- a/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/resources/uml_standalone/stereotypeUpdateReference_1/left.uml
+++ b/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/resources/uml_standalone/stereotypeUpdateReference_1/left.uml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Blocks="http://www.eclipse.org/papyrus/0.7.0/SysML/Blocks" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/0.7.0/SysML/Blocks http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks">
<uml:Model xmi:id="_2QmroMd7EeGHyYihMaoR6g" name="model">
- <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_b1ozQMd8EeGHyYihMaoR6g" name="InstanceSpecification1"/>
- <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_fuJV4Md8EeGHyYihMaoR6g" name="InstanceSpecification2"/>
+ <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_b1ozQMd8EeGHyYihMaoR6g" name="myUnit"/>
+ <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_fuJV4Md8EeGHyYihMaoR6g" name="myDimension"/>
<profileApplication xmi:id="_YNnjscd8EeGHyYihMaoR6g">
<eAnnotations xmi:id="_YNscMMd8EeGHyYihMaoR6g" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/>
diff --git a/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/resources/uml_standalone/stereotypeUpdateReference_1/right.uml b/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/resources/uml_standalone/stereotypeUpdateReference_1/right.uml
index 650ed786893..91559f06f99 100644
--- a/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/resources/uml_standalone/stereotypeUpdateReference_1/right.uml
+++ b/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/resources/uml_standalone/stereotypeUpdateReference_1/right.uml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Blocks="http://www.eclipse.org/papyrus/0.7.0/SysML/Blocks" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/0.7.0/SysML/Blocks http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks">
<uml:Model xmi:id="_2QmroMd7EeGHyYihMaoR6g" name="model">
- <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_b1ozQMd8EeGHyYihMaoR6g" name="InstanceSpecification1"/>
- <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_fuJV4Md8EeGHyYihMaoR6g" name="InstanceSpecification2"/>
+ <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_b1ozQMd8EeGHyYihMaoR6g" name="myUnit"/>
+ <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_fuJV4Md8EeGHyYihMaoR6g" name="myDimension"/>
<profileApplication xmi:id="_YNnjscd8EeGHyYihMaoR6g">
<eAnnotations xmi:id="_YNscMMd8EeGHyYihMaoR6g" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/>
diff --git a/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/src/org/eclipse/papyrus/uml/compare/diff/tests/uml/profile/standalone/UMLStereotypeUpdateReference_1_LeftToRight.java b/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/src/org/eclipse/papyrus/uml/compare/diff/tests/uml/profile/standalone/UMLStereotypeUpdateReference_1_LeftToRight.java
index 2ce87aed8b7..baa507a39f7 100644
--- a/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/src/org/eclipse/papyrus/uml/compare/diff/tests/uml/profile/standalone/UMLStereotypeUpdateReference_1_LeftToRight.java
+++ b/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/src/org/eclipse/papyrus/uml/compare/diff/tests/uml/profile/standalone/UMLStereotypeUpdateReference_1_LeftToRight.java
@@ -25,6 +25,9 @@ import org.eclipse.emf.compare.uml2diff.UMLStereotypeUpdateReference;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.core.resource.ModelMultiException;
import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Stereotype;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -86,13 +89,36 @@ public class UMLStereotypeUpdateReference_1_LeftToRight extends AbstractUMLStand
@Test
public void testModificationOnNotationFile() {
- Assert.fail();
+ super.testModificationOnDiFile(false);
}
@Test
public void testModificationOnUMLFile() {
- Assert.fail();
+ super.testModificationOnUMLFile(true);
+ final InstanceSpecification unit;
+ final InstanceSpecification dimension;
+
+ final String unitStereotypeName = "SysML::Blocks::Unit";
+ final String dimentsionStereotypeName = "SysML::Blocks::Dimension";
+ final String unitName = "myUnit";
+ final String dimensionName = "myDimension";
+ final Stereotype unitSte;
+ final Stereotype dimSte;
+ final Model model = (Model)rightElement;
+ unit = (InstanceSpecification)model.getOwnedMember(unitName);
+ dimension = (InstanceSpecification)model.getOwnedMember(dimensionName);
+
+ Assert.assertNotNull(unit);
+ Assert.assertNotNull(dimension);
+ unitSte = unit.getAppliedStereotype(unitStereotypeName);
+ dimSte = dimension.getAppliedStereotype(dimentsionStereotypeName);
+ Assert.assertNotNull(unitSte);
+ Assert.assertNotNull(dimSte);
+
+ //the test itself
+ Object value = unit.getValue(unitSte, "dimension");
+ Assert.assertTrue("The stererotype property has not been correctly merged", value==null);
}
diff --git a/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/src/org/eclipse/papyrus/uml/compare/diff/tests/uml/profile/standalone/UMLStereotypeUpdateReference_1_RightToLeft.java b/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/src/org/eclipse/papyrus/uml/compare/diff/tests/uml/profile/standalone/UMLStereotypeUpdateReference_1_RightToLeft.java
index 2ecf75eb0e8..3f7b129f510 100644
--- a/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/src/org/eclipse/papyrus/uml/compare/diff/tests/uml/profile/standalone/UMLStereotypeUpdateReference_1_RightToLeft.java
+++ b/tests/junit/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff.tests/src/org/eclipse/papyrus/uml/compare/diff/tests/uml/profile/standalone/UMLStereotypeUpdateReference_1_RightToLeft.java
@@ -17,6 +17,7 @@ import java.io.IOException;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.compare.diff.metamodel.DiffElement;
import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
@@ -25,6 +26,10 @@ import org.eclipse.emf.compare.uml2diff.UMLStereotypeUpdateReference;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.core.resource.ModelMultiException;
import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Stereotype;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -86,13 +91,36 @@ public class UMLStereotypeUpdateReference_1_RightToLeft extends AbstractUMLStand
@Test
public void testModificationOnNotationFile() {
- Assert.fail();
+ super.testModificationOnDiFile(false);
}
-
@Test
public void testModificationOnUMLFile() {
- Assert.fail();
+ super.testModificationOnUMLFile(true);
+ final InstanceSpecification unit;
+ final InstanceSpecification dimension;
+
+ final String unitStereotypeName = "SysML::Blocks::Unit";
+ final String dimentsionStereotypeName = "SysML::Blocks::Dimension";
+ final String unitName = "myUnit";
+ final String dimensionName = "myDimension";
+ final Stereotype unitSte;
+ final Stereotype dimSte;
+ final Model model = (Model)rightElement;
+ unit = (InstanceSpecification)model.getOwnedMember(unitName);
+ dimension = (InstanceSpecification)model.getOwnedMember(dimensionName);
+
+ Assert.assertNotNull(unit);
+ Assert.assertNotNull(dimension);
+ unitSte = unit.getAppliedStereotype(unitStereotypeName);
+ dimSte = dimension.getAppliedStereotype(dimentsionStereotypeName);
+ Assert.assertNotNull(unitSte);
+ Assert.assertNotNull(dimSte);
+
+ //the test itself
+ Object value = unit.getValue(unitSte, "dimension");
+ Assert.assertTrue("The stererotype property has not been correctly merged", value==dimension.getStereotypeApplication(dimSte));
+
}

Back to the top