diff options
14 files changed, 426 insertions, 217 deletions
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Class3.di b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Class3.di new file mode 100644 index 00000000000..9bddb6f752a --- /dev/null +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Class3.di @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="ASCII"?> +<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi"> + <pageList/> + <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> + <windows> + <children xsi:type="di:TabFolder"/> + </windows> + </sashModel> +</di:SashWindowsMngr> diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Class3.notation b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Class3.notation new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Class3.notation @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/> diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Class3.uml b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Class3.uml new file mode 100644 index 00000000000..dfffc2f5133 --- /dev/null +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Class3.uml @@ -0,0 +1,5 @@ +<?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:ExternalResourcesTestProfile="http:///schemas/ExternalResourcesTestProfile/_aPlNkPLZEeKxdJFsMzlLJA/1" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http:///schemas/ExternalResourcesTestProfile/_aPlNkPLZEeKxdJFsMzlLJA/1 pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_aPl0oPLZEeKxdJFsMzlLJA"> + <uml:Class xmi:id="_YpQ8UBCvEeOTVqJPk38YKg" name="Class3"/> + <ExternalResourcesTestProfile:ClassStereotype xmi:id="_cEyA8BCvEeOTVqJPk38YKg" base_Class="_YpQ8UBCvEeOTVqJPk38YKg"/> +</xmi:XMI> diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Package1.di b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Package1.di new file mode 100644 index 00000000000..9bddb6f752a --- /dev/null +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Package1.di @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="ASCII"?> +<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi"> + <pageList/> + <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> + <windows> + <children xsi:type="di:TabFolder"/> + </windows> + </sashModel> +</di:SashWindowsMngr> diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Package1.notation b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Package1.notation new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Package1.notation @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/> diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Package1.uml b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Package1.uml new file mode 100644 index 00000000000..9c10cf2a4b2 --- /dev/null +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/Package1.uml @@ -0,0 +1,21 @@ +<?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:ExternalResourcesTestProfile="http:///schemas/ExternalResourcesTestProfile/_aPlNkPLZEeKxdJFsMzlLJA/1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http:///schemas/ExternalResourcesTestProfile/_aPlNkPLZEeKxdJFsMzlLJA/1 pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_aPl0oPLZEeKxdJFsMzlLJA"> + <uml:Package xmi:id="_VSiREBCvEeOTVqJPk38YKg" name="Package1"> + <packagedElement xmi:type="uml:Class" xmi:id="_WzY_0BCvEeOTVqJPk38YKg" name="Package1_Class1"/> + <profileApplication xmi:id="_fTc8YBCvEeOTVqJPk38YKg"> + <eAnnotations xmi:id="_fTq-0BCvEeOTVqJPk38YKg" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_aPl0oPLZEeKxdJFsMzlLJA"/> + </eAnnotations> + <eAnnotations xmi:id="_fZtVYBCvEeOTVqJPk38YKg" source="duplicatedProfile"/> + <appliedProfile href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_yW4wUPLPEeKxdJFsMzlLJA"/> + </profileApplication> + <profileApplication xmi:id="_fZt8cBCvEeOTVqJPk38YKg"> + <eAnnotations xmi:id="_faAQUBCvEeOTVqJPk38YKg" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_aPpfAfLZEeKxdJFsMzlLJA"/> + </eAnnotations> + <eAnnotations xmi:id="_faA3YBCvEeOTVqJPk38YKg" source="duplicatedProfile"/> + <appliedProfile href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_8HJwgPLPEeKxdJFsMzlLJA"/> + </profileApplication> + </uml:Package> + <ExternalResourcesTestProfile:ClassStereotype xmi:id="_bXZ9kBCvEeOTVqJPk38YKg" base_Class="_WzY_0BCvEeOTVqJPk38YKg"/> +</xmi:XMI> diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.notation b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.notation index aa1c4f793d3..c6eb655ceb9 100644 --- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.notation +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.notation @@ -92,6 +92,117 @@ <element xmi:type="uml:Class" href="oneProfileApplied.uml#_kyl8EPXIEeKjvqrMhLLWTg"/> <layoutConstraint xmi:type="notation:Bounds" xmi:id="_k19ZIfXIEeKjvqrMhLLWTg" x="575" y="30" width="336" height="331"/> </children> + <children xmi:type="notation:Shape" xmi:id="_VTIG8BCvEeOTVqJPk38YKg" type="2007"> + <children xmi:type="notation:DecorationNode" xmi:id="_VTJ8IBCvEeOTVqJPk38YKg" type="5026"/> + <children xmi:type="notation:DecorationNode" xmi:id="_VTJ8IRCvEeOTVqJPk38YKg" type="7016"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_VTQp0BCvEeOTVqJPk38YKg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_VTQp0RCvEeOTVqJPk38YKg" key="showTitle" value="true"/> + </eAnnotations> + <children xmi:type="notation:Shape" xmi:id="_Wzu-EBCvEeOTVqJPk38YKg" type="3010"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_bXp1MBCvEeOTVqJPk38YKg" source="Stereotype_Annotation"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_bXqcQBCvEeOTVqJPk38YKg" key="StereotypeWithQualifiedNameList" value=""/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_bXqcQRCvEeOTVqJPk38YKg" key="StereotypeList" value="ExternalResourcesTestProfile::ClassStereotype"/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_bXqcQhCvEeOTVqJPk38YKg" key="Stereotype_Presentation_Kind" value="HorizontalStereo"/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_bXqcQxCvEeOTVqJPk38YKg" key="PropStereoDisplay" value=""/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_bXqcRBCvEeOTVqJPk38YKg" key="StereotypePropertyLocation" value="Compartment"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_Wzu-EhCvEeOTVqJPk38YKg" type="5014"/> + <children xmi:type="notation:BasicCompartment" xmi:id="_Wzu-ExCvEeOTVqJPk38YKg" type="7011"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_WzyBYBCvEeOTVqJPk38YKg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_WzyBYRCvEeOTVqJPk38YKg" key="showTitle" value="true"/> + </eAnnotations> + <styles xmi:type="notation:TitleStyle" xmi:id="_WzvlIBCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_WzvlIRCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_WzvlIhCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WzvlIxCvEeOTVqJPk38YKg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_WzvlJBCvEeOTVqJPk38YKg" type="7012"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_WzyocBCvEeOTVqJPk38YKg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_WzyocRCvEeOTVqJPk38YKg" key="showTitle" value="true"/> + </eAnnotations> + <styles xmi:type="notation:TitleStyle" xmi:id="_WzvlJRCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_WzvlJhCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_WzvlJxCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WzvlKBCvEeOTVqJPk38YKg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_WzvlKRCvEeOTVqJPk38YKg" type="7013"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_WzzPgBCvEeOTVqJPk38YKg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Wzz2kBCvEeOTVqJPk38YKg" key="showTitle" value="true"/> + </eAnnotations> + <styles xmi:type="notation:TitleStyle" xmi:id="_WzvlKhCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_WzvlKxCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_WzvlLBCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_WzvlLRCvEeOTVqJPk38YKg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_W0JNwBCvEeOTVqJPk38YKg" visible="false" type="compartment_shape_display"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_W0JNwxCvEeOTVqJPk38YKg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_W0JNxBCvEeOTVqJPk38YKg" key="mutable" value="true"/> + </eAnnotations> + <styles xmi:type="notation:TitleStyle" xmi:id="_W0JNwRCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_W0JNwhCvEeOTVqJPk38YKg"/> + </children> + <element xmi:type="uml:Class" href="Package1.uml#_WzY_0BCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Wzu-ERCvEeOTVqJPk38YKg" x="85" y="17" width="186" height="136"/> + </children> + <styles xmi:type="notation:TitleStyle" xmi:id="_VTJ8IhCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTJ8IxCvEeOTVqJPk38YKg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_VTlZ8BCvEeOTVqJPk38YKg" visible="false" type="compartment_shape_display"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_VTlZ8xCvEeOTVqJPk38YKg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_VTlZ9BCvEeOTVqJPk38YKg" key="mutable" value="true"/> + </eAnnotations> + <styles xmi:type="notation:TitleStyle" xmi:id="_VTlZ8RCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTlZ8hCvEeOTVqJPk38YKg"/> + </children> + <element xmi:type="uml:Package" href="Package1.uml#_VSiREBCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTIG8RCvEeOTVqJPk38YKg" x="210" y="420" width="511" height="201"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_YpSKcBCvEeOTVqJPk38YKg" type="2008"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_cE7K4BCvEeOTVqJPk38YKg" source="Stereotype_Annotation"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_cE7K4RCvEeOTVqJPk38YKg" key="StereotypeWithQualifiedNameList" value=""/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_cE7x8BCvEeOTVqJPk38YKg" key="StereotypeList" value="ExternalResourcesTestProfile::ClassStereotype"/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_cE7x8RCvEeOTVqJPk38YKg" key="Stereotype_Presentation_Kind" value="HorizontalStereo"/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_cE7x8hCvEeOTVqJPk38YKg" key="PropStereoDisplay" value=""/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_cE7x8xCvEeOTVqJPk38YKg" key="StereotypePropertyLocation" value="Compartment"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_YpSxgBCvEeOTVqJPk38YKg" type="5029"/> + <children xmi:type="notation:BasicCompartment" xmi:id="_YpSxgRCvEeOTVqJPk38YKg" type="7017"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_YpTYkBCvEeOTVqJPk38YKg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_YpTYkRCvEeOTVqJPk38YKg" key="showTitle" value="true"/> + </eAnnotations> + <styles xmi:type="notation:TitleStyle" xmi:id="_YpSxghCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_YpSxgxCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_YpSxhBCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_YpSxhRCvEeOTVqJPk38YKg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_YpSxhhCvEeOTVqJPk38YKg" type="7018"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_YpTYkhCvEeOTVqJPk38YKg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_YpTYkxCvEeOTVqJPk38YKg" key="showTitle" value="true"/> + </eAnnotations> + <styles xmi:type="notation:TitleStyle" xmi:id="_YpSxhxCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_YpSxiBCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_YpSxiRCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_YpSxihCvEeOTVqJPk38YKg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_YpSxixCvEeOTVqJPk38YKg" type="7019"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_YpTYlBCvEeOTVqJPk38YKg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_YpT_oBCvEeOTVqJPk38YKg" key="showTitle" value="true"/> + </eAnnotations> + <styles xmi:type="notation:TitleStyle" xmi:id="_YpSxjBCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_YpSxjRCvEeOTVqJPk38YKg"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_YpSxjhCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_YpSxjxCvEeOTVqJPk38YKg"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_YpgM4BCvEeOTVqJPk38YKg" visible="false" type="compartment_shape_display"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_Ypgz8BCvEeOTVqJPk38YKg" source="PapyrusCSSForceValue"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Ypgz8RCvEeOTVqJPk38YKg" key="mutable" value="true"/> + </eAnnotations> + <styles xmi:type="notation:TitleStyle" xmi:id="_YpgM4RCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_YpgM4hCvEeOTVqJPk38YKg"/> + </children> + <element xmi:type="uml:Class" href="Class3.uml#_YpQ8UBCvEeOTVqJPk38YKg"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_YpSKcRCvEeOTVqJPk38YKg" x="785" y="420" width="181" height="196"/> + </children> <styles xmi:type="notation:DiagramStyle" xmi:id="_LLO-QfVCEeKaxaN6QZe_iw"/> <element xmi:type="uml:Model" href="oneProfileApplied.uml#_LK5nEPVCEeKaxaN6QZe_iw"/> </notation:Diagram> diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.uml b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.uml index e74b03c50b9..17a1c6fc252 100644 --- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.uml +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.uml @@ -1,28 +1,26 @@ <?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:ExternalResourcesTestProfile="http:///schemas/ExternalResourcesTestProfile/_aPlNkPLZEeKxdJFsMzlLJA/1" xmlns:SubProfile="http://ExternalResourcesTestProfile/schemas/SubProfile/_aPpfAPLZEeKxdJFsMzlLJA/1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http:///schemas/ExternalResourcesTestProfile/_aPlNkPLZEeKxdJFsMzlLJA/1 pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_aPl0oPLZEeKxdJFsMzlLJA http://ExternalResourcesTestProfile/schemas/SubProfile/_aPpfAPLZEeKxdJFsMzlLJA/1 pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_aPpfAfLZEeKxdJFsMzlLJA"> <uml:Model xmi:id="_LK5nEPVCEeKaxaN6QZe_iw" name="Model"> - <packageImport xmi:id="_LK5nEfVCEeKaxaN6QZe_iw"> - <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> - </packageImport> - <packagedElement xmi:type="uml:Class" xmi:id="_6e1LAPVEEeKWG-T5DC87Xw" name="Class1"/> - <packagedElement xmi:type="uml:Class" xmi:id="_kyl8EPXIEeKjvqrMhLLWTg" name="Class2"/> - <profileApplication xmi:id="_5JIjYPVEEeKWG-T5DC87Xw"> - <eAnnotations xmi:id="_5JehoPVEEeKWG-T5DC87Xw" source="http://www.eclipse.org/uml2/2.0.0/UML"> - <references xmi:type="ecore:EPackage" href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_aPl0oPLZEeKxdJFsMzlLJA"/> - </eAnnotations> - <appliedProfile href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_yW4wUPLPEeKxdJFsMzlLJA"/> - </profileApplication> - <profileApplication xmi:id="_5JmdcPVEEeKWG-T5DC87Xw"> - <eAnnotations xmi:id="_5J1G8PVEEeKWG-T5DC87Xw" source="http://www.eclipse.org/uml2/2.0.0/UML"> - <references xmi:type="ecore:EPackage" href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_aPpfAfLZEeKxdJFsMzlLJA"/> - </eAnnotations> - <appliedProfile href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_8HJwgPLPEeKxdJFsMzlLJA"/> - </profileApplication> -</uml:Model> -<ExternalResourcesTestProfile:ClassStereotype xmi:id="_QmeWQPuVEeKClrtZiAiidQ"> - <base_Class xmi:type="uml:Class" href="#_6e1LAPVEEeKWG-T5DC87Xw"/> -</ExternalResourcesTestProfile:ClassStereotype> -<SubProfile:ElementStereotype xmi:id="_XPG3IPuVEeKClrtZiAiidQ"> - <base_Element xmi:type="uml:Class" href="#_kyl8EPXIEeKjvqrMhLLWTg"/> -</SubProfile:ElementStereotype> -</xmi:XMI>
\ No newline at end of file + <packageImport xmi:type="uml:PackageImport" xmi:id="_LK5nEfVCEeKaxaN6QZe_iw"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Class" xmi:id="_6e1LAPVEEeKWG-T5DC87Xw" name="Class1"/> + <packagedElement xmi:type="uml:Class" xmi:id="_kyl8EPXIEeKjvqrMhLLWTg" name="Class2"/> + <packagedElement xmi:type="uml:Package" href="Package1.uml#_VSiREBCvEeOTVqJPk38YKg"/> + <packagedElement xmi:type="uml:Class" href="Class3.uml#_YpQ8UBCvEeOTVqJPk38YKg"/> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_5JIjYPVEEeKWG-T5DC87Xw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_5JehoPVEEeKWG-T5DC87Xw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_aPl0oPLZEeKxdJFsMzlLJA"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_yW4wUPLPEeKxdJFsMzlLJA"/> + </profileApplication> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_5JmdcPVEEeKWG-T5DC87Xw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_5J1G8PVEEeKWG-T5DC87Xw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_aPpfAfLZEeKxdJFsMzlLJA"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://EXTERNAL_RESOURCE_TEST_PATHMAP/ExternalResourcesTestProfile.profile.uml#_8HJwgPLPEeKxdJFsMzlLJA"/> + </profileApplication> + </uml:Model> + <ExternalResourcesTestProfile:ClassStereotype xmi:id="_QmeWQPuVEeKClrtZiAiidQ" base_Class="_6e1LAPVEEeKWG-T5DC87Xw"/> + <SubProfile:ElementStereotype xmi:id="_XPG3IPuVEeKClrtZiAiidQ" base_Element="_kyl8EPXIEeKjvqrMhLLWTg"/> +</xmi:XMI> diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractChangeStrategyTests.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractChangeStrategyTests.java index 3df5874177a..ca7d221a346 100644 --- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractChangeStrategyTests.java +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractChangeStrategyTests.java @@ -47,29 +47,68 @@ import org.junit.Test; public abstract class AbstractChangeStrategyTests extends AbstractExternalResourcesTest { @Test + public void testSaveAs() { + UmlModel umlModel = null; + // get The model. try to see applied stereotypes + try { + umlModel = (UmlModel)modelSet.getModelChecked(UmlModel.MODEL_ID); + } catch (NotFoundException e) { + fail(e.getMessage()); + } + Model rootModel = (Model)umlModel.getResource().getContents().get(0); + Assert.assertNotNull("Root model impossible to find", rootModel); + + URI resultURI = getResultURI(); + try { + getModelSet(getURI()).saveAs(resultURI); + } catch (IOException e) { + fail(e.getMessage()); + } + checkModel(rootModel); + // check current model still have right stereotypes/values + tearDownRegistry(); + // try to load and read profiles in the result file + ModelSet resultModelSet = getModelSet(resultURI); + Assert.assertNotNull("TMP Model set should not be null", resultModelSet); + UmlModel resultUmlModel = null; + // get The result model. try to see applied stereotypes + try { + resultUmlModel = (UmlModel)resultModelSet.getModelChecked(UmlModel.MODEL_ID); + } catch (NotFoundException e) { + fail(e.getMessage()); + } + Assert.assertNotNull(resultUmlModel); + Resource resultResource = resultUmlModel.getResource(); + Assert.assertNotNull(resultResource); + Model resultRootModel = (Model)resultResource.getContents().get(0); + Assert.assertNotNull(resultRootModel); + checkModel(resultRootModel); + } + + @Test public void changeToOneFileOnlyStrategy() { changeToStrategy(StrategyRegistry.getInstance().getStrategy(OneResourceOnlyStrategy.ID)); // additionnal checks : strategy, location of the stereotype application, etc. - ModelSet tmpModelSet = getModelSet(getTempURI()); - UmlModel tmpUmlModel = null; - // get The tmp model. try to see applied stereotypes + ModelSet resultModelSet = getModelSet(getResultURI()); + UmlModel resultUmlModel = null; + // get The result model. try to see applied stereotypes try { - tmpUmlModel = (UmlModel)tmpModelSet.getModelChecked(UmlModel.MODEL_ID); + resultUmlModel = (UmlModel)resultModelSet.getModelChecked(UmlModel.MODEL_ID); } catch (NotFoundException e) { fail(e.getMessage()); } - Resource tmpResource = tmpUmlModel.getResource(); - Model tmpRootModel = (Model)tmpResource.getContents().get(0); + Resource resultResource = resultUmlModel.getResource(); + Model resultRootModel = (Model)resultResource.getContents().get(0); // test some stereotype applications // Model::class1 should have <<classStereotype>> Applied (verify root level stererotype) - Class class1_ = (Class)tmpRootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false); + Class class1_ = (Class)resultRootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false); EObject application = class1_.getStereotypeApplication(class1_.getAppliedStereotype(CLASS_STEREOTYPE_QN)); Assert.assertNotNull("No stereotype applied on "+ MODEL_CLASS1, application); Assert.assertNotNull(application.eResource()); URI stereotypeApplicationURI = application.eResource().getURI(); - Assert.assertEquals("Stereotype is not in expected resource", getTempURI().trimFileExtension().appendFileExtension(OneResourceOnlyStrategy.PROFILE_DEFAULT_EXTENSION), stereotypeApplicationURI); + Assert.assertEquals("Stereotype is not in expected resource", getResultURI().trimFileExtension().appendFileExtension(OneResourceOnlyStrategy.PROFILE_DEFAULT_EXTENSION), stereotypeApplicationURI); // check undo, check redo... } @@ -78,25 +117,25 @@ public abstract class AbstractChangeStrategyTests extends AbstractExternalResour changeToStrategy(StrategyRegistry.getInstance().getStrategy(ResourcePerProfileStrategy.ID)); // additionnal checks : strategy, location of the stereotype application, etc. - ModelSet tmpModelSet = getModelSet(getTempURI()); - UmlModel tmpUmlModel = null; - // get The tmp model. try to see applied stereotypes + ModelSet resultModelSet = getModelSet(getResultURI()); + UmlModel resultUmlModel = null; + // get The result model. try to see applied stereotypes try { - tmpUmlModel = (UmlModel)tmpModelSet.getModelChecked(UmlModel.MODEL_ID); + resultUmlModel = (UmlModel)resultModelSet.getModelChecked(UmlModel.MODEL_ID); } catch (NotFoundException e) { fail(e.getMessage()); } - Resource tmpResource = tmpUmlModel.getResource(); - Model tmpRootModel = (Model)tmpResource.getContents().get(0); + Resource resultResource = resultUmlModel.getResource(); + Model resultRootModel = (Model)resultResource.getContents().get(0); // test some stereotype applications // Model::class1 should have <<classStereotype>> Applied (verify root level stererotype) - Class class1_ = (Class)tmpRootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false); + Class class1_ = (Class)resultRootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false); EObject application = class1_.getStereotypeApplication(class1_.getAppliedStereotype(CLASS_STEREOTYPE_QN)); Assert.assertNotNull("No stereotype applied on "+ MODEL_CLASS1, application); Assert.assertNotNull(application.eResource()); URI stereotypeApplicationURI = application.eResource().getURI(); - Assert.assertEquals("Stereotype is not in expected resource", getTempURI().trimFileExtension().appendFileExtension(EXTERNAL_RESOURCES_TEST_PROFILE+"Profile"), stereotypeApplicationURI); + Assert.assertEquals("Stereotype is not in expected resource", getResultURI().trimFileExtension().appendFileExtension(EXTERNAL_RESOURCES_TEST_PROFILE+"Profile"), stereotypeApplicationURI); } @Test @@ -104,25 +143,25 @@ public abstract class AbstractChangeStrategyTests extends AbstractExternalResour changeToStrategy(StrategyRegistry.getInstance().getStrategy(StandardApplicationLocationStrategy.ID)); // additionnal checks : strategy, location of the stereotype application, etc. - ModelSet tmpModelSet = getModelSet(getTempURI()); - UmlModel tmpUmlModel = null; - // get The tmp model. try to see applied stereotypes + ModelSet resultModelSet = getModelSet(getResultURI()); + UmlModel resultUmlModel = null; + // get The result model. try to see applied stereotypes try { - tmpUmlModel = (UmlModel)tmpModelSet.getModelChecked(UmlModel.MODEL_ID); + resultUmlModel = (UmlModel)resultModelSet.getModelChecked(UmlModel.MODEL_ID); } catch (NotFoundException e) { fail(e.getMessage()); } - Resource tmpResource = tmpUmlModel.getResource(); - Model tmpRootModel = (Model)tmpResource.getContents().get(0); + Resource resultResource = resultUmlModel.getResource(); + Model resultRootModel = (Model)resultResource.getContents().get(0); // test some stereotype applications // Model::class1 should have <<classStereotype>> Applied (verify root level stererotype) - Class class1_ = (Class)tmpRootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false); + Class class1_ = (Class)resultRootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false); EObject application = class1_.getStereotypeApplication(class1_.getAppliedStereotype(CLASS_STEREOTYPE_QN)); Assert.assertNotNull("No stereotype applied on "+ MODEL_CLASS1, application); Assert.assertNotNull(application.eResource()); URI stereotypeApplicationURI = application.eResource().getURI(); - Assert.assertEquals("Stereotype is not in expected resource", tmpUmlModel.getResourceURI(), stereotypeApplicationURI); + Assert.assertEquals("Stereotype is not in expected resource", resultUmlModel.getResourceURI(), stereotypeApplicationURI); // check undo, check redo... } @@ -151,34 +190,38 @@ public abstract class AbstractChangeStrategyTests extends AbstractExternalResour fail(status.getMessage()); } - URI tmpURI = getTempURI(); + URI resultURI = getResultURI(); try { - getModelSet(getURI()).saveAs(tmpURI); + getModelSet(getURI()).saveAs(resultURI); } catch (IOException e) { fail(e.getMessage()); } checkModel(rootModel); // check current model still have right stereotypes/values tearDownRegistry(); - // try to load and read profiles in the tmp file - ModelSet tmpModelSet = getModelSet(tmpURI); - Assert.assertNotNull("TMP Model set should not be null", tmpModelSet); - UmlModel tmpUmlModel = null; - // get The tmp model. try to see applied stereotypes + // try to load and read profiles in the result file + ModelSet resultModelSet = getModelSet(resultURI); + Assert.assertNotNull("TMP Model set should not be null", resultModelSet); + UmlModel resultUmlModel = null; + // get The result model. try to see applied stereotypes try { - tmpUmlModel = (UmlModel)tmpModelSet.getModelChecked(UmlModel.MODEL_ID); + resultUmlModel = (UmlModel)resultModelSet.getModelChecked(UmlModel.MODEL_ID); } catch (NotFoundException e) { fail(e.getMessage()); } - Assert.assertNotNull(tmpUmlModel); - Resource tmpResource = tmpUmlModel.getResource(); - Assert.assertNotNull(tmpResource); - Model tmpRootModel = (Model)tmpResource.getContents().get(0); - Assert.assertNotNull(tmpRootModel); - checkModel(tmpRootModel); + Assert.assertNotNull(resultUmlModel); + Resource resultResource = resultUmlModel.getResource(); + Assert.assertNotNull(resultResource); + Model resultRootModel = (Model)resultResource.getContents().get(0); + Assert.assertNotNull(resultRootModel); + checkModel(resultRootModel); + } + + public URI getResultFolderURI() { + return URI.createPlatformResourceURI(getTestProjectName()+"/result", true); } - public URI getTempURI() { - return URI.createPlatformResourceURI(getTestProjectName()+"/tmp.di", true); + public URI getResultURI() { + return getResultFolderURI().appendSegment("result.di"); } } diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractExternalResourcesTest.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractExternalResourcesTest.java index 843a37dacad..7bd253c5200 100644 --- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractExternalResourcesTest.java +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractExternalResourcesTest.java @@ -21,6 +21,7 @@ import java.util.List; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -32,6 +33,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.workspace.EMFCommandOperation; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; import org.eclipse.papyrus.infra.core.resource.ModelMultiException; @@ -45,6 +47,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceMultiException; import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; +import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceInitializerService; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel; import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; @@ -53,6 +56,7 @@ import org.eclipse.papyrus.uml.profile.externalresource.helper.ExternalResourceP import org.eclipse.papyrus.uml.profile.externalresource.helper.OneResourceOnlyStrategy; import org.eclipse.papyrus.uml.profile.externalresource.helper.PapyrusStereotypeApplicationHelper; import org.eclipse.papyrus.uml.profile.externalresource.helper.StrategyRegistry; +import org.eclipse.papyrus.uml.tools.commands.ApplyStereotypeCommand; import org.eclipse.papyrus.uml.tools.model.UmlModel; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorReference; @@ -62,7 +66,9 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.uml2.uml.Class; import org.eclipse.uml2.uml.Model; import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Stereotype; import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.Package; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -100,35 +106,63 @@ public abstract class AbstractExternalResourcesTest { public static final String MODEL_CLASS2 = "Class2"; + public static final String MODEL_CLASS3 = "Class3"; + + public static final String MODEL_PACKAGE1 = "Package1"; + + public static final String MODEL_PACKAGE1_CLASS1 = "Package1_Class1"; + public static final String ELEMENT_STEREOTYPE_NAME = "ElementStereotype"; public static final String ELEMENT_STEREOTYPE_QN = EXTERNAL_RESOURCES_TEST_PROFILE_SUB_PROFILE + NamedElement.SEPARATOR + ELEMENT_STEREOTYPE_NAME; - + public static final String ONE_PROFILE_MODEL_FILENAME = "oneProfileApplied"; - public final static String DI_FILE = ONE_PROFILE_MODEL_FILENAME+"."+DiModel.DI_FILE_EXTENSION; - - public final static String UML_FILE = ONE_PROFILE_MODEL_FILENAME+"."+UmlModel.UML_FILE_EXTENSION; - - public final static String NOTATION_FILE = ONE_PROFILE_MODEL_FILENAME+"."+NotationModel.NOTATION_FILE_EXTENSION; - - public final static String ALL_PROFILES_FILE = ONE_PROFILE_MODEL_FILENAME+"."+OneResourceOnlyStrategy.PROFILE_DEFAULT_EXTENSION; - - public final static String EXTERNAL_RESOURCES_TEST_PROFILE_EXTENSION_FILE = ONE_PROFILE_MODEL_FILENAME+"."+EXTERNAL_RESOURCES_TEST_PROFILE+"Profile"; + public final static String DI_FILE = ONE_PROFILE_MODEL_FILENAME + "." + DiModel.DI_FILE_EXTENSION; + + public final static String UML_FILE = ONE_PROFILE_MODEL_FILENAME + "." + UmlModel.UML_FILE_EXTENSION; + + public final static String NOTATION_FILE = ONE_PROFILE_MODEL_FILENAME + "." + NotationModel.NOTATION_FILE_EXTENSION; + + public static final String PACKAGE1_MODEL_FILENAME = "Package1"; + + public final static String PACKAGE1_MODEL_DI_FILE = PACKAGE1_MODEL_FILENAME + "." + DiModel.DI_FILE_EXTENSION; + + public final static String PACKAGE1_MODEL_UML_FILE = PACKAGE1_MODEL_FILENAME + "." + UmlModel.UML_FILE_EXTENSION; + + public final static String PACKAGE1_MODEL_NOTATION_FILE = PACKAGE1_MODEL_FILENAME + "." + NotationModel.NOTATION_FILE_EXTENSION; + + public static final String CLASS3_MODEL_FILENAME = "Class3"; + + public final static String CLASS3_MODEL_DI_FILE = CLASS3_MODEL_FILENAME + "." + DiModel.DI_FILE_EXTENSION; + + public final static String CLASS3_MODEL_UML_FILE = CLASS3_MODEL_FILENAME + "." + UmlModel.UML_FILE_EXTENSION; + + public final static String CLASS3_MODEL_NOTATION_FILE = CLASS3_MODEL_FILENAME + "." + NotationModel.NOTATION_FILE_EXTENSION; + + public final static String ALL_PROFILES_FILE = ONE_PROFILE_MODEL_FILENAME + "." + OneResourceOnlyStrategy.PROFILE_DEFAULT_EXTENSION; + + public final static String EXTERNAL_RESOURCES_TEST_PROFILE_EXTENSION_FILE = ONE_PROFILE_MODEL_FILENAME + "." + EXTERNAL_RESOURCES_TEST_PROFILE + "Profile"; + public final static String PACKAGE1_EXTERNAL_RESOURCES_TEST_PROFILE_EXTENSION_FILE = PACKAGE1_MODEL_FILENAME + "." + EXTERNAL_RESOURCES_TEST_PROFILE + "Profile"; + public static final String STANDARD_STRATEGY_FOLDER = "StandardResource"; - + public static final String ONE_RESOURCE_FOR_ALL_PROFILES_FOLDER = "OneResourceForAllProfiles"; - + public static final String ONE_RESOURCE_PER_PROFILE_FOLDER = "OneResourcePerProfile"; - - + @Before public void initializeRegistry() { ResourcesPlugin.getWorkspace().getDescription().setAutoBuilding(false); IProject project = null; try { project = ProjectUtils.createProject(getTestProjectName()); + IFolder folder = project.getFolder("result"); + if(folder.exists()) { + folder.delete(true, new NullProgressMonitor()); + } + folder.create(true, true, new NullProgressMonitor()); } catch (CoreException e1) { fail(e1.getMessage()); } @@ -137,14 +171,13 @@ public abstract class AbstractExternalResourcesTest { // retrieve the content of the source folder, and copy it into the destination folder for(String fileName : getModelFileNames()) { try { - PapyrusProjectUtils.copyIFile("resources/"+getTestProjectName()+"/"+fileName, Platform.getBundle(Activator.PLUGIN_ID), project, fileName); + PapyrusProjectUtils.copyIFile("resources/" + getTestProjectName() + "/" + fileName, Platform.getBundle(Activator.PLUGIN_ID), project, fileName); } catch (CoreException e) { fail(e.getMessage()); } catch (IOException e) { fail(e.getMessage()); } - } - + } servicesRegistry = getServicesRegistry(); modelSet = getModelSet(getURI()); Assert.assertNotNull("Model set should not be null", modelSet); @@ -154,11 +187,12 @@ public abstract class AbstractExternalResourcesTest { * {@inheritDoc} */ public URI getURI() { - return URI.createPlatformResourceURI(getTestProjectName()+"/"+getModelFileNames().get(0), true); + return URI.createPlatformResourceURI(getTestProjectName() + "/" + getModelFileNames().get(0), true); } - + /** * Warning: main Model.di file must be put first!!! + * * @return */ protected abstract List<String> getModelFileNames(); @@ -184,7 +218,7 @@ public abstract class AbstractExternalResourcesTest { } } } - + @Test public void testLoadModelOutsidePapyrusEditor() { UmlModel umlModel = null; @@ -199,6 +233,72 @@ public abstract class AbstractExternalResourcesTest { // test applied profiles checkModel(rootModel); } + + @Test + public void testApplyStereotypeOnClassInControlledPackage() { + UmlModel umlModel = null; + // get The model. try to see applied stereotypes + try { + umlModel = (UmlModel)getModelSet(getURI()).getModelChecked(UmlModel.MODEL_ID); + } catch (NotFoundException e) { + fail(e.getMessage()); + } + Model rootModel = (Model)umlModel.getResource().getContents().get(0); + Assert.assertNotNull("Root model impossible to find", rootModel); + // test applied profiles + + + // apply stereotype on Model::Class3. Do not check eveythong, as loading tests should already have fixed that + Class class3_ = (Class)rootModel.getPackagedElement(MODEL_CLASS3, true, UMLPackage.eINSTANCE.getClass_(), false); + if(class3_ ==null) { + return; // should send an ignore or a warning + } + + // try to apply a stereotype and checks where it is located + TransactionalEditingDomain editingDomain = null; + try { + editingDomain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(class3_); + } catch (ServiceException e) { + fail(e.getMessage()); + } + Stereotype stereotype = class3_.getApplicableStereotype(CLASS_STEREOTYPE_QN); + Assert.assertNotNull("Stereotype to apply should not be null", stereotype); + ApplyStereotypeCommand command = new ApplyStereotypeCommand(class3_, stereotype, editingDomain); + Assert.assertNotNull("Command should not be null", command); + Assert.assertTrue("Command should be executable", command.canExecute()); + + // execute command + try { + OperationHistoryFactory.getOperationHistory().execute(new EMFCommandOperation(editingDomain, command), new NullProgressMonitor(), null); + } catch (ExecutionException e) { + fail(e.getMessage()); + } + + // check stereotype has been applied + EObject stereotypeApplication = class3_.getStereotypeApplication(stereotype); + Assert.assertNotNull("Stereotype "+ CLASS_STEREOTYPE_QN+" is not applied on "+MODEL_CLASS3, stereotypeApplication); + Assert.assertEquals("Stereortype is not located in good resource", getApplyStereotypeOnClassInControlledPackageResourceURI(), stereotypeApplication.eResource().getURI()); + } + + /** + * @return + */ + protected abstract URI getApplyStereotypeOnClassInControlledPackageResourceURI(); + + @Test + public void testApplyStereotypeOnControlledClass() { + UmlModel umlModel = null; + // get The model. try to see applied stereotypes + try { + umlModel = (UmlModel)modelSet.getModelChecked(UmlModel.MODEL_ID); + } catch (NotFoundException e) { + fail(e.getMessage()); + } + Model rootModel = (Model)umlModel.getResource().getContents().get(0); + Assert.assertNotNull("Root model impossible to find", rootModel); + // test applied profiles + checkModel(rootModel); + } /** * @param rootModel @@ -216,6 +316,16 @@ public abstract class AbstractExternalResourcesTest { Class class2_ = (Class)rootModel.getPackagedElement(MODEL_CLASS2, true, UMLPackage.eINSTANCE.getClass_(), false); Assert.assertNotNull(MODEL_CLASS2 + " should not be null", class2_); Assert.assertNotNull(MODEL_CLASS2 + " should have stereotype " + ELEMENT_STEREOTYPE_NAME + ", but has only: " + class2_.getAppliedStereotypes(), class2_.getAppliedStereotype(ELEMENT_STEREOTYPE_QN)); + // check controlled resources : Package1 and class3 + Class class3_ = (Class)rootModel.getPackagedElement(MODEL_CLASS3, true, UMLPackage.eINSTANCE.getClass_(), false); + Assert.assertNotNull(MODEL_CLASS3 + " should not be null", class3_); + Assert.assertNotNull(MODEL_CLASS3 + " should have stereotype " + CLASS_STEREOTYPE_NAME + ", but has only: " + class3_.getAppliedStereotypes(), class3_.getAppliedStereotype(CLASS_STEREOTYPE_QN)); + // check controlled resources : Package1 and class3 + Package package1 = (Package)rootModel.getNestedPackage(MODEL_PACKAGE1); + Assert.assertNotNull(MODEL_PACKAGE1 + " should not be null", package1); + Class package1_Class1 = (Class)package1.getPackagedElement(MODEL_PACKAGE1_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false); + Assert.assertNotNull(MODEL_PACKAGE1_CLASS1 + " should not be null", package1_Class1); + Assert.assertNotNull(MODEL_PACKAGE1_CLASS1 + " should have stereotype " + CLASS_STEREOTYPE_NAME + ", but has only: " + package1_Class1.getAppliedStereotypes(), package1_Class1.getAppliedStereotype(CLASS_STEREOTYPE_QN)); } public ModelSet createModelSet(URI uri) throws ModelMultiException { @@ -294,7 +404,6 @@ public abstract class AbstractExternalResourcesTest { TransactionalEditingDomain domain = TransactionalEditingDomainManager.createTransactionalEditingDomain(modelSet); getServicesRegistry().add(TransactionalEditingDomain.class, 10, domain); getServicesRegistry().add(EditingDomain.class, 10, domain); - } catch (ModelMultiException modelMultiException) { Activator.log.error(modelMultiException); } catch (ServiceMultiException e1) { @@ -306,6 +415,4 @@ public abstract class AbstractExternalResourcesTest { } return modelSet; } - - } diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AllTests.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AllTests.java index 15a2fa69960..60160a0ead2 100644 --- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AllTests.java +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AllTests.java @@ -22,9 +22,9 @@ import org.junit.runners.Suite.SuiteClasses; */ @RunWith(Suite.class) @SuiteClasses({ + org.eclipse.papyrus.uml.profile.externalresource.tests.standardstrategy.StandardStrategyTests.class, org.eclipse.papyrus.uml.profile.externalresource.tests.resourceperprofile.ResourcePerProfileTests.class, org.eclipse.papyrus.uml.profile.externalresource.tests.oneresourceforallprofiles.OneResourceForAllProfilesTests.class, - org.eclipse.papyrus.uml.profile.externalresource.tests.standardstrategy.StandardStrategyTests.class, }) public class AllTests { } diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/oneresourceforallprofiles/OneResourceForAllProfilesTests.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/oneresourceforallprofiles/OneResourceForAllProfilesTests.java index c05833ee491..8130d2dae4a 100644 --- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/oneresourceforallprofiles/OneResourceForAllProfilesTests.java +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/oneresourceforallprofiles/OneResourceForAllProfilesTests.java @@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.profile.externalresource.tests.oneresourceforall import java.util.Arrays; import java.util.List; +import org.eclipse.emf.common.util.URI; import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractChangeStrategyTests; import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractExternalResourcesTest; @@ -38,68 +39,14 @@ public class OneResourceForAllProfilesTests extends AbstractChangeStrategyTests protected List<String> getModelFileNames() { return Arrays.asList(DI_FILE, NOTATION_FILE, UML_FILE, ALL_PROFILES_FILE); } + + /** + * {@inheritDoc} + */ + @Override + protected URI getApplyStereotypeOnClassInControlledPackageResourceURI() { + return getResultFolderURI().appendSegment(PACKAGE1_EXTERNAL_RESOURCES_TEST_PROFILE_EXTENSION_FILE); + } -// @Test -// public void moveStereotypeApplicationOutsidePapyrusEditor() { -// UmlModel umlModel = null; -// // get The model. try to see applied stereotypes -// try { -// umlModel = (UmlModel)modelSet.getModelChecked(UmlModel.MODEL_ID); -// } catch (NotFoundException e) { -// fail(e.getMessage()); -// } -// Model rootModel = (Model)umlModel.getResource().getContents().get(0); -// Assert.assertNotNull("Root model impossible to find", rootModel); -// -// ICommand command = ExternalResourceProfileUtils.createUpdateStereotypeApplicationsLocationCommand(rootModel, PapyrusStereotypeApplicationHelper.getCurrentLocationStrategy(rootModel), StrategyRegistry.getInstance().getStrategy(OneResourceOnlyStrategy.ID)); -// Assert.assertNotNull("Impossible to create update command", command); -// Assert.assertTrue("Command should be executable", command.canExecute()); -// IStatus status = null; -// try { -// status = OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null); -// } catch (ExecutionException e1) { -// fail(e1.getMessage()); -// } -// -// if(!status.isOK()) { -// fail(status.getMessage()); -// } -// -// URI tmpURI = URI.createPlatformResourceURI(getTestProjectName()+"/tmp.di", true); -// try { -// getModelSet(getURI()).saveAs(tmpURI); -// } catch (IOException e) { -// fail(e.getMessage()); -// } -// checkModel(rootModel); -// // check current model still have right stereotypes/values -// tearDownRegistry(); -// // try to load and read profiles in the tmp file -// ModelSet tmpModelSet = getModelSet(tmpURI); -// Assert.assertNotNull("TMP Model set should not be null", tmpModelSet); -// UmlModel tmpUmlModel = null; -// // get The tmp model. try to see applied stereotypes -// try { -// tmpUmlModel = (UmlModel)tmpModelSet.getModelChecked(UmlModel.MODEL_ID); -// } catch (NotFoundException e) { -// fail(e.getMessage()); -// } -// Assert.assertNotNull(tmpUmlModel); -// Resource tmpResource = tmpUmlModel.getResource(); -// Assert.assertNotNull(tmpResource); -// Model tmpRootModel = (Model)tmpResource.getContents().get(0); -// Assert.assertNotNull(tmpRootModel); -// checkModel(tmpRootModel); -// // additionnal checks : strategy, location of the stereotype application, etc. -// // test some stereotype applications -// // Model::class1 should have <<classStereotype>> Applied (verify root level stererotype) -// Class class1_ = (Class)tmpRootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false); -// EObject application = class1_.getStereotypeApplication(class1_.getAppliedStereotype(CLASS_STEREOTYPE_QN)); -// Assert.assertNotNull("No stereotype applied on "+ MODEL_CLASS1, application); -// Assert.assertNotNull(application.eResource()); -// URI stereotypeApplicationURI = application.eResource().getURI(); -// Assert.assertEquals("Stereotype is not in expected resource", tmpURI.trimFileExtension().appendFileExtension(OneResourceOnlyStrategy.PROFILE_DEFAULT_EXTENSION), stereotypeApplicationURI); -// // check undo, check redo... -// } } diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/resourceperprofile/ResourcePerProfileTests.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/resourceperprofile/ResourcePerProfileTests.java index fe7d1c0a3a0..be5d88104e4 100644 --- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/resourceperprofile/ResourcePerProfileTests.java +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/resourceperprofile/ResourcePerProfileTests.java @@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.profile.externalresource.tests.resourceperprofil import java.util.Arrays; import java.util.List; +import org.eclipse.emf.common.util.URI; import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractChangeStrategyTests; /** @@ -37,6 +38,14 @@ public class ResourcePerProfileTests extends AbstractChangeStrategyTests { protected List<String> getModelFileNames() { return Arrays.asList(DI_FILE, NOTATION_FILE, UML_FILE, EXTERNAL_RESOURCES_TEST_PROFILE_EXTENSION_FILE); } + + /** + * {@inheritDoc} + */ + @Override + protected URI getApplyStereotypeOnClassInControlledPackageResourceURI() { + return getResultFolderURI().appendSegment(EXTERNAL_RESOURCES_TEST_PROFILE_EXTENSION_FILE); + } } diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/standardstrategy/StandardStrategyTests.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/standardstrategy/StandardStrategyTests.java index 3062dec5267..87041459109 100644 --- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/standardstrategy/StandardStrategyTests.java +++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/standardstrategy/StandardStrategyTests.java @@ -15,8 +15,8 @@ package org.eclipse.papyrus.uml.profile.externalresource.tests.standardstrategy; import java.util.Arrays; import java.util.List; +import org.eclipse.emf.common.util.URI; import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractChangeStrategyTests; -import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractExternalResourcesTest; /** * Test class for load/unload @@ -24,7 +24,9 @@ import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractExternalRe public class StandardStrategyTests extends AbstractChangeStrategyTests { - public static final List<String> FILE_NAMES = Arrays.asList(DI_FILE, UML_FILE, NOTATION_FILE); + public static final List<String> FILE_NAMES = Arrays.asList(DI_FILE, UML_FILE, NOTATION_FILE, + /* Class3.di */ CLASS3_MODEL_DI_FILE, CLASS3_MODEL_NOTATION_FILE, CLASS3_MODEL_UML_FILE, + /* Package1_Class1.di */PACKAGE1_MODEL_DI_FILE, PACKAGE1_MODEL_NOTATION_FILE, PACKAGE1_MODEL_UML_FILE); /** * {@inheritDoc} @@ -41,69 +43,13 @@ public class StandardStrategyTests extends AbstractChangeStrategyTests { protected List<String> getModelFileNames() { return FILE_NAMES; } - -// @Test -// public void moveStereotypeApplicationOutsidePapyrusEditor() { -// UmlModel umlModel = null; -// // get The model. try to see applied stereotypes -// try { -// umlModel = (UmlModel)modelSet.getModelChecked(UmlModel.MODEL_ID); -// } catch (NotFoundException e) { -// fail(e.getMessage()); -// } -// Model rootModel = (Model)umlModel.getResource().getContents().get(0); -// Assert.assertNotNull("Root model impossible to find", rootModel); -// -// ICommand command = ExternalResourceProfileUtils.createUpdateStereotypeApplicationsLocationCommand(rootModel, PapyrusStereotypeApplicationHelper.getCurrentLocationStrategy(rootModel), StrategyRegistry.getInstance().getStrategy(OneResourceOnlyStrategy.ID)); -// Assert.assertNotNull("Impossible to create update command", command); -// Assert.assertTrue("Command should be executable", command.canExecute()); -// IStatus status = null; -// try { -// status = OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null); -// } catch (ExecutionException e1) { -// fail(e1.getMessage()); -// } -// -// if(!status.isOK()) { -// fail(status.getMessage()); -// } -// -// URI tmpURI = URI.createPlatformResourceURI(getTestProjectName()+"/tmp.di", true); -// try { -// getModelSet(getURI()).saveAs(tmpURI); -// } catch (IOException e) { -// fail(e.getMessage()); -// } -// checkModel(rootModel); -// // check current model still have right stereotypes/values -// tearDownRegistry(); -// // try to load and read profiles in the tmp file -// ModelSet tmpModelSet = getModelSet(tmpURI); -// Assert.assertNotNull("TMP Model set should not be null", tmpModelSet); -// UmlModel tmpUmlModel = null; -// // get The tmp model. try to see applied stereotypes -// try { -// tmpUmlModel = (UmlModel)tmpModelSet.getModelChecked(UmlModel.MODEL_ID); -// } catch (NotFoundException e) { -// fail(e.getMessage()); -// } -// Assert.assertNotNull(tmpUmlModel); -// Resource tmpResource = tmpUmlModel.getResource(); -// Assert.assertNotNull(tmpResource); -// Model tmpRootModel = (Model)tmpResource.getContents().get(0); -// Assert.assertNotNull(tmpRootModel); -// checkModel(tmpRootModel); -// // additionnal checks : strategy, location of the stereotype application, etc. -// // test some stereotype applications -// // Model::class1 should have <<classStereotype>> Applied (verify root level stererotype) -// Class class1_ = (Class)tmpRootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false); -// EObject application = class1_.getStereotypeApplication(class1_.getAppliedStereotype(CLASS_STEREOTYPE_QN)); -// Assert.assertNotNull("No stereotype applied on "+ MODEL_CLASS1, application); -// Assert.assertNotNull(application.eResource()); -// URI stereotypeApplicationURI = application.eResource().getURI(); -// Assert.assertEquals("Stereotype is not in expected resource", tmpURI.trimFileExtension().appendFileExtension(OneResourceOnlyStrategy.PROFILE_DEFAULT_EXTENSION), stereotypeApplicationURI); -// // check undo, check redo... -// } - + /** + * {@inheritDoc} + */ + @Override + protected URI getApplyStereotypeOnClassInControlledPackageResourceURI() { + return getResultFolderURI().appendSegment(PACKAGE1_MODEL_UML_FILE); + } + } |