Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrschnekenbu2013-08-29 09:42:14 +0000
committerrschnekenbu2013-08-29 09:42:14 +0000
commit98b197aa7d3d49fdf4a6a823b941bb17e6ece722 (patch)
treeb1f35bc92180a53e71edf78eb82183ce049081ff /sandbox
parentbce50c67efdfd064fe2fc0df5852592a2373728a (diff)
downloadorg.eclipse.papyrus-98b197aa7d3d49fdf4a6a823b941bb17e6ece722.tar.gz
org.eclipse.papyrus-98b197aa7d3d49fdf4a6a823b941bb17e6ece722.tar.xz
org.eclipse.papyrus-98b197aa7d3d49fdf4a6a823b941bb17e6ece722.zip
Update the tests for the change strategy command.
Now tests the 3 strategies to 3 strategies matrix.
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/META-INF/MANIFEST.MF4
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.di17
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.notation97
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.uml28
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractChangeStrategyTests.java (renamed from sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/resourceperprofile/LoadUnloadOutsideEditorTests.java)133
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractExternalResourcesTest.java136
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AllTests.java5
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/oneresourceforallprofiles/OneResourceForAllProfilesTests.java105
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/resourceperprofile/ResourcePerProfileTests.java42
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/standardstrategy/StandardStrategyTests.java109
-rw-r--r--sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/PapyrusStereotypeApplicationHelper.java8
11 files changed, 604 insertions, 80 deletions
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/META-INF/MANIFEST.MF b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/META-INF/MANIFEST.MF
index 457c392258b..ff092ba2322 100644
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/META-INF/MANIFEST.MF
+++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/META-INF/MANIFEST.MF
@@ -18,7 +18,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.pde;bundle-version="3.8.100",
org.eclipse.pde.ui;bundle-version="3.8.0",
org.eclipse.papyrus.uml.profile.externalresource;bundle-version="0.10.1",
- org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.7.0"
+ org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.7.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.uml.profile.externalresource.tests,
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.di b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.di
new file mode 100644
index 00000000000..94f0ac19f7f
--- /dev/null
+++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.di
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <availablePage>
+ <emfPageIdentifier href="oneProfileApplied.notation#_LLO-QPVCEeKaxaN6QZe_iw"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="oneProfileApplied.notation#_LLO-QPVCEeKaxaN6QZe_iw"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
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
new file mode 100644
index 00000000000..aa1c4f793d3
--- /dev/null
+++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.notation
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_LLO-QPVCEeKaxaN6QZe_iw" type="PapyrusUMLClassDiagram" name="Main" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_6g19MPVEEeKWG-T5DC87Xw" type="2008">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_-bIBcPVEEeKWG-T5DC87Xw" source="Stereotype_Annotation">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QmngMPuVEeKClrtZiAiidQ" key="StereotypeWithQualifiedNameList" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QmngMfuVEeKClrtZiAiidQ" key="StereotypeList" value="ExternalResourcesTestProfile::ClassStereotype"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QmngMvuVEeKClrtZiAiidQ" key="Stereotype_Presentation_Kind" value="HorizontalStereo"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QmngM_uVEeKClrtZiAiidQ" key="PropStereoDisplay" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QmngNPuVEeKClrtZiAiidQ" key="StereotypePropertyLocation" value="Compartment"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_6g61sPVEEeKWG-T5DC87Xw" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_6g_HIPVEEeKWG-T5DC87Xw" type="7017">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_6hqckPVEEeKWG-T5DC87Xw" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_6hqckfVEEeKWG-T5DC87Xw" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_6g_HIfVEEeKWG-T5DC87Xw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_6g_HIvVEEeKWG-T5DC87Xw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_6g_HI_VEEeKWG-T5DC87Xw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6g_HJPVEEeKWG-T5DC87Xw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_6g_HJfVEEeKWG-T5DC87Xw" type="7018">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_6hrqsPVEEeKWG-T5DC87Xw" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_6hrqsfVEEeKWG-T5DC87Xw" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_6g_HJvVEEeKWG-T5DC87Xw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_6g_HJ_VEEeKWG-T5DC87Xw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_6g_HKPVEEeKWG-T5DC87Xw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6g_HKfVEEeKWG-T5DC87Xw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_6g_HKvVEEeKWG-T5DC87Xw" type="7019">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_6hsRwPVEEeKWG-T5DC87Xw" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_6hs40PVEEeKWG-T5DC87Xw" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_6g_HK_VEEeKWG-T5DC87Xw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_6g_HLPVEEeKWG-T5DC87Xw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_6g_HLfVEEeKWG-T5DC87Xw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6g_HLvVEEeKWG-T5DC87Xw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_6mWvUPVEEeKWG-T5DC87Xw" visible="false" type="compartment_shape_display">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_6mX9cPVEEeKWG-T5DC87Xw" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_6mX9cfVEEeKWG-T5DC87Xw" key="mutable" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_6mWvUfVEEeKWG-T5DC87Xw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6mWvUvVEEeKWG-T5DC87Xw"/>
+ </children>
+ <element xmi:type="uml:Class" href="oneProfileApplied.uml#_6e1LAPVEEeKWG-T5DC87Xw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_6g19MfVEEeKWG-T5DC87Xw" x="40" y="25" width="321" height="331"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_k19ZIPXIEeKjvqrMhLLWTg" type="2008">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_my94YPXIEeKjvqrMhLLWTg" source="Stereotype_Annotation">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_XPLvoPuVEeKClrtZiAiidQ" key="StereotypeWithQualifiedNameList" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_XPLvofuVEeKClrtZiAiidQ" key="StereotypeList" value="ExternalResourcesTestProfile::SubProfile::ElementStereotype"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_XPLvovuVEeKClrtZiAiidQ" key="Stereotype_Presentation_Kind" value="HorizontalStereo"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_XPLvo_uVEeKClrtZiAiidQ" key="PropStereoDisplay" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_XPLvpPuVEeKClrtZiAiidQ" key="StereotypePropertyLocation" value="Compartment"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_k1_OUPXIEeKjvqrMhLLWTg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_k1_1YPXIEeKjvqrMhLLWTg" type="7017">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_k2AccPXIEeKjvqrMhLLWTg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_k2AccfXIEeKjvqrMhLLWTg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_k1_1YfXIEeKjvqrMhLLWTg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_k1_1YvXIEeKjvqrMhLLWTg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_k1_1Y_XIEeKjvqrMhLLWTg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_k1_1ZPXIEeKjvqrMhLLWTg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_k1_1ZfXIEeKjvqrMhLLWTg" type="7018">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_k2AccvXIEeKjvqrMhLLWTg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_k2Acc_XIEeKjvqrMhLLWTg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_k1_1ZvXIEeKjvqrMhLLWTg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_k1_1Z_XIEeKjvqrMhLLWTg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_k1_1aPXIEeKjvqrMhLLWTg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_k1_1afXIEeKjvqrMhLLWTg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_k1_1avXIEeKjvqrMhLLWTg" type="7019">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_k2BDgPXIEeKjvqrMhLLWTg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_k2BDgfXIEeKjvqrMhLLWTg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_k1_1a_XIEeKjvqrMhLLWTg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_k1_1bPXIEeKjvqrMhLLWTg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_k1_1bfXIEeKjvqrMhLLWTg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_k1_1bvXIEeKjvqrMhLLWTg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_k2MpsPXIEeKjvqrMhLLWTg" visible="false" type="compartment_shape_display">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_k2Mps_XIEeKjvqrMhLLWTg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_k2MptPXIEeKjvqrMhLLWTg" key="mutable" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_k2MpsfXIEeKjvqrMhLLWTg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_k2MpsvXIEeKjvqrMhLLWTg"/>
+ </children>
+ <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>
+ <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
new file mode 100644
index 00000000000..e74b03c50b9
--- /dev/null
+++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/StandardResource/oneProfileApplied.uml
@@ -0,0 +1,28 @@
+<?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
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/resourceperprofile/LoadUnloadOutsideEditorTests.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractChangeStrategyTests.java
index b70e135ec42..3df5874177a 100644
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/resourceperprofile/LoadUnloadOutsideEditorTests.java
+++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/AbstractChangeStrategyTests.java
@@ -10,7 +10,7 @@
* Remi Schnekenburger (CEA LIST) - Initial API and implementation
*
*****************************************************************************/
-package org.eclipse.papyrus.uml.profile.externalresource.tests.resourceperprofile;
+package org.eclipse.papyrus.uml.profile.externalresource.tests;
import static org.junit.Assert.fail;
@@ -27,10 +27,12 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.uml.profile.externalresource.helper.ExternalResourceProfileUtils;
+import org.eclipse.papyrus.uml.profile.externalresource.helper.IStereotypeApplicationLocationStrategy;
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.ResourcePerProfileStrategy;
+import org.eclipse.papyrus.uml.profile.externalresource.helper.StandardApplicationLocationStrategy;
import org.eclipse.papyrus.uml.profile.externalresource.helper.StrategyRegistry;
-import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractExternalResourcesTest;
import org.eclipse.papyrus.uml.tools.model.UmlModel;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Model;
@@ -38,46 +40,93 @@ import org.eclipse.uml2.uml.UMLPackage;
import org.junit.Assert;
import org.junit.Test;
+
/**
- * Test class for load/unload
+ * Abstract class for all change strategy tests
*/
-public class LoadUnloadOutsideEditorTests extends AbstractExternalResourcesTest {
-
+public abstract class AbstractChangeStrategyTests extends AbstractExternalResourcesTest {
+
@Test
- public void testLoadModelOutsidePapyrusEditor() {
- UmlModel umlModel = null;
- // get The model. try to see applied stereotypes
+ 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
try {
- umlModel = (UmlModel)modelSet.getModelChecked(UmlModel.MODEL_ID);
+ tmpUmlModel = (UmlModel)tmpModelSet.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);
+ Resource tmpResource = tmpUmlModel.getResource();
+ Model tmpRootModel = (Model)tmpResource.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);
+ 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);
+ // check undo, check redo...
}
-
- /**
- * @param rootModel
- */
- protected void checkModel(Model rootModel) {
- Assert.assertEquals("Some profiles are missing", 2, rootModel.getAllAppliedProfiles().size());
- Assert.assertNotNull("ExternalResourcesTestProfile is missing", rootModel.getAppliedProfile(EXTERNAL_RESOURCES_TEST_PROFILE));
- Assert.assertNotNull("ExternalResourcesTestProfile::SubProfile is missing", rootModel.getAppliedProfile(EXTERNAL_RESOURCES_TEST_PROFILE_SUB_PROFILE));
+
+ @Test
+ public void changeToOneFilePerProfileStrategy() {
+ 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
+ try {
+ tmpUmlModel = (UmlModel)tmpModelSet.getModelChecked(UmlModel.MODEL_ID);
+ } catch (NotFoundException e) {
+ fail(e.getMessage());
+ }
+ Resource tmpResource = tmpUmlModel.getResource();
+ Model tmpRootModel = (Model)tmpResource.getContents().get(0);
+
// test some stereotype applications
// Model::class1 should have <<classStereotype>> Applied (verify root level stererotype)
- Class class1_ = (Class)rootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false);
- Assert.assertNotNull(MODEL_CLASS1 + " should not be null", class1_);
- Assert.assertNotNull(MODEL_CLASS1 + " should have stereotype " + CLASS_STEREOTYPE_NAME, class1_.getAppliedStereotype(CLASS_STEREOTYPE_QN));
- // Model::class1 should have <<classStereotype>> Applied (verify stereotype in subprofile)
- 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));
+ 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", getTempURI().trimFileExtension().appendFileExtension(EXTERNAL_RESOURCES_TEST_PROFILE+"Profile"), stereotypeApplicationURI);
}
-
+
@Test
- public void moveStereotypeApplicationOutsidePapyrusEditor() {
+ public void changeToStandardStrategy() {
+ 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
+ try {
+ tmpUmlModel = (UmlModel)tmpModelSet.getModelChecked(UmlModel.MODEL_ID);
+ } catch (NotFoundException e) {
+ fail(e.getMessage());
+ }
+ Resource tmpResource = tmpUmlModel.getResource();
+ Model tmpRootModel = (Model)tmpResource.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);
+ 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);
+ // check undo, check redo...
+ }
+
+ protected void changeToStrategy(IStereotypeApplicationLocationStrategy newStrategy) {
UmlModel umlModel = null;
// get The model. try to see applied stereotypes
try {
@@ -88,7 +137,7 @@ public class LoadUnloadOutsideEditorTests extends AbstractExternalResourcesTest
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));
+ ICommand command = ExternalResourceProfileUtils.createUpdateStereotypeApplicationsLocationCommand(rootModel, PapyrusStereotypeApplicationHelper.getCurrentLocationStrategy(rootModel), newStrategy);
Assert.assertNotNull("Impossible to create update command", command);
Assert.assertTrue("Command should be executable", command.canExecute());
IStatus status = null;
@@ -102,7 +151,7 @@ public class LoadUnloadOutsideEditorTests extends AbstractExternalResourcesTest
fail(status.getMessage());
}
- URI tmpURI = URI.createPlatformResourceURI("/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/OneResourcePerProfile/tmp.di", true);
+ URI tmpURI = getTempURI();
try {
getModelSet(getURI()).saveAs(tmpURI);
} catch (IOException e) {
@@ -127,23 +176,9 @@ public class LoadUnloadOutsideEditorTests extends AbstractExternalResourcesTest
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
- public URI getURI() {
- return URI.createPlatformResourceURI("/org.eclipse.papyrus.uml.profile.externalresource.tests/resources/OneResourcePerProfile/oneProfileApplied.di", true);
+
+ public URI getTempURI() {
+ return URI.createPlatformResourceURI(getTestProjectName()+"/tmp.di", true);
}
}
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 2fb073fe466..843a37dacad 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
@@ -12,42 +12,61 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.profile.externalresource.tests;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.URI;
+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.gmf.runtime.common.core.command.ICommand;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.ModelMultiException;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.ModelsReader;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.resource.TransactionalEditingDomainManager;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
import org.eclipse.papyrus.infra.core.services.ServiceException;
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.ServiceUtilsForResourceInitializerService;
-import org.eclipse.pde.core.plugin.IPluginModelBase;
-import org.eclipse.pde.internal.core.PDECore;
-import org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils;
+import org.eclipse.papyrus.junit.utils.ProjectUtils;
+import org.eclipse.papyrus.uml.profile.externalresource.helper.ExternalResourceProfileUtils;
+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.model.UmlModel;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
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.UMLPackage;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Test;
/**
* Abstract class for all tests in this plugin
@@ -84,32 +103,71 @@ public abstract class AbstractExternalResourcesTest {
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 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() {
- // first of all, delete existing model
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = workspace.getRoot();
- IProject project = root.getProject(Activator.PLUGIN_ID);
- //at this point, no resources have been created
- if(project.exists()) {
+ ResourcesPlugin.getWorkspace().getDescription().setAutoBuilding(false);
+ IProject project = null;
+ try {
+ project = ProjectUtils.createProject(getTestProjectName());
+ } catch (CoreException e1) {
+ fail(e1.getMessage());
+ }
+ Assert.assertNotNull("Impossible to create the project", project);
+ // import model files.
+ // retrieve the content of the source folder, and copy it into the destination folder
+ for(String fileName : getModelFileNames()) {
try {
- project.delete(true, true, new NullProgressMonitor());
+ PapyrusProjectUtils.copyIFile("resources/"+getTestProjectName()+"/"+fileName, Platform.getBundle(Activator.PLUGIN_ID), project, fileName);
} catch (CoreException e) {
- Assert.fail(e.getMessage());
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
}
- }
- // import model files.
- PluginImportOperation operation = new PluginImportOperation(new IPluginModelBase[]{ PDECore.getDefault().getModelManager().findModel(Activator.PLUGIN_ID) }, PluginImportOperation.IMPORT_WITH_SOURCE, false);
- IStatus status = operation.run(new NullProgressMonitor());
- if(IStatus.ERROR == status.getSeverity()) {
- Assert.fail(status.getMessage());
- }
+ }
+
servicesRegistry = getServicesRegistry();
modelSet = getModelSet(getURI());
Assert.assertNotNull("Model set should not be null", modelSet);
}
+ /**
+ * {@inheritDoc}
+ */
+ public URI getURI() {
+ return URI.createPlatformResourceURI(getTestProjectName()+"/"+getModelFileNames().get(0), true);
+ }
+
+ /**
+ * Warning: main Model.di file must be put first!!!
+ * @return
+ */
+ protected abstract List<String> getModelFileNames();
+
+ /**
+ * @return
+ */
+ protected abstract String getTestProjectName();
+
@After
public void tearDownRegistry() {
if(modelSet != null) {
@@ -126,6 +184,39 @@ public abstract class AbstractExternalResourcesTest {
}
}
}
+
+ @Test
+ public void testLoadModelOutsidePapyrusEditor() {
+ 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
+ */
+ protected void checkModel(Model rootModel) {
+ Assert.assertEquals("Some profiles are missing", 2, rootModel.getAllAppliedProfiles().size());
+ Assert.assertNotNull("ExternalResourcesTestProfile is missing", rootModel.getAppliedProfile(EXTERNAL_RESOURCES_TEST_PROFILE));
+ Assert.assertNotNull("ExternalResourcesTestProfile::SubProfile is missing", rootModel.getAppliedProfile(EXTERNAL_RESOURCES_TEST_PROFILE_SUB_PROFILE));
+ // test some stereotype applications
+ // Model::class1 should have <<classStereotype>> Applied (verify root level stererotype)
+ Class class1_ = (Class)rootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false);
+ Assert.assertNotNull(MODEL_CLASS1 + " should not be null", class1_);
+ Assert.assertNotNull(MODEL_CLASS1 + " should have stereotype " + CLASS_STEREOTYPE_NAME, class1_.getAppliedStereotype(CLASS_STEREOTYPE_QN));
+ // Model::class1 should have <<classStereotype>> Applied (verify stereotype in subprofile)
+ 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));
+ }
public ModelSet createModelSet(URI uri) throws ModelMultiException {
ModelSet modelSet = new ModelSet();
@@ -215,9 +306,6 @@ public abstract class AbstractExternalResourcesTest {
}
return modelSet;
}
+
- /**
- * @return the uri
- */
- public abstract URI getURI();
}
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 566623f0766..15a2fa69960 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
@@ -12,7 +12,6 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.profile.externalresource.tests;
-import org.eclipse.papyrus.uml.profile.externalresource.tests.resourceperprofile.LoadUnloadOutsideEditorTests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@@ -23,7 +22,9 @@ import org.junit.runners.Suite.SuiteClasses;
*/
@RunWith(Suite.class)
@SuiteClasses({
- LoadUnloadOutsideEditorTests.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
new file mode 100644
index 00000000000..c05833ee491
--- /dev/null
+++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/oneresourceforallprofiles/OneResourceForAllProfilesTests.java
@@ -0,0 +1,105 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.profile.externalresource.tests.oneresourceforallprofiles;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractChangeStrategyTests;
+import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractExternalResourcesTest;
+
+/**
+ * Test class for load/unload
+ */
+public class OneResourceForAllProfilesTests extends AbstractChangeStrategyTests {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTestProjectName() {
+ return ONE_RESOURCE_FOR_ALL_PROFILES_FOLDER;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected List<String> getModelFileNames() {
+ return Arrays.asList(DI_FILE, NOTATION_FILE, UML_FILE, ALL_PROFILES_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
new file mode 100644
index 00000000000..fe7d1c0a3a0
--- /dev/null
+++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/resourceperprofile/ResourcePerProfileTests.java
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.profile.externalresource.tests.resourceperprofile;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractChangeStrategyTests;
+
+/**
+ * Test class for load/unload
+ */
+public class ResourcePerProfileTests extends AbstractChangeStrategyTests {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTestProjectName() {
+ return ONE_RESOURCE_PER_PROFILE_FOLDER;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected List<String> getModelFileNames() {
+ return Arrays.asList(DI_FILE, NOTATION_FILE, UML_FILE, 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
new file mode 100644
index 00000000000..3062dec5267
--- /dev/null
+++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource.tests/src/org/eclipse/papyrus/uml/profile/externalresource/tests/standardstrategy/StandardStrategyTests.java
@@ -0,0 +1,109 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.profile.externalresource.tests.standardstrategy;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractChangeStrategyTests;
+import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractExternalResourcesTest;
+
+/**
+ * Test class for load/unload
+ */
+public class StandardStrategyTests extends AbstractChangeStrategyTests {
+
+
+ public static final List<String> FILE_NAMES = Arrays.asList(DI_FILE, UML_FILE, NOTATION_FILE);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTestProjectName() {
+ return STANDARD_STRATEGY_FOLDER;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ 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...
+// }
+
+
+}
diff --git a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/PapyrusStereotypeApplicationHelper.java b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/PapyrusStereotypeApplicationHelper.java
index a8aa71cadfc..7dc45da2678 100644
--- a/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/PapyrusStereotypeApplicationHelper.java
+++ b/sandbox/ExternalResourceStereotypeApplication/org.eclipse.papyrus.uml.profile.externalresource/src/org/eclipse/papyrus/uml/profile/externalresource/helper/PapyrusStereotypeApplicationHelper.java
@@ -66,19 +66,19 @@ public class PapyrusStereotypeApplicationHelper extends StereotypeApplicationHel
/**
* Returns the specific location strategy to use for the given model element
* @param element the stereotyped element
- * @return the location strategy or <code>null</code> if none was found
+ * @return the location strategy or the standard one if none was found
*/
public static IStereotypeApplicationLocationStrategy getCurrentLocationStrategy(EObject element) {
EObject container = EcoreUtil.getRootContainer(element, true);
if(container instanceof Element) {
EAnnotation annotation = ((Element)container).getEAnnotation(PAPYRUS_EXTERNAL_RESOURCE_EANNOTATION_SOURCE);
if(annotation == null) {
- return null;
+ return StrategyRegistry.getInstance().getStrategy(StandardApplicationLocationStrategy.ID);
}
String location = annotation.getDetails().get(LOCATION_STRATEGY_KEY);
if(location == null) {
- return null;
+ return StrategyRegistry.getInstance().getStrategy(StandardApplicationLocationStrategy.ID);
}
IStereotypeApplicationLocationStrategy strategy = StrategyRegistry.getInstance().getStrategy(location);
@@ -86,7 +86,7 @@ public class PapyrusStereotypeApplicationHelper extends StereotypeApplicationHel
return strategy;
}
}
- return null;
+ return StrategyRegistry.getInstance().getStrategy(StandardApplicationLocationStrategy.ID);
}
/**

Back to the top