Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-03-01 21:12:57 +0000
committerChristian W. Damus2016-03-03 13:10:34 +0000
commitfd67537c8be16b59b5ba508cea8e9e8585523b7c (patch)
tree1313f88f62a32f44f3cbd4951c86f38f2a08eb65
parent9e6a1135bc8d0712f9d8f1bedd99a5f4fe00077d (diff)
downloadorg.eclipse.papyrus-fd67537c8be16b59b5ba508cea8e9e8585523b7c.tar.gz
org.eclipse.papyrus-fd67537c8be16b59b5ba508cea8e9e8585523b7c.tar.xz
org.eclipse.papyrus-fd67537c8be16b59b5ba508cea8e9e8585523b7c.zip
Bug 488791: [Tests] Discontinue packaging of tests as fragment bundles
Deprecate the FragmentTestSuiteClass. Convert all test fragments in the Papyrus Main Tests to plug-ins (does require some changes in the tests themselves, especially in the finding of test resources within the bundles and a few cases of making API accessible for testing). Update the aggregate suites accordingly. Change-Id: I91b38b3152fb147d3c4185b00240248344cce95b
-rw-r--r--features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.core.feature/feature.xml4
-rw-r--r--features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml8
-rw-r--r--features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.services.feature/feature.xml2
-rw-r--r--features/papyrus-tests-features/org.eclipse.papyrus.tests.sysml.diagram.feature/feature.xml6
-rw-r--r--features/papyrus-tests-features/org.eclipse.papyrus.tests.sysml.feature/feature.xml2
-rw-r--r--features/papyrus-tests-features/org.eclipse.papyrus.tests.uml.feature/feature.xml10
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/RootModel.java167
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java38
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.widgets/.settings/.api_filters67
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF1
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/META-INF/MANIFEST.MF8
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelMngrTest.java368
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProviderTest.java593
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImplTest.java973
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/META-INF/MANIFEST.MF62
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/build.properties16
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/plugin.properties (renamed from tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/fragment.properties)0
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/plugin.xml (renamed from tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/fragment.xml)0
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/.classpath6
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF30
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/build.properties18
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/plugin.properties (renamed from tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/fragment.properties)0
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/plugin.xml (renamed from tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/fragment.xml)0
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/FakeModel.java10
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/services/ComposedServiceTest.java298
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/services/ServicesRegistryTest.java1640
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF53
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus SysML tests.launch2
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllSysMLTests.java91
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java28
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/META-INF/MANIFEST.MF38
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/build.properties2
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/plugin.properties (renamed from tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/fragment.properties)0
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTesterTest.java33
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/META-INF/MANIFEST.MF38
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/META-INF/MANIFEST.MF9
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/build.properties2
-rw-r--r--tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/plugin.properties (renamed from tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/fragment.properties)0
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/META-INF/MANIFEST.MF28
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/build.properties2
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/plugin.properties (renamed from tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/fragment.properties)0
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/META-INF/MANIFEST.MF6
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/build.properties4
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/plugin.properties (renamed from tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/fragment.properties)0
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/plugin.xml (renamed from tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/fragment.xml)0
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java433
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java287
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java367
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java309
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java309
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java339
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java463
-rw-r--r--tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/META-INF/MANIFEST.MF8
-rw-r--r--tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/build.properties16
-rw-r--r--tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/plugin.properties (renamed from tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/fragment.properties)0
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.framework/src/org/eclipse/papyrus/junit/framework/runner/FragmentTestSuiteClass.java138
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/META-INF/MANIFEST.MF30
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/AbstractTest.java12
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/META-INF/MANIFEST.MF34
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/src/org/eclipse/papyrus/sysml/diagram/internalblock/tests/AbstractTest.java12
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF35
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java168
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/META-INF/MANIFEST.MF27
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/.classpath18
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/META-INF/MANIFEST.MF30
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/build.properties4
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/plugin.properties (renamed from tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/fragment.properties)0
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/plugin.xml (renamed from tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/fragment.xml)0
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java71
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java42
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/.classpath6
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/META-INF/MANIFEST.MF28
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/build.properties4
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/org.eclipse.papyrus.uml.profile.tests.launch2
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/plugin.properties (renamed from tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/fragment.properties)0
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/plugin.xml (renamed from tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/fragment.xml)0
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF40
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties20
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/plugin.xml (renamed from tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/fragment.xml)0
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreatePureUMLElementTest.java2
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/META-INF/MANIFEST.MF6
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateElementTest.java2
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateProfileRelationshipTest.java2
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateRelationshipTest.java2
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/MoveElementTest.java2
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/SetFeatureTest.java2
87 files changed, 4072 insertions, 3863 deletions
diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.core.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.core.feature/feature.xml
index 55a3c82cb58..53a4f1db0ca 100644
--- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.core.feature/feature.xml
+++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.core.feature/feature.xml
@@ -17,8 +17,8 @@ http://www.eclipse.org/legal/epl-v10.html
<plugin download-size="0" id="org.eclipse.papyrus.infra.core.sasheditor.di.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.infra.core.sasheditor.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.infra.core.sasheditor.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.infra.core.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.infra.core.tests" install-size="0" unpack="false" version="0.0.0"/>
</feature> \ No newline at end of file
diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml
index 6fadcb604f4..5d801e04664 100644
--- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml
+++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.feature/feature.xml
@@ -22,13 +22,13 @@ http://www.eclipse.org/legal/epl-v10.html
<plugin download-size="0" id="org.eclipse.papyrus.infra.types.ui.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.infra.gmfdiag.commands.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.infra.gmfdiag.commands.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.infra.gmfdiag.common.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.infra.gmfdiag.common.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.infra.emf.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.infra.emf.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.infra.emf.readonly.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.infra.emf.readonly.tests" install-size="0" unpack="false" version="0.0.0"/>
<plugin download-size="0" id="org.eclipse.papyrus.infra.tools.tests" install-size="0" unpack="false" version="0.0.0"/>
diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.services.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.services.feature/feature.xml
index fe46efb3f7f..f8290753f75 100644
--- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.services.feature/feature.xml
+++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.infra.services.feature/feature.xml
@@ -15,7 +15,7 @@ http://www.eclipse.org/legal/epl-v10.html
%license
</license>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.infra.services.resourceloading.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.infra.services.resourceloading.tests" install-size="0" unpack="false" version="0.0.0"/>
<plugin download-size="0" id="org.eclipse.papyrus.infra.services.edit.tests" install-size="0" unpack="false" version="0.0.0"/>
diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.sysml.diagram.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.sysml.diagram.feature/feature.xml
index 02651138835..aa0acd9eda6 100644
--- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.sysml.diagram.feature/feature.xml
+++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.sysml.diagram.feature/feature.xml
@@ -12,12 +12,12 @@
[Enter License Description here.]
</license>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.sysml.diagram.blockdefinition.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.sysml.diagram.blockdefinition.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.sysml.diagram.internalblock.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.sysml.diagram.internalblock.tests" install-size="0" unpack="false" version="0.0.0"/>
<plugin download-size="0" id="org.eclipse.papyrus.sysml.diagram.requirement.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.sysml.diagram.parametric.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.sysml.diagram.parametric.tests" install-size="0" unpack="false" version="0.0.0"/>
</feature> \ No newline at end of file
diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.sysml.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.sysml.feature/feature.xml
index e45ed757e9a..7c268e21bfc 100644
--- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.sysml.feature/feature.xml
+++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.sysml.feature/feature.xml
@@ -12,7 +12,7 @@
[Enter License Description here.]
</license>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.sysml.service.types.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.sysml.service.types.tests" install-size="0" unpack="false" version="0.0.0"/>
<plugin download-size="0" id="org.eclipse.papyrus.sysml.tests" install-size="0" unpack="false" version="0.0.0"/>
diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.uml.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.uml.feature/feature.xml
index 28b7fd4bbfd..35c4ed4fffd 100644
--- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.uml.feature/feature.xml
+++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.uml.feature/feature.xml
@@ -18,17 +18,17 @@ http://www.eclipse.org/legal/epl-v10.html
<plugin download-size="0" id="org.eclipse.papyrus.search.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.uml.modelrepair.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.uml.modelrepair.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.uml.service.types.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.uml.service.types.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.uml.service.types.ui.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.uml.service.types.ui.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.uml.profile.drafter.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.uml.profile.drafter.tests" install-size="0" unpack="false" version="0.0.0"/>
<plugin download-size="0" id="org.eclipse.papyrus.uml.filters.tests" install-size="0" unpack="false" version="0.0.0"/>
- <plugin download-size="0" fragment="true" id="org.eclipse.papyrus.uml.profile.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.uml.profile.tests" install-size="0" unpack="false" version="0.0.0"/>
<plugin download-size="0" id="org.eclipse.papyrus.uml.dynamic.profile.tests" install-size="0" unpack="false" version="0.0.0"/>
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/RootModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/RootModel.java
index 722c24a31aa..a348a921277 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/RootModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/RootModel.java
@@ -1,82 +1,85 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
- *
- *
- * 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:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple;
-
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
-
-/**
- * @author dumoulin
- */
-public class RootModel extends AbstractModel {
-
- /**
- * Child of this root model.
- */
- private AbstractPanelModel child;
-
- /**
- * Constructor.
- *
- * @param child
- */
- public RootModel(AbstractPanelModel child) {
- this.child = child;
- child.setParent(this);
- }
-
- /**
- * Return the parent of the model. Can be null in the case of rootModel.
- *
- * @return the parent
- */
- @Override
- public AbstractModel getParent() {
- return null;
- }
-
- /**
- * @param parent
- * the parent to set
- */
- @Override
- public void setParent(AbstractModel parent) {
- }
-
- /**
- * Replace the actual child by the new child.
- *
- */
- @Override
- public void replaceChild(AbstractPanelModel oldChild, AbstractPanelModel newChild) {
-
- assert (child == oldChild);
- child = newChild;
-
- }
-
- /**
- * Lookup the folder containing the specified tabItem.
- *
- * @param tabItem
- * @return
- */
- protected TabFolderModel lookupTabFolder(IPageModel tabItem) {
- return child.lookupTabFolder(tabItem);
- }
-
- protected AbstractPanelModel getChild() {
- return child;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2009, 2016 LIFL, CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ * Christian W. Damus - bug 488791
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+
+/**
+ * @author dumoulin
+ */
+public class RootModel extends AbstractModel {
+
+ /**
+ * Child of this root model.
+ */
+ private AbstractPanelModel child;
+
+ /**
+ * Constructor.
+ *
+ * @param child
+ */
+ public RootModel(AbstractPanelModel child) {
+ this.child = child;
+ child.setParent(this);
+ }
+
+ /**
+ * Return the parent of the model. Can be null in the case of rootModel.
+ *
+ * @return the parent
+ */
+ @Override
+ public AbstractModel getParent() {
+ return null;
+ }
+
+ /**
+ * @param parent
+ * the parent to set
+ */
+ @Override
+ public void setParent(AbstractModel parent) {
+ }
+
+ /**
+ * Replace the actual child by the new child.
+ *
+ */
+ @Override
+ public void replaceChild(AbstractPanelModel oldChild, AbstractPanelModel newChild) {
+
+ assert (child == oldChild);
+ child = newChild;
+
+ }
+
+ /**
+ * Lookup the folder containing the specified tabItem.
+ *
+ * @param tabItem
+ * @return
+ */
+ protected TabFolderModel lookupTabFolder(IPageModel tabItem) {
+ return child.lookupTabFolder(tabItem);
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public AbstractPanelModel getChild() {
+ return child;
+ }
+
+}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java
index c141eb52742..5290f34e95a 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2009, 2014 LIFL, CEA LIST, and others.
+ * Copyright (c) 2009, 2016 LIFL, CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +9,7 @@
* Contributors:
* Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 437217
+ * Christian W. Damus - bug 488791
*
*****************************************************************************/
package org.eclipse.papyrus.infra.core.sasheditor.internal;
@@ -273,7 +274,12 @@ public class SashWindowsContainer implements ISashWindowsContainer {
* <li>properties are cleaned in order to help the GC</li>
* <li>swt controls are not disposed again</li>
* </ul>
- * <li></li> <li></li> <li></li> <li></li> <li></li> </ul>
+ * <li></li>
+ * <li></li>
+ * <li></li>
+ * <li></li>
+ * <li></li>
+ * </ul>
*
*/
public void dispose() {
@@ -557,7 +563,7 @@ public class SashWindowsContainer implements ISashWindowsContainer {
return visitor.getVisiblePages();
}
-
+
/**
*
* @see org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer#getNextPage()
@@ -569,7 +575,7 @@ public class SashWindowsContainer implements ISashWindowsContainer {
CollectNextPageVisitor visitor = new CollectNextPageVisitor(false);
return getPage(visitor);
}
-
+
/**
*
* @see org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer#getNextPage()
@@ -581,15 +587,15 @@ public class SashWindowsContainer implements ISashWindowsContainer {
CollectNextPageVisitor visitor = new CollectNextPageVisitor(true);
return getPage(visitor);
}
-
+
/**
* Use the provided visitor to get the next page and return it.
*/
private IPage getPage(CollectNextPageVisitor visitor) {
if (visitor != null) {
- rootPart.visit(visitor);
+ rootPart.visit(visitor);
if (!visitor.getNextPages().isEmpty()) {
- return (IPage) visitor.getNextPages().get(0);
+ return visitor.getNextPages().get(0);
}
}
return null;
@@ -885,8 +891,10 @@ public class SashWindowsContainer implements ISashWindowsContainer {
* Visit the Part associated to the container. This method visibility is protected in order to be able to access it
* from junit tests.
* It is not intended to be used by public API or from outside.
+ *
+ * @noreference This method is not intended to be referenced by clients.
*/
- protected void visit(IPartVisitor visitor) {
+ public void visit(IPartVisitor visitor) {
rootPart.visit(visitor);
}
@@ -1314,7 +1322,7 @@ public class SashWindowsContainer implements ISashWindowsContainer {
}
}
-
+
/**
* Inner class.
* A visitor used to collect the next page of the next opened tab (right or left).
@@ -1323,7 +1331,7 @@ public class SashWindowsContainer implements ISashWindowsContainer {
private class CollectNextPageVisitor extends PartVisitor {
private List<IPage> nextPages = new ArrayList<IPage>();
-
+
private final boolean isPrevious;
/**
@@ -1348,14 +1356,14 @@ public class SashWindowsContainer implements ISashWindowsContainer {
public boolean accept(TabFolderPart part) {
PagePart activePage = activePageTracker.getActiveEditor();
PagePart visiblePage = part.getVisiblePagePart();
-
+
if (activePage == visiblePage) {
CTabFolder tabFolder = part.getTabFolder();
int itemCount = tabFolder.getItemCount();
-
+
if (itemCount > 1) {
int selectionIndex = tabFolder.getSelectionIndex();
-
+
if (isPrevious) {
selectionIndex--;
if (selectionIndex < 0) {
@@ -1367,14 +1375,14 @@ public class SashWindowsContainer implements ISashWindowsContainer {
selectionIndex = 0;
}
}
-
+
IPage nextPage = part.getPagePart(selectionIndex);
if (nextPage != null) {
nextPages.add(nextPage);
}
}
}
-
+
return true;
}
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
index 13277bf4d84..7d28645a912 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/META-INF/MANIFEST.MF
@@ -4,6 +4,7 @@ Export-Package: org.eclipse.papyrus.infra.core,
org.eclipse.papyrus.infra.core.editor,
org.eclipse.papyrus.infra.core.extension,
org.eclipse.papyrus.infra.core.internal.expressions;x-internal:=true,
+ org.eclipse.papyrus.infra.core.internal.language;x-internal:=true,
org.eclipse.papyrus.infra.core.internal.sashmodel;x-internal:=true,
org.eclipse.papyrus.infra.core.language,
org.eclipse.papyrus.infra.core.listenerservice,
@@ -15,6 +16,7 @@ Export-Package: org.eclipse.papyrus.infra.core,
org.eclipse.papyrus.infra.core.resource.additional,
org.eclipse.papyrus.infra.core.resource.sasheditor,
org.eclipse.papyrus.infra.core.services,
+ org.eclipse.papyrus.infra.core.services.internal;x-internal:=true,
org.eclipse.papyrus.infra.core.services.spi,
org.eclipse.papyrus.infra.core.utils
Require-Bundle: org.eclipse.emf.workspace;bundle-version="[1.5.0,2.0.0)",
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/.settings/.api_filters b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/.settings/.api_filters
deleted file mode 100644
index e9d125135df..00000000000
--- a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/.settings/.api_filters
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.papyrus.infra.widgets" version="2">
- <resource path="src/org/eclipse/papyrus/infra/widgets/editors/AbstractEditor.java" type="org.eclipse.papyrus.infra.widgets.editors.AbstractEditor">
- <filter comment="No sane developer would have assigned these fields" id="388100214">
- <message_arguments>
- <message_argument value="org.eclipse.papyrus.infra.widgets.editors.AbstractEditor"/>
- <message_argument value="factory"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueEditor.java" type="org.eclipse.papyrus.infra.widgets.editors.MultipleValueEditor">
- <filter comment="No sane developer would have assigned these fields" id="388100214">
- <message_arguments>
- <message_argument value="org.eclipse.papyrus.infra.widgets.editors.MultipleValueEditor"/>
- <message_argument value="MANY"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/papyrus/infra/widgets/editors/MultipleValueSelectorDialog.java" type="org.eclipse.papyrus.infra.widgets.editors.MultipleValueSelectorDialog">
- <filter comment="No sane developer would have assigned these fields" id="388100214">
- <message_arguments>
- <message_argument value="org.eclipse.papyrus.infra.widgets.editors.MultipleValueSelectorDialog"/>
- <message_argument value="MANY"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/papyrus/infra/widgets/providers/CollectionContentProvider.java" type="org.eclipse.papyrus.infra.widgets.providers.CollectionContentProvider">
- <filter comment="No sane developer would have assigned these fields" id="388100214">
- <message_arguments>
- <message_argument value="org.eclipse.papyrus.infra.widgets.providers.CollectionContentProvider"/>
- <message_argument value="instance"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/papyrus/infra/widgets/providers/EmptyContentProvider.java" type="org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider">
- <filter comment="No sane developer would have assigned these fields" id="388100214">
- <message_arguments>
- <message_argument value="org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider"/>
- <message_argument value="instance"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/papyrus/infra/widgets/providers/TreeCollectionContentProvider.java" type="org.eclipse.papyrus.infra.widgets.providers.TreeCollectionContentProvider">
- <filter comment="No sane developer would have assigned these fields" id="388100214">
- <message_arguments>
- <message_argument value="org.eclipse.papyrus.infra.widgets.providers.TreeCollectionContentProvider"/>
- <message_argument value="instance"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/papyrus/infra/widgets/providers/UnchangedObject.java" type="org.eclipse.papyrus.infra.widgets.providers.UnchangedObject">
- <filter comment="No sane developer would have assigned these fields" id="388100214">
- <message_arguments>
- <message_argument value="org.eclipse.papyrus.infra.widgets.providers.UnchangedObject"/>
- <message_argument value="instance"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/papyrus/infra/widgets/providers/UnsetObject.java" type="org.eclipse.papyrus.infra.widgets.providers.UnsetObject">
- <filter comment="No sane developer would have assigned these fields" id="388100214">
- <message_arguments>
- <message_argument value="org.eclipse.papyrus.infra.widgets.providers.UnsetObject"/>
- <message_argument value="instance"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF
index d68bedc5a18..858da35f912 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF
@@ -5,6 +5,7 @@ Export-Package: org.eclipse.papyrus.uml.profile,
org.eclipse.papyrus.uml.profile.preference,
org.eclipse.papyrus.uml.profile.providers,
org.eclipse.papyrus.uml.profile.service,
+ org.eclipse.papyrus.uml.profile.service.ui;x-internal:=true,
org.eclipse.papyrus.uml.profile.structure,
org.eclipse.papyrus.uml.profile.tree,
org.eclipse.papyrus.uml.profile.tree.objects,
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/META-INF/MANIFEST.MF
index c9a5ddec8ec..d1aa705cee3 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/META-INF/MANIFEST.MF
@@ -1,16 +1,16 @@
Manifest-Version: 1.0
Require-Bundle: org.junit;bundle-version="4.10.0",
org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
- org.eclipse.emf.ecore.xmi;bundle-version="[2.12.0,3.0.0)"
+ org.eclipse.emf.ecore.xmi;bundle-version="[2.12.0,3.0.0)",
+ org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor.tests;bundle-version="1.2.0"
Export-Package: org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider,
org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal,
org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query,
org.eclipse.papyrus.infra.core.sasheditor.di.tests
Bundle-Vendor: %Bundle-Vendor
-Fragment-Host: org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="1.2.0"
Bundle-Version: 1.2.0.qualifier
Bundle-Name: %Bundle-Name
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.core.sasheditor.di.tests
-Import-Package: org.eclipse.papyrus.infra.core.sasheditor.pagesmodel
+Bundle-SymbolicName: org.eclipse.papyrus.infra.core.sasheditor.di.tests;singleton:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelMngrTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelMngrTest.java
index 7539403c8c9..56015a2d975 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelMngrTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/DiSashModelMngrTest.java
@@ -1,167 +1,201 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
- *
- *
- * 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:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider;
-
-import static org.junit.Assert.assertNotNull;
-
-import java.io.File;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
-import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
-import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
-import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * @author cedric dumoulin
- */
-public class DiSashModelMngrTest extends AbstractPapyrusTest {
-
- /**
- * A fake factory for testing.
- */
- protected IPageModelFactory fakeModelFactory;
-
- /**
- * @see junit.framework.TestCase#setUp()
- *
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- fakeModelFactory = new FakeModelFactory();
- }
-
- /**
- * @see junit.framework.TestCase#tearDown()
- *
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- //Nothing
- }
-
- protected Resource createDiSashModelResource() {
- // Create di resource
- ResourceSet resourceSet = new ResourceSetImpl();
-
- // Register the default resource factory -- only needed for stand-alone!
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
-
- // Get the URI of the model file.
- URI fileURI = URI.createFileURI(new File("tempfile.di").getAbsolutePath());
-
- Resource diResource = resourceSet.createResource(fileURI);
- return diResource;
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#DiSashModelMngr(org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory)}
- * .
- */
- @Test
- public void testDiSashModelMngrIPageModelFactory() {
-
- DiSashModelMngr modelMngr = new DiSashModelMngr(fakeModelFactory);
-
- assertNotNull("retrieve ContentProvider", modelMngr.getISashWindowsContentProvider());
- assertNotNull("retrieve PageMngr", modelMngr.getIPageMngr());
- assertNotNull("model created", modelMngr.getDiSashWindowsMngr());
- assertNotNull("default folder is set", modelMngr.getDiSashWindowsMngr().getSashModel().getCurrentSelection());
- //
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#DiSashModelMngr(org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory, org.eclipse.emf.ecore.resource.Resource)}
- * .
- */
- @Test
- public void testDiSashModelMngrIPageModelFactoryResource() {
- Resource resource = createDiSashModelResource();
-
- DiSashModelMngr modelMngr = new DiSashModelMngr(fakeModelFactory, resource);
-
- assertNotNull("retrieve ContentProvider", modelMngr.getISashWindowsContentProvider());
- assertNotNull("retrieve PageMngr", modelMngr.getIPageMngr());
- assertNotNull("model created", modelMngr.getDiSashWindowsMngr());
- assertNotNull("default folder is set", modelMngr.getDiSashWindowsMngr().getSashModel().getCurrentSelection());
- assertNotNull("event provider is created", modelMngr.getSashModelContentChangedProvider());
- // Check resource
-
- assertNotNull("model attached to resource", lookupSashModel(resource));
-
- }
-
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#DiSashModelMngr(org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory, org.eclipse.papyrus.sashwindows.di.DiSashModel)}
- * .
- */
- @Test
- public void testDiSashModelMngrIPageModelFactoryDiSashModel() {
- SashWindowsMngr diSashModel = DiUtils.createDefaultSashWindowsMngr();
-
- DiSashModelMngr modelMngr = new DiSashModelMngr(fakeModelFactory, diSashModel);
-
- assertNotNull("retrieve ContentProvider", modelMngr.getISashWindowsContentProvider());
- assertNotNull("retrieve PageMngr", modelMngr.getIPageMngr());
- assertNotNull("model created", modelMngr.getDiSashWindowsMngr());
- assertNotNull("default folder is set", modelMngr.getDiSashWindowsMngr().getSashModel().getCurrentSelection());
- assertNotNull("event provider is created", modelMngr.getSashModelContentChangedProvider());
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#getIPageMngr()}.
- */
- @Test
- public void testGetIPageMngr() {
- DiSashModelMngr modelMngr = new DiSashModelMngr(fakeModelFactory);
-
- assertNotNull("retrieve PageMngr", modelMngr.getIPageMngr());
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#getISashWindowsContentProvider()}.
- */
- @Test
- public void testGetISashWindowsContentProvider() {
- DiSashModelMngr modelMngr = new DiSashModelMngr(fakeModelFactory);
-
- assertNotNull("retrieve ContentProvider", modelMngr.getISashWindowsContentProvider());
- }
-
- /**
- * Lookup for the SashModel object in the resource
- *
- * @param diResource
- * @return
- */
- private SashWindowsMngr lookupSashModel(Resource diResource) {
-
- return DiUtils.lookupSashWindowsMngr(diResource);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2009, 2016 CEA LIST, LIFL, Christian W. Damus, and others.
+ *
+ * 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:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
+import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * @author cedric dumoulin
+ */
+public class DiSashModelMngrTest extends AbstractPapyrusTest {
+
+ /**
+ * A fake factory for testing.
+ */
+ protected IPageModelFactory fakeModelFactory;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ *
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ fakeModelFactory = new FakeModelFactory();
+ }
+
+ /**
+ * @see junit.framework.TestCase#tearDown()
+ *
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ // Nothing
+ }
+
+ protected Resource createDiSashModelResource() {
+ // Create di resource
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Register the default resource factory -- only needed for stand-alone!
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
+
+ // Get the URI of the model file.
+ URI fileURI = URI.createFileURI(new File("tempfile.di").getAbsolutePath());
+
+ Resource diResource = resourceSet.createResource(fileURI);
+ return diResource;
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#DiSashModelMngr(org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory)}
+ * .
+ */
+ @Test
+ public void testDiSashModelMngrIPageModelFactory() {
+
+ MyDISashModelMngr modelMngr = new MyDISashModelMngr(fakeModelFactory);
+
+ assertNotNull("retrieve ContentProvider", modelMngr.getISashWindowsContentProvider());
+ assertNotNull("retrieve PageMngr", modelMngr.getIPageMngr());
+ assertNotNull("model created", modelMngr.getDiSashWindowsMngr());
+ assertNotNull("default folder is set", modelMngr.getDiSashWindowsMngr().getSashModel().getCurrentSelection());
+ //
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#DiSashModelMngr(org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory, org.eclipse.emf.ecore.resource.Resource)}
+ * .
+ */
+ @Test
+ public void testDiSashModelMngrIPageModelFactoryResource() {
+ Resource resource = createDiSashModelResource();
+
+ MyDISashModelMngr modelMngr = new MyDISashModelMngr(fakeModelFactory, resource);
+
+ assertNotNull("retrieve ContentProvider", modelMngr.getISashWindowsContentProvider());
+ assertNotNull("retrieve PageMngr", modelMngr.getIPageMngr());
+ assertNotNull("model created", modelMngr.getDiSashWindowsMngr());
+ assertNotNull("default folder is set", modelMngr.getDiSashWindowsMngr().getSashModel().getCurrentSelection());
+ assertNotNull("event provider is created", modelMngr.getSashModelContentChangedProvider());
+ // Check resource
+
+ assertNotNull("model attached to resource", lookupSashModel(resource));
+
+ }
+
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#DiSashModelMngr(org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory, org.eclipse.papyrus.sashwindows.di.DiSashModel)}
+ * .
+ */
+ @Test
+ public void testDiSashModelMngrIPageModelFactoryDiSashModel() {
+ SashWindowsMngr diSashModel = DiUtils.createDefaultSashWindowsMngr();
+
+ MyDISashModelMngr modelMngr = new MyDISashModelMngr(fakeModelFactory, diSashModel);
+
+ assertNotNull("retrieve ContentProvider", modelMngr.getISashWindowsContentProvider());
+ assertNotNull("retrieve PageMngr", modelMngr.getIPageMngr());
+ assertNotNull("model created", modelMngr.getDiSashWindowsMngr());
+ assertNotNull("default folder is set", modelMngr.getDiSashWindowsMngr().getSashModel().getCurrentSelection());
+ assertNotNull("event provider is created", modelMngr.getSashModelContentChangedProvider());
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#getIPageMngr()}.
+ */
+ @Test
+ public void testGetIPageMngr() {
+ MyDISashModelMngr modelMngr = new MyDISashModelMngr(fakeModelFactory);
+
+ assertNotNull("retrieve PageMngr", modelMngr.getIPageMngr());
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr#getISashWindowsContentProvider()}.
+ */
+ @Test
+ public void testGetISashWindowsContentProvider() {
+ MyDISashModelMngr modelMngr = new MyDISashModelMngr(fakeModelFactory);
+
+ assertNotNull("retrieve ContentProvider", modelMngr.getISashWindowsContentProvider());
+ }
+
+ /**
+ * Lookup for the SashModel object in the resource
+ *
+ * @param diResource
+ * @return
+ */
+ private SashWindowsMngr lookupSashModel(Resource diResource) {
+
+ return DiUtils.lookupSashWindowsMngr(diResource);
+ }
+
+ //
+ // Nested types
+ //
+
+ static class MyDISashModelMngr extends DiSashModelMngr {
+
+ MyDISashModelMngr(IPageModelFactory pageModelFactory, boolean createDefaultSashModel) {
+ super(pageModelFactory, createDefaultSashModel);
+ }
+
+ MyDISashModelMngr(IPageModelFactory pageModelFactory, Resource diResource) {
+ super(pageModelFactory, diResource);
+ }
+
+ MyDISashModelMngr(IPageModelFactory pageModelFactory, SashWindowsMngr sashModel) {
+ super(pageModelFactory, sashModel);
+ }
+
+ MyDISashModelMngr(IPageModelFactory pageModelFactory) {
+ super(pageModelFactory);
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected SashWindowsMngr getDiSashWindowsMngr() {
+ return super.getDiSashWindowsMngr();
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected SashWindowsMngr lookupSashWindowMngr(Resource diResource) {
+ return super.lookupSashWindowMngr(diResource);
+ }
+ }
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProviderTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProviderTest.java
index df6131aa7a1..7e78fec38b9 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProviderTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProviderTest.java
@@ -1,272 +1,321 @@
-package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IAbstractPanelModel;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedListener;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashPanelModel;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel;
-import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory;
-import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel;
-import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
-import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel;
-import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder;
-import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
-import org.eclipse.papyrus.junit.framework.classification.NotImplemented;
-import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
-import org.eclipse.swt.SWT;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- *
- * @author cedric dumoulin
- */
-public class DiContentProviderTest extends AbstractPapyrusTest {
-
- /**
- * The {@link DiContentProvider} under test.
- */
- protected DiContentProvider contentProvider;
-
- /** The FolderModel of the first TabFolder */
- protected ITabFolderModel folderModel;
-
- @Before
- public void setUp() throws Exception {
- IPageModelFactory pageModelFactory = new FakePageModelFactory();
- SashModel diSashModel = DiUtils.createDefaultSashModel();
- contentProvider = new DiContentProvider(diSashModel, pageModelFactory);
- folderModel = lookupFolderModel();
- }
-
- /**
- *
- * @see junit.framework.TestCase#tearDown()
- *
- * @throws Exception
- */
- @After
- public void tearDown() throws Exception {
-
- }
-
- /**
- * Lookup for a folder in the SashModel. Return the first folder found.
- *
- * @return
- */
- private ITabFolderModel lookupFolderModel() {
- if(contentProvider == null) {
- return null;
- }
-
- Object rawModel = contentProvider.getRootModel();
- IAbstractPanelModel panelModel = contentProvider.createChildSashModel(rawModel);
-
- return lookupFolderModel(panelModel);
- }
-
- /**
- * Recursively search in sash models for a FolderModel.
- * Return the first encountered folder.
- *
- * @param panelModel
- * @return
- */
- private ITabFolderModel lookupFolderModel(IAbstractPanelModel panelModel) {
-
- if(panelModel instanceof ITabFolderModel) {
- return (ITabFolderModel)panelModel;
- } else {
- ISashPanelModel sashModel = (ISashPanelModel)panelModel;
- // Iterate on children
- for(Object child : sashModel.getChildren()) {
- IAbstractPanelModel childModel = contentProvider.createChildSashModel(child);
- ITabFolderModel res = lookupFolderModel(childModel);
- if(res != null) {
- return res;
- }
- }
- }
- // Not found
- return null;
- }
-
-
- /**
- * Test a typical life cycle on contentProvider:
- * creation, add change listener, add pages, move page
- */
- @Test
- public void testLifeCycle() {
-
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
-
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Add identifiers
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add 10 folders
- for(int i = 0; i < 10; i++) {
- // reset change count
- changeListener.reset();
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- contentProvider.addPage(id);
-
- // Check fired events
- Assert.assertEquals("One event fired", 1, changeListener.getChangeCount());
- }
-
- // Test moving a page
- changeListener.reset();
- contentProvider.movePage(folderModel, 3, 8);
- // Check fired events
- Assert.assertEquals("One event fired", 1, changeListener.getChangeCount());
-
- }
-
-
-
- /**
- * Test type of the root model.
- * Actually, it should be subtype of AbstractPanel {@link DiContentProvider#getRootModel()}
- */
- @Test
- public void testGetRootModel() {
-
- Assert.assertTrue("subtype of AbstractPanel", AbstractPanel.class.isInstance(contentProvider.getRootModel()));
- }
-
-
- /**
- * Test {@link DiContentProvider#createFolder(ITabFolderModel, int, ITabFolderModel, int)}
- */
- @Test
- public void testCreateFolder() {
-
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Add pages in the model
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add 10 pages
- for(int i = 0; i < 5; i++) {
- // reset change count
- changeListener.reset();
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- contentProvider.addPage(id);
- }
-
- // reset change count
- changeListener.reset();
- // create a folder
- contentProvider.createFolder(folderModel, 3, folderModel, SWT.RIGHT);
- Assert.assertEquals("One event fired", 1, changeListener.getChangeCount());
-
- // Check if pageIdentifier 3 have change of folder
- PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3));
- Assert.assertNotNull("Moved page have a parent", pageRef.getParent());
- Assert.assertNotSame("Moved page is in another parent", ((TabFolderModel)folderModel).getTabFolder(), pageRef.getParent());
-
- // reset change count
- changeListener.reset();
- // Test creating a third folder
- contentProvider.createFolder(folderModel, 2, folderModel, SWT.UP);
- Assert.assertEquals("One event fired", 1, changeListener.getChangeCount());
- // Check if pageIdentifier 2 have change of folder
- pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(2));
- Assert.assertNotNull("Moved page have a parent", pageRef.getParent());
- Assert.assertNotSame("Moved page is in another parent", ((TabFolderModel)folderModel).getTabFolder(), pageRef.getParent());
- }
-
- /**
- * Check if {@link DiContentProvider#setCurrentFolder(Object)}.
- * Check if the method works and DO NO send any event.
- */
- @Test
- @NotImplemented("This test is currently deprecated; current folder cannot be set programmatically")
- public void testSetCurrentFolder() {
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Add pages in the model
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add 10 pages
- for(int i = 0; i < 5; i++) {
- // reset change count
- changeListener.reset();
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- contentProvider.addPage(id);
- }
-
- // reset change count
- changeListener.reset();
- // create a folder
- contentProvider.createFolder(folderModel, 3, folderModel, SWT.RIGHT);
- Assert.assertEquals("One event fired", 1, changeListener.getChangeCount());
-
-
- // Get the real di implementation of the first folder
- TabFolder firstFolder = ((TabFolderModel)folderModel).getTabFolder();
- TabFolder createdDiFolder = contentProvider.getDiSashModel().getCurrentSelection();
-
- // Check if the folder has changed
- Assert.assertNotSame("current folder has change", firstFolder, createdDiFolder);
- // Get the created folder
-
- // Try to change the current selection by setting the first folder again
- changeListener.reset();
- contentProvider.setCurrentFolder(firstFolder);
- // Check if really changed
- Assert.assertEquals("current folder set correctly", firstFolder, contentProvider.getDiSashModel().getCurrentSelection());
- Assert.assertEquals("No event fired", 0, changeListener.getChangeCount());
- }
-
-
- /**
- * Listener on ContentChange.
- *
- * @author dumoulin
- */
- public class ContentChangeListener implements IContentChangedListener {
-
- /** Count number of change event */
- private int changeCount = 0;
-
-
- /**
- * @return the changeCount
- */
- public int getChangeCount() {
- return changeCount;
- }
-
- public void contentChanged(ContentEvent event) {
- changeCount++;
- }
-
- public void reset() {
- changeCount = 0;
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IAbstractPanelModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedListener;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedListener.ContentEvent;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashPanelModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory;
+import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel;
+import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
+import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel;
+import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder;
+import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
+import org.eclipse.papyrus.junit.framework.classification.NotImplemented;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.swt.SWT;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ *
+ * @author cedric dumoulin
+ */
+public class DiContentProviderTest extends AbstractPapyrusTest {
+
+ /**
+ * The {@link DiContentProvider} under test.
+ */
+ protected MyDIContentProvider contentProvider;
+
+ /** The FolderModel of the first TabFolder */
+ protected ITabFolderModel folderModel;
+
+ @Before
+ public void setUp() throws Exception {
+ IPageModelFactory pageModelFactory = new FakePageModelFactory();
+ SashModel diSashModel = DiUtils.createDefaultSashModel();
+ contentProvider = new MyDIContentProvider(diSashModel, pageModelFactory);
+ folderModel = lookupFolderModel();
+ }
+
+ /**
+ *
+ * @see junit.framework.TestCase#tearDown()
+ *
+ * @throws Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ /**
+ * Lookup for a folder in the SashModel. Return the first folder found.
+ *
+ * @return
+ */
+ private ITabFolderModel lookupFolderModel() {
+ if (contentProvider == null) {
+ return null;
+ }
+
+ Object rawModel = contentProvider.getRootModel();
+ IAbstractPanelModel panelModel = contentProvider.createChildSashModel(rawModel);
+
+ return lookupFolderModel(panelModel);
+ }
+
+ /**
+ * Recursively search in sash models for a FolderModel.
+ * Return the first encountered folder.
+ *
+ * @param panelModel
+ * @return
+ */
+ private ITabFolderModel lookupFolderModel(IAbstractPanelModel panelModel) {
+
+ if (panelModel instanceof ITabFolderModel) {
+ return (ITabFolderModel) panelModel;
+ } else {
+ ISashPanelModel sashModel = (ISashPanelModel) panelModel;
+ // Iterate on children
+ for (Object child : sashModel.getChildren()) {
+ IAbstractPanelModel childModel = contentProvider.createChildSashModel(child);
+ ITabFolderModel res = lookupFolderModel(childModel);
+ if (res != null) {
+ return res;
+ }
+ }
+ }
+ // Not found
+ return null;
+ }
+
+
+ /**
+ * Test a typical life cycle on contentProvider:
+ * creation, add change listener, add pages, move page
+ */
+ @Test
+ public void testLifeCycle() {
+
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Add identifiers
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add 10 folders
+ for (int i = 0; i < 10; i++) {
+ // reset change count
+ changeListener.reset();
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ contentProvider.addPage(id);
+
+ // Check fired events
+ Assert.assertEquals("One event fired", 1, changeListener.getChangeCount());
+ }
+
+ // Test moving a page
+ changeListener.reset();
+ contentProvider.movePage(folderModel, 3, 8);
+ // Check fired events
+ Assert.assertEquals("One event fired", 1, changeListener.getChangeCount());
+
+ }
+
+
+
+ /**
+ * Test type of the root model.
+ * Actually, it should be subtype of AbstractPanel {@link DiContentProvider#getRootModel()}
+ */
+ @Test
+ public void testGetRootModel() {
+
+ Assert.assertTrue("subtype of AbstractPanel", AbstractPanel.class.isInstance(contentProvider.getRootModel()));
+ }
+
+
+ /**
+ * Test {@link DiContentProvider#createFolder(ITabFolderModel, int, ITabFolderModel, int)}
+ */
+ @Test
+ public void testCreateFolder() {
+
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Add pages in the model
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add 10 pages
+ for (int i = 0; i < 5; i++) {
+ // reset change count
+ changeListener.reset();
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ contentProvider.addPage(id);
+ }
+
+ // reset change count
+ changeListener.reset();
+ // create a folder
+ contentProvider.createFolder(folderModel, 3, folderModel, SWT.RIGHT);
+ Assert.assertEquals("One event fired", 1, changeListener.getChangeCount());
+
+ // Check if pageIdentifier 3 have change of folder
+ PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3));
+ Assert.assertNotNull("Moved page have a parent", pageRef.getParent());
+ Assert.assertNotSame("Moved page is in another parent", ((TabFolderModel) folderModel).getTabFolder(), pageRef.getParent());
+
+ // reset change count
+ changeListener.reset();
+ // Test creating a third folder
+ contentProvider.createFolder(folderModel, 2, folderModel, SWT.UP);
+ Assert.assertEquals("One event fired", 1, changeListener.getChangeCount());
+ // Check if pageIdentifier 2 have change of folder
+ pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(2));
+ Assert.assertNotNull("Moved page have a parent", pageRef.getParent());
+ Assert.assertNotSame("Moved page is in another parent", ((TabFolderModel) folderModel).getTabFolder(), pageRef.getParent());
+ }
+
+ /**
+ * Check if {@link DiContentProvider#setCurrentFolder(Object)}.
+ * Check if the method works and DO NO send any event.
+ */
+ @Test
+ @NotImplemented("This test is currently deprecated; current folder cannot be set programmatically")
+ public void testSetCurrentFolder() {
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Add pages in the model
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add 10 pages
+ for (int i = 0; i < 5; i++) {
+ // reset change count
+ changeListener.reset();
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ contentProvider.addPage(id);
+ }
+
+ // reset change count
+ changeListener.reset();
+ // create a folder
+ contentProvider.createFolder(folderModel, 3, folderModel, SWT.RIGHT);
+ Assert.assertEquals("One event fired", 1, changeListener.getChangeCount());
+
+
+ // Get the real di implementation of the first folder
+ TabFolder firstFolder = ((TabFolderModel) folderModel).getTabFolder();
+ TabFolder createdDiFolder = contentProvider.getDiSashModel().getCurrentSelection();
+
+ // Check if the folder has changed
+ Assert.assertNotSame("current folder has change", firstFolder, createdDiFolder);
+ // Get the created folder
+
+ // Try to change the current selection by setting the first folder again
+ changeListener.reset();
+ contentProvider.setCurrentFolder(firstFolder);
+ // Check if really changed
+ Assert.assertEquals("current folder set correctly", firstFolder, contentProvider.getDiSashModel().getCurrentSelection());
+ Assert.assertEquals("No event fired", 0, changeListener.getChangeCount());
+ }
+
+
+ /**
+ * Listener on ContentChange.
+ *
+ * @author dumoulin
+ */
+ public class ContentChangeListener implements IContentChangedListener {
+
+ /** Count number of change event */
+ private int changeCount = 0;
+
+
+ /**
+ * @return the changeCount
+ */
+ public int getChangeCount() {
+ return changeCount;
+ }
+
+ public void contentChanged(ContentEvent event) {
+ changeCount++;
+ }
+
+ public void reset() {
+ changeCount = 0;
+ }
+ }
+
+ //
+ // Nested types
+ //
+
+ static class MyDIContentProvider extends DiContentProvider {
+
+ MyDIContentProvider(SashModel diSashModel, IPageModelFactory pageModelFactory) throws IllegalArgumentException {
+ super(diSashModel, pageModelFactory);
+ }
+
+ MyDIContentProvider(SashModel diSashModel, IPageModelFactory pageModelFactory, ContentChangedEventProvider contentChangedEventProvider) throws IllegalArgumentException {
+ super(diSashModel, pageModelFactory, contentChangedEventProvider);
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected SashModel getDiSashModel() {
+ return super.getDiSashModel();
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected ContentChangedEventProvider getContentChangedEventProvider() {
+ return super.getContentChangedEventProvider();
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected void firePropertyChanged(ContentEvent event) {
+ super.firePropertyChanged(event);
+ }
+
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImplTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImplTest.java
index 0e0479fac06..b563cd91000 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImplTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageManagerImplTest.java
@@ -1,487 +1,486 @@
-/*****************************************************************************
- * Copyright (c) 2009, 2016 CEA LIST, LIFL, Christian W. Damus, and others.
- *
- * 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:
- * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IAbstractPanelModel;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashPanelModel;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel;
-import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory;
-import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel;
-import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory;
-import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
-import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
-import org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl;
-import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
-import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
-import org.eclipse.swt.SWT;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * @author dumoulin
- */
-public class PageManagerImplTest extends AbstractPapyrusTest {
-
- /**
- * The {@link PageManagerImpl} under test.
- */
- protected PageManagerImpl pageMngr;
-
- /**
- * The associated {@link DiContentProvider}. Not tested, but used to check events.
- */
- protected DiContentProvider contentProvider;
-
- /**
- * @see junit.framework.TestCase#setUp()
- *
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- SashWindowsMngr diSashModel = DiUtils.createDefaultSashWindowsMngr();
-
- // Fix bug to match refactoring in Bug 429239. The current implementation computes allPages() dynamically,
- // and doesn't support addPage() and removePage() anymore
- // Because this test is used in a different context, where allPages() cannot be computed dynamically,
- // we need to create a specific setup
- diSashModel.setPageList(DiFactory.eINSTANCE.createPageList());
- ContentChangedEventProvider eventProvider = new ContentChangedEventProvider(diSashModel);
- pageMngr = new PageManagerImpl(diSashModel, eventProvider) {
- @Override
- protected boolean isLegacyMode() {
- return true;
- }
- };
-
- IPageModelFactory pageModelFactory = new FakePageModelFactory();
- contentProvider = new DiContentProvider(diSashModel.getSashModel(), pageModelFactory, eventProvider);
-
- }
-
- /**
- * Lookup for a folder in the SashModel. Return the first folder found.
- *
- * @return
- */
- private ITabFolderModel lookupFolderModel() {
- if (contentProvider == null) {
- return null;
- }
-
- Object rawModel = contentProvider.getRootModel();
- // Create the requested model suitable for the folder.
- // It is possible (but not recommended) to create several models for the same object.
- // We can avoid this by using a Map of created models.
- IAbstractPanelModel panelModel = contentProvider.createChildSashModel(rawModel);
-
- return lookupFolderModel(panelModel);
- }
-
- /**
- * Recursively search in sash models for a FolderModel.
- * Return the first encountered folder.
- *
- * @param panelModel
- * @return
- */
- private ITabFolderModel lookupFolderModel(IAbstractPanelModel panelModel) {
-
- if (panelModel instanceof ITabFolderModel) {
- return (ITabFolderModel) panelModel;
- } else {
- ISashPanelModel sashModel = (ISashPanelModel) panelModel;
- // Iterate on children
- for (Object child : sashModel.getChildren()) {
- IAbstractPanelModel childModel = contentProvider.createChildSashModel(child);
- ITabFolderModel res = lookupFolderModel(childModel);
- if (res != null) {
- return res;
- }
- }
- }
- // Not found
- return null;
- }
-
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#addPage(org.eclipse.emf.ecore.EObject)}.
- */
- @Test
- public void testAddPage() {
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
-
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Add identifiers
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add 10 folders
- for (int i = 0; i < 10; i++) {
- // reset change count
- changeListener.reset();
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- pageMngr.addPage(id);
-
- // Check no fired events
- assertEquals("One event fired", 0, changeListener.getChangeCount());
- }
-
- // Check if pages are in PageList
- assertEquals("all pages added", 10, pageMngr.allPages().size());
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#allPages()}.
- */
- @Test
- public void testAllPages() {
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
-
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Add identifiers
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add 10 folders
- for (int i = 0; i < 10; i++) {
- // reset change count
- changeListener.reset();
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- pageMngr.openPage(id);
-
- // Check fired events
- assertEquals("One event fired", 1, changeListener.getChangeCount());
- }
- // Check if pages are in PageList
- assertEquals("all pages found", 10, pageMngr.allPages().size());
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closePage(org.eclipse.emf.ecore.EObject)}.
- */
- @Test
- public void testClosePage() {
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
-
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Add identifiers
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add 10 folders
- for (int i = 0; i < 10; i++) {
- // reset change count
- changeListener.reset();
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- pageMngr.openPage(id);
-
- // Check fired events
- assertEquals("One event fired", 1, changeListener.getChangeCount());
- }
- // Check if pages are in PageList
- assertEquals("all pages added", 10, pageMngr.allPages().size());
-
- // Close page
- changeListener.reset();
- pageMngr.closePage(identifiers.get(3));
-
- // Check fired events
- assertEquals("One event fired", 1, changeListener.getChangeCount());
-
- // Check page still in pages
- assertEquals("all pages still in list", 10, pageMngr.allPages().size());
-
- // Check if pages are in SashStructure
- PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3));
- assertNull("Page removed from sashStructure ", pageRef);
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closeAllOpenedPages())}.
- */
- @Test
- public void testCloseAllOpenedPages() {
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
-
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Add identifiers
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add 10 folders
- for (int i = 0; i < 10; i++) {
- // reset change count
- changeListener.reset();
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- pageMngr.openPage(id);
-
- // Check fired events
- assertEquals("One event fired", 1, changeListener.getChangeCount());
- }
- // Check if pages are in PageList
- assertEquals("all pages added", 10, pageMngr.allPages().size());
-
- // Close page
- changeListener.reset();
- pageMngr.closeAllOpenedPages();
-
- // Check fired events
- assertEquals("One event fired", 1, changeListener.getChangeCount());
-
- // Check page still in pages
- assertEquals("all pages still in list", 10, pageMngr.allPages().size());
-
- // Check if pages are in SashStructure
- for (int i = 0; i < 10; i++) {
- PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(i));
- assertNull("Page " + i + " removed from sashStructure ", pageRef);
- }
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closeAllOpenedPages())}.
- */
- @Test
- public void testCloseOtherOpenedPages() {
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
-
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Add identifiers
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add 10 folders
- for (int i = 0; i < 10; i++) {
- // reset change count
- changeListener.reset();
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- pageMngr.openPage(id);
-
- // Check fired events
- assertEquals("One event fired", 1, changeListener.getChangeCount());
- }
- // Check if pages are in PageList
- assertEquals("all pages added", 10, pageMngr.allPages().size());
-
- // Close page
- changeListener.reset();
- pageMngr.closeOtherPages(identifiers.get(3));
-
- // Check fired events
- assertEquals("One event fired", 1, changeListener.getChangeCount());
-
- // Check page still in pages
- assertEquals("all pages still in list", 10, pageMngr.allPages().size());
-
- // Check if pages are in SashStructure
- for (int i = 0; i < 10; i++) {
- PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(i));
- if (i != 3) {
- assertNull("Page " + i + " removed from sashStructure ", pageRef);
- } else {
- assertNotNull("Page " + i + " not removed from sashStructure ", pageRef);
- }
- }
-
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#openPage(org.eclipse.emf.ecore.EObject)}.
- */
- @Test
- public void testOpenPage() {
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
-
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Add identifiers
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add 10 folders
- for (int i = 0; i < 10; i++) {
- // reset change count
- changeListener.reset();
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- pageMngr.openPage(id);
-
- // Check fired events
- assertEquals("One event fired", 1, changeListener.getChangeCount());
- }
-
- // Check if pages are in PageList
- assertEquals("all pages added", 10, pageMngr.allPages().size());
-
- // Check if pages are in SashStructure
- PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3));
- assertNotNull("Page exist in sashStructure ", pageRef);
- assertSame("found the right page", identifiers.get(3), pageRef.getPageIdentifier());
-
- }
-
- /**
- * Test method for
- * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#removePage(org.eclipse.emf.ecore.EObject)}.
- */
- @Test
- public void testRemovePage() {
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
-
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Add identifiers
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add 10 folders
- for (int i = 0; i < 10; i++) {
- // reset change count
- changeListener.reset();
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- pageMngr.openPage(id);
-
- // Check fired events
- assertEquals("One event fired", 1, changeListener.getChangeCount());
- }
- // Check if pages are in PageList
- assertEquals("all pages added", 10, pageMngr.allPages().size());
- // Check if page id is in page list
- assertTrue("check page id is added to page list", pageMngr.allPages().contains(identifiers.get(3)));
-
- // Close page
- changeListener.reset();
- pageMngr.removePage(identifiers.get(3));
-
- // Check fired events
- assertEquals("One event fired", 1, changeListener.getChangeCount());
-
- // Check page still in pages
- assertEquals("page remove from list", 9, pageMngr.allPages().size());
-
- // Check removed from page list
- assertFalse("check removed from page list", pageMngr.allPages().contains(identifiers.get(3)));
-
- // Check if pages are in SashStructure
- PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3));
- assertNull("Page removed from sashStructure ", pageRef);
- }
-
- /**
- * Check if closing the last page in a second tabfolder work propoerly.
- * Create 3 editors, move one in a new folder, then remove the moved one.
- * The new folder should automatically be removed.
- *
- */
- @Test
- public void testCloseLastPageOfTabFolder() {
- // A listener on change event.
- ContentChangeListener changeListener = new ContentChangeListener();
-
- // Set change listener
- contentProvider.getContentChangedEventProvider().addListener(changeListener);
-
- // Create 3 editors, move one in another table
- // Then remove the moved one.
-
- // Add identifiers
- // Use Object as identifiers.
- List<Object> identifiers = new ArrayList<Object>();
- // Add pages
- int pageCount = 3;
- for (int i = 0; i < pageCount; i++) {
- // Add Editor
- Object id = new Object();
- identifiers.add(id);
- pageMngr.openPage(id);
- }
- // Check if pages are in PageList
- assertEquals("all pages added", pageCount, pageMngr.allPages().size());
-
-
- // Move the last page
- int movedPageIndex = 0;
- ITabFolderModel tabFolder = lookupFolderModel();
- assertTrue("Moved page index is valid", movedPageIndex < pageCount);
-
- contentProvider.createFolder(tabFolder, movedPageIndex, tabFolder, SWT.TOP);
- // check if the folder is created
- // List<?> folders = getAllFolders(contentProvider.getDiSashModel());
- // assertEquals("additional folder is removed", 2, folders.size());
-
- // Close page
- pageMngr.closePage(identifiers.get(movedPageIndex));
-
- // Check the resulting model: we should have one folder with two page.
- // folders = getAllFolders(contentProvider.getDiSashModel());
- // assertEquals("additional folder is removed", 1, folders.size());
-
- List<AbstractPanel> children = contentProvider.getDiSashModel().getWindows().get(0).getChildren();
- assertEquals("Windows has one child", 1, children.size());
- assertEquals("Windows child is the tabfolder", TabFolderImpl.class, children.get(0).getClass());
-
- // Check if pages are in SashStructure
- PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(movedPageIndex));
- assertNull("Page removed from sashStructure ", pageRef);
-
- }
-
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2009, 2016 CEA LIST, LIFL, Christian W. Damus, and others.
+ *
+ * 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:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IAbstractPanelModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashPanelModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.IPageModelFactory;
+import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.DiContentProviderTest.MyDIContentProvider;
+import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel;
+import org.eclipse.papyrus.infra.core.sashwindows.di.DiFactory;
+import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
+import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
+import org.eclipse.papyrus.infra.core.sashwindows.di.impl.TabFolderImpl;
+import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.swt.SWT;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * @author dumoulin
+ */
+public class PageManagerImplTest extends AbstractPapyrusTest {
+
+ /**
+ * The {@link PageManagerImpl} under test.
+ */
+ protected PageManagerImpl pageMngr;
+
+ /**
+ * The associated {@link DiContentProvider}. Not tested, but used to check events.
+ */
+ protected MyDIContentProvider contentProvider;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ *
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ SashWindowsMngr diSashModel = DiUtils.createDefaultSashWindowsMngr();
+
+ // Fix bug to match refactoring in Bug 429239. The current implementation computes allPages() dynamically,
+ // and doesn't support addPage() and removePage() anymore
+ // Because this test is used in a different context, where allPages() cannot be computed dynamically,
+ // we need to create a specific setup
+ diSashModel.setPageList(DiFactory.eINSTANCE.createPageList());
+ ContentChangedEventProvider eventProvider = new ContentChangedEventProvider(diSashModel);
+ pageMngr = new PageManagerImpl(diSashModel, eventProvider) {
+ @Override
+ protected boolean isLegacyMode() {
+ return true;
+ }
+ };
+
+ IPageModelFactory pageModelFactory = new FakePageModelFactory();
+ contentProvider = new MyDIContentProvider(diSashModel.getSashModel(), pageModelFactory, eventProvider);
+
+ }
+
+ /**
+ * Lookup for a folder in the SashModel. Return the first folder found.
+ *
+ * @return
+ */
+ private ITabFolderModel lookupFolderModel() {
+ if (contentProvider == null) {
+ return null;
+ }
+
+ Object rawModel = contentProvider.getRootModel();
+ // Create the requested model suitable for the folder.
+ // It is possible (but not recommended) to create several models for the same object.
+ // We can avoid this by using a Map of created models.
+ IAbstractPanelModel panelModel = contentProvider.createChildSashModel(rawModel);
+
+ return lookupFolderModel(panelModel);
+ }
+
+ /**
+ * Recursively search in sash models for a FolderModel.
+ * Return the first encountered folder.
+ *
+ * @param panelModel
+ * @return
+ */
+ private ITabFolderModel lookupFolderModel(IAbstractPanelModel panelModel) {
+
+ if (panelModel instanceof ITabFolderModel) {
+ return (ITabFolderModel) panelModel;
+ } else {
+ ISashPanelModel sashModel = (ISashPanelModel) panelModel;
+ // Iterate on children
+ for (Object child : sashModel.getChildren()) {
+ IAbstractPanelModel childModel = contentProvider.createChildSashModel(child);
+ ITabFolderModel res = lookupFolderModel(childModel);
+ if (res != null) {
+ return res;
+ }
+ }
+ }
+ // Not found
+ return null;
+ }
+
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#addPage(org.eclipse.emf.ecore.EObject)}.
+ */
+ @Test
+ public void testAddPage() {
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Add identifiers
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add 10 folders
+ for (int i = 0; i < 10; i++) {
+ // reset change count
+ changeListener.reset();
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ pageMngr.addPage(id);
+
+ // Check no fired events
+ assertEquals("One event fired", 0, changeListener.getChangeCount());
+ }
+
+ // Check if pages are in PageList
+ assertEquals("all pages added", 10, pageMngr.allPages().size());
+
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#allPages()}.
+ */
+ @Test
+ public void testAllPages() {
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Add identifiers
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add 10 folders
+ for (int i = 0; i < 10; i++) {
+ // reset change count
+ changeListener.reset();
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ pageMngr.openPage(id);
+
+ // Check fired events
+ assertEquals("One event fired", 1, changeListener.getChangeCount());
+ }
+ // Check if pages are in PageList
+ assertEquals("all pages found", 10, pageMngr.allPages().size());
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closePage(org.eclipse.emf.ecore.EObject)}.
+ */
+ @Test
+ public void testClosePage() {
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Add identifiers
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add 10 folders
+ for (int i = 0; i < 10; i++) {
+ // reset change count
+ changeListener.reset();
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ pageMngr.openPage(id);
+
+ // Check fired events
+ assertEquals("One event fired", 1, changeListener.getChangeCount());
+ }
+ // Check if pages are in PageList
+ assertEquals("all pages added", 10, pageMngr.allPages().size());
+
+ // Close page
+ changeListener.reset();
+ pageMngr.closePage(identifiers.get(3));
+
+ // Check fired events
+ assertEquals("One event fired", 1, changeListener.getChangeCount());
+
+ // Check page still in pages
+ assertEquals("all pages still in list", 10, pageMngr.allPages().size());
+
+ // Check if pages are in SashStructure
+ PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3));
+ assertNull("Page removed from sashStructure ", pageRef);
+
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closeAllOpenedPages())}.
+ */
+ @Test
+ public void testCloseAllOpenedPages() {
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Add identifiers
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add 10 folders
+ for (int i = 0; i < 10; i++) {
+ // reset change count
+ changeListener.reset();
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ pageMngr.openPage(id);
+
+ // Check fired events
+ assertEquals("One event fired", 1, changeListener.getChangeCount());
+ }
+ // Check if pages are in PageList
+ assertEquals("all pages added", 10, pageMngr.allPages().size());
+
+ // Close page
+ changeListener.reset();
+ pageMngr.closeAllOpenedPages();
+
+ // Check fired events
+ assertEquals("One event fired", 1, changeListener.getChangeCount());
+
+ // Check page still in pages
+ assertEquals("all pages still in list", 10, pageMngr.allPages().size());
+
+ // Check if pages are in SashStructure
+ for (int i = 0; i < 10; i++) {
+ PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(i));
+ assertNull("Page " + i + " removed from sashStructure ", pageRef);
+ }
+
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#closeAllOpenedPages())}.
+ */
+ @Test
+ public void testCloseOtherOpenedPages() {
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Add identifiers
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add 10 folders
+ for (int i = 0; i < 10; i++) {
+ // reset change count
+ changeListener.reset();
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ pageMngr.openPage(id);
+
+ // Check fired events
+ assertEquals("One event fired", 1, changeListener.getChangeCount());
+ }
+ // Check if pages are in PageList
+ assertEquals("all pages added", 10, pageMngr.allPages().size());
+
+ // Close page
+ changeListener.reset();
+ pageMngr.closeOtherPages(identifiers.get(3));
+
+ // Check fired events
+ assertEquals("One event fired", 1, changeListener.getChangeCount());
+
+ // Check page still in pages
+ assertEquals("all pages still in list", 10, pageMngr.allPages().size());
+
+ // Check if pages are in SashStructure
+ for (int i = 0; i < 10; i++) {
+ PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(i));
+ if (i != 3) {
+ assertNull("Page " + i + " removed from sashStructure ", pageRef);
+ } else {
+ assertNotNull("Page " + i + " not removed from sashStructure ", pageRef);
+ }
+ }
+
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#openPage(org.eclipse.emf.ecore.EObject)}.
+ */
+ @Test
+ public void testOpenPage() {
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Add identifiers
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add 10 folders
+ for (int i = 0; i < 10; i++) {
+ // reset change count
+ changeListener.reset();
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ pageMngr.openPage(id);
+
+ // Check fired events
+ assertEquals("One event fired", 1, changeListener.getChangeCount());
+ }
+
+ // Check if pages are in PageList
+ assertEquals("all pages added", 10, pageMngr.allPages().size());
+
+ // Check if pages are in SashStructure
+ PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3));
+ assertNotNull("Page exist in sashStructure ", pageRef);
+ assertSame("found the right page", identifiers.get(3), pageRef.getPageIdentifier());
+
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#removePage(org.eclipse.emf.ecore.EObject)}.
+ */
+ @Test
+ public void testRemovePage() {
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Add identifiers
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add 10 folders
+ for (int i = 0; i < 10; i++) {
+ // reset change count
+ changeListener.reset();
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ pageMngr.openPage(id);
+
+ // Check fired events
+ assertEquals("One event fired", 1, changeListener.getChangeCount());
+ }
+ // Check if pages are in PageList
+ assertEquals("all pages added", 10, pageMngr.allPages().size());
+ // Check if page id is in page list
+ assertTrue("check page id is added to page list", pageMngr.allPages().contains(identifiers.get(3)));
+
+ // Close page
+ changeListener.reset();
+ pageMngr.removePage(identifiers.get(3));
+
+ // Check fired events
+ assertEquals("One event fired", 1, changeListener.getChangeCount());
+
+ // Check page still in pages
+ assertEquals("page remove from list", 9, pageMngr.allPages().size());
+
+ // Check removed from page list
+ assertFalse("check removed from page list", pageMngr.allPages().contains(identifiers.get(3)));
+
+ // Check if pages are in SashStructure
+ PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(3));
+ assertNull("Page removed from sashStructure ", pageRef);
+ }
+
+ /**
+ * Check if closing the last page in a second tabfolder work propoerly.
+ * Create 3 editors, move one in a new folder, then remove the moved one.
+ * The new folder should automatically be removed.
+ *
+ */
+ @Test
+ public void testCloseLastPageOfTabFolder() {
+ // A listener on change event.
+ ContentChangeListener changeListener = new ContentChangeListener();
+
+ // Set change listener
+ contentProvider.getContentChangedEventProvider().addListener(changeListener);
+
+ // Create 3 editors, move one in another table
+ // Then remove the moved one.
+
+ // Add identifiers
+ // Use Object as identifiers.
+ List<Object> identifiers = new ArrayList<Object>();
+ // Add pages
+ int pageCount = 3;
+ for (int i = 0; i < pageCount; i++) {
+ // Add Editor
+ Object id = new Object();
+ identifiers.add(id);
+ pageMngr.openPage(id);
+ }
+ // Check if pages are in PageList
+ assertEquals("all pages added", pageCount, pageMngr.allPages().size());
+
+
+ // Move the last page
+ int movedPageIndex = 0;
+ ITabFolderModel tabFolder = lookupFolderModel();
+ assertTrue("Moved page index is valid", movedPageIndex < pageCount);
+
+ contentProvider.createFolder(tabFolder, movedPageIndex, tabFolder, SWT.TOP);
+ // check if the folder is created
+ // List<?> folders = getAllFolders(contentProvider.getDiSashModel());
+ // assertEquals("additional folder is removed", 2, folders.size());
+
+ // Close page
+ pageMngr.closePage(identifiers.get(movedPageIndex));
+
+ // Check the resulting model: we should have one folder with two page.
+ // folders = getAllFolders(contentProvider.getDiSashModel());
+ // assertEquals("additional folder is removed", 1, folders.size());
+
+ List<AbstractPanel> children = contentProvider.getDiSashModel().getWindows().get(0).getChildren();
+ assertEquals("Windows has one child", 1, children.size());
+ assertEquals("Windows child is the tabfolder", TabFolderImpl.class, children.get(0).getClass());
+
+ // Check if pages are in SashStructure
+ PageRef pageRef = contentProvider.getDiSashModel().lookupPage(identifiers.get(movedPageIndex));
+ assertNull("Page removed from sashStructure ", pageRef);
+
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/META-INF/MANIFEST.MF
index efbb9639760..ff298d7c6f3 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/META-INF/MANIFEST.MF
@@ -1,31 +1,31 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui.editors;bundle-version="3.8.0",
- org.eclipse.jface.text;bundle-version="3.8.0",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.core.resources;bundle-version="3.8.0",
- org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
- org.eclipse.ui;bundle-version="3.106.0",
- org.eclipse.ui.workbench.texteditor;bundle-version="3.9.0",
- org.eclipse.core.runtime;bundle-version="3.10.0",
- org.eclipse.emf.ecore;bundle-version="2.11.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.infra.core.sasheditor.contentprovider,
- org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple,
- org.eclipse.papyrus.infra.core.sasheditor.editor,
- org.eclipse.papyrus.infra.core.sasheditor.internal,
- org.eclipse.papyrus.infra.core.sasheditor.pagesmodel,
- org.eclipse.papyrus.infra.core.sasheditor.tests,
- org.eclipse.papyrus.infra.core.sasheditor.tests.texteditor,
- org.eclipse.papyrus.infra.core.sasheditor.tests.utils,
- org.eclipse.papyrus.infra.core.sasheditor.tests.utils.memoryleak,
- org.eclipse.papyrus.infra.core.sasheditor.tests.utils.trace,
- org.eclipse.papyrus.infra.core.sasheditor.utils
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: fragment
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.core.sasheditor.tests;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui.editors;bundle-version="3.8.0",
+ org.eclipse.jface.text;bundle-version="3.8.0",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.core.resources;bundle-version="3.8.0",
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
+ org.eclipse.ui;bundle-version="3.106.0",
+ org.eclipse.ui.workbench.texteditor;bundle-version="3.9.0",
+ org.eclipse.core.runtime;bundle-version="3.10.0",
+ org.eclipse.emf.ecore;bundle-version="2.11.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0"
+Export-Package: org.eclipse.papyrus.infra.core.sasheditor.contentprovider,
+ org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple,
+ org.eclipse.papyrus.infra.core.sasheditor.editor,
+ org.eclipse.papyrus.infra.core.sasheditor.internal,
+ org.eclipse.papyrus.infra.core.sasheditor.pagesmodel,
+ org.eclipse.papyrus.infra.core.sasheditor.tests,
+ org.eclipse.papyrus.infra.core.sasheditor.tests.texteditor,
+ org.eclipse.papyrus.infra.core.sasheditor.tests.utils,
+ org.eclipse.papyrus.infra.core.sasheditor.tests.utils.memoryleak,
+ org.eclipse.papyrus.infra.core.sasheditor.tests.utils.trace,
+ org.eclipse.papyrus.infra.core.sasheditor.utils
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.core.sasheditor.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/build.properties b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/build.properties
index 266dcb24bf6..4cedaeae848 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/build.properties
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/build.properties
@@ -1,8 +1,8 @@
-source.. = test/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- org.eclipse.papyrus.infra.core.sasheditor.tests.launch,\
- fragment.properties,\
- about.html,\
- fragment.xml
+source.. = test/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ org.eclipse.papyrus.infra.core.sasheditor.tests.launch,\
+ plugin.properties,\
+ about.html,\
+ plugin.xml
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/fragment.properties b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/plugin.properties
index 195f10e33bb..195f10e33bb 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/fragment.properties
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/plugin.properties
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/fragment.xml b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/plugin.xml
index 882b613cbe1..882b613cbe1 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/fragment.xml
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.sasheditor.tests/plugin.xml
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/.classpath b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/.classpath
index 83be1d9f78c..e5fa400a126 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/.classpath
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/.classpath
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/papyrus/infra/core/internal/**"/>
+ </accessrules>
+ </classpathentry>
<classpathentry kind="src" path="test"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF
index becb4098f0f..69403e3c645 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF
@@ -1,15 +1,15 @@
-Manifest-Version: 1.0
-Require-Bundle: org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.utils;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.infra.core.resource,
- org.eclipse.papyrus.infra.core.services,
- org.eclipse.papyrus.infra.core.tests
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.infra.core;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: fragment
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.core.tests;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Manifest-Version: 1.0
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.2.0"
+Export-Package: org.eclipse.papyrus.infra.core.resource,
+ org.eclipse.papyrus.infra.core.services,
+ org.eclipse.papyrus.infra.core.tests
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.core.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/build.properties b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/build.properties
index 2d904971187..abe693aba0b 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/build.properties
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/build.properties
@@ -1,9 +1,9 @@
-source.. = test/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- fragment.properties,\
- fragment.xml,\
- resources/
-src.includes = about.html
+source.. = test/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties,\
+ plugin.xml,\
+ resources/
+src.includes = about.html
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/fragment.properties b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/plugin.properties
index d2860c1b07d..d2860c1b07d 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/fragment.properties
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/plugin.properties
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/fragment.xml b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/plugin.xml
index 4be7351f353..4be7351f353 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/fragment.xml
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/plugin.xml
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/FakeModel.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/FakeModel.java
index 5d1ac8edb78..0f6c114bdcd 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/FakeModel.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/resource/FakeModel.java
@@ -8,7 +8,7 @@
*
* Contributors:
* LIFL - Initial API and implementation
- * Christian W. Damus - bug 485220
+ * Christian W. Damus - bugs 485220, 488791
*
*****************************************************************************/
package org.eclipse.papyrus.infra.core.resource;
@@ -22,7 +22,7 @@ import org.eclipse.emf.ecore.EObject;
public class FakeModel extends AbstractBaseModel {
private String identifier;
-
+
public FakeModel(String identifier) {
this.identifier = identifier;
}
@@ -59,5 +59,9 @@ public class FakeModel extends AbstractBaseModel {
throw new IllegalArgumentException("cannot persist " + object); //$NON-NLS-1$
}
-
+ // Overridden to make it accessible
+ @Override
+ protected ModelSet getModelManager() {
+ return super.getModelManager();
+ }
}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/services/ComposedServiceTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/services/ComposedServiceTest.java
index 60ad2540ea7..7492d60c2e4 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/services/ComposedServiceTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/services/ComposedServiceTest.java
@@ -1,142 +1,156 @@
-package org.eclipse.papyrus.infra.core.services;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-public class ComposedServiceTest extends AbstractPapyrusTest {
-
- private FakeComposedService masterService;
-
-
- @Before
- public void setUp() throws Exception {
- masterService = new FakeComposedService();
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testAddServicePart() {
- FakeComposedServicePartA partA = new FakeComposedServicePartA();
- FakeComposedServicePartB partB = new FakeComposedServicePartB();
-
- masterService.addServicePart(partA);
- masterService.addServicePart(partB);
-
- List<?> addedParts = masterService.getRegisteredServices();
-
- assertTrue("service contains partA", addedParts.contains(partA));
- assertTrue("service contains partB", addedParts.contains(partB));
- }
-
- @Test
- public void testRemoveServicePart() {
- FakeComposedServicePartA partA = new FakeComposedServicePartA();
- FakeComposedServicePartB partB = new FakeComposedServicePartB();
-
- masterService.addServicePart(partA);
- masterService.addServicePart(partB);
-
- List<?> addedParts = masterService.getRegisteredServices();
-
- assertTrue("service contains partA", addedParts.contains(partA));
- assertTrue("service contains partB", addedParts.contains(partB));
-
- masterService.removeServicePart(partA);
- assertFalse("service contains partA", addedParts.contains(partA));
- assertTrue("service contains partB", addedParts.contains(partB));
-
- }
-
- /**
- * Test that the parts registered to the ServiceRegistry are automaticly
- * registered to there associated main service when registry is started.
- *
- * @throws ServiceException
- */
- @Test
- public void testPartAutomaticRegistration() throws ServiceException {
-
- ServicesRegistry serviceRegistry = new ServicesRegistry();
-
- // Register services
- serviceRegistry.add(new ComposedServiceDescriptor());
- serviceRegistry.add(new ServicePartADescriptor());
- serviceRegistry.add(new ServicePartBDescriptor());
-
- // start registry
- serviceRegistry.startRegistry();
-
- // Check if connected
- FakeComposedService masterService = serviceRegistry.getService(FakeComposedService.class);
- FakeComposedServicePartA partA = serviceRegistry.getService(FakeComposedServicePartA.class);
- FakeComposedServicePartB partB = serviceRegistry.getService(FakeComposedServicePartB.class);
-
- List<?> addedParts = masterService.getRegisteredServices();
-
- assertNotNull("master service found", masterService);
- assertTrue("service contains partA", addedParts.contains(partA));
- assertTrue("service contains partB", addedParts.contains(partB));
-
-
- }
-
-
- /* ***************************** */
-
- /**
- * A descriptor
- *
- * @author dumoulin
- *
- */
- public class ServicePartADescriptor extends ServiceDescriptor {
-
-
- public ServicePartADescriptor() {
- super(FakeComposedServicePartA.class, FakeComposedServicePartA.class.getName(), ServiceStartKind.STARTUP, 1);
- }
- }
-
-
- /**
- * A descriptor
- *
- * @author dumoulin
- *
- */
- public class ServicePartBDescriptor extends ServiceDescriptor {
-
-
- public ServicePartBDescriptor() {
- super(FakeComposedServicePartB.class, FakeComposedServicePartB.class.getName(), ServiceStartKind.STARTUP, 1);
- }
- }
-
- /**
- * A descriptor
- *
- * @author dumoulin
- *
- */
- public class ComposedServiceDescriptor extends ServiceDescriptor {
-
-
- public ComposedServiceDescriptor() {
- super(FakeComposedService.class, FakeComposedService.class.getName(), ServiceStartKind.STARTUP, 1);
- }
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2016 LIFL, CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * LIFL - Initial API and implementation
+ * Christian W. Damus - bug 488791
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.services;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.eclipse.papyrus.infra.core.services.ServicesRegistryTest.TestServiceDescriptor;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class ComposedServiceTest extends AbstractPapyrusTest {
+
+ private FakeComposedService masterService;
+
+
+ @Before
+ public void setUp() throws Exception {
+ masterService = new FakeComposedService();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testAddServicePart() {
+ FakeComposedServicePartA partA = new FakeComposedServicePartA();
+ FakeComposedServicePartB partB = new FakeComposedServicePartB();
+
+ masterService.addServicePart(partA);
+ masterService.addServicePart(partB);
+
+ List<?> addedParts = masterService.getRegisteredServices();
+
+ assertTrue("service contains partA", addedParts.contains(partA));
+ assertTrue("service contains partB", addedParts.contains(partB));
+ }
+
+ @Test
+ public void testRemoveServicePart() {
+ FakeComposedServicePartA partA = new FakeComposedServicePartA();
+ FakeComposedServicePartB partB = new FakeComposedServicePartB();
+
+ masterService.addServicePart(partA);
+ masterService.addServicePart(partB);
+
+ List<?> addedParts = masterService.getRegisteredServices();
+
+ assertTrue("service contains partA", addedParts.contains(partA));
+ assertTrue("service contains partB", addedParts.contains(partB));
+
+ masterService.removeServicePart(partA);
+ assertFalse("service contains partA", addedParts.contains(partA));
+ assertTrue("service contains partB", addedParts.contains(partB));
+
+ }
+
+ /**
+ * Test that the parts registered to the ServiceRegistry are automaticly
+ * registered to there associated main service when registry is started.
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testPartAutomaticRegistration() throws ServiceException {
+
+ ServicesRegistry serviceRegistry = new ServicesRegistry();
+
+ // Register services
+ serviceRegistry.add(new ComposedServiceDescriptor());
+ serviceRegistry.add(new ServicePartADescriptor());
+ serviceRegistry.add(new ServicePartBDescriptor());
+
+ // start registry
+ serviceRegistry.startRegistry();
+
+ // Check if connected
+ FakeComposedService masterService = serviceRegistry.getService(FakeComposedService.class);
+ FakeComposedServicePartA partA = serviceRegistry.getService(FakeComposedServicePartA.class);
+ FakeComposedServicePartB partB = serviceRegistry.getService(FakeComposedServicePartB.class);
+
+ List<?> addedParts = masterService.getRegisteredServices();
+
+ assertNotNull("master service found", masterService);
+ assertTrue("service contains partA", addedParts.contains(partA));
+ assertTrue("service contains partB", addedParts.contains(partB));
+
+
+ }
+
+
+ /* ***************************** */
+
+ /**
+ * A descriptor
+ *
+ * @author dumoulin
+ *
+ */
+ public class ServicePartADescriptor extends TestServiceDescriptor {
+
+
+ public ServicePartADescriptor() {
+ super(FakeComposedServicePartA.class, FakeComposedServicePartA.class.getName(), ServiceStartKind.STARTUP, 1);
+ }
+ }
+
+
+ /**
+ * A descriptor
+ *
+ * @author dumoulin
+ *
+ */
+ public class ServicePartBDescriptor extends TestServiceDescriptor {
+
+
+ public ServicePartBDescriptor() {
+ super(FakeComposedServicePartB.class, FakeComposedServicePartB.class.getName(), ServiceStartKind.STARTUP, 1);
+ }
+ }
+
+ /**
+ * A descriptor
+ *
+ * @author dumoulin
+ *
+ */
+ public class ComposedServiceDescriptor extends TestServiceDescriptor {
+
+
+ public ComposedServiceDescriptor() {
+ super(FakeComposedService.class, FakeComposedService.class.getName(), ServiceStartKind.STARTUP, 1);
+ }
+ }
+
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/services/ServicesRegistryTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/services/ServicesRegistryTest.java
index 5e6f4ab6263..25c620d9ed8 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/services/ServicesRegistryTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/services/ServicesRegistryTest.java
@@ -1,794 +1,846 @@
-/**
- *
- */
-package org.eclipse.papyrus.infra.core.services;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.papyrus.infra.core.services.FakeServiceFactory.FakeCreatedService;
-import org.eclipse.papyrus.infra.core.services.ServiceA.TraceKind;
-import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * @author dumoulin
- *
- */
-public class ServicesRegistryTest extends AbstractPapyrusTest {
-
- /** The registry to test */
- ServicesRegistry servicesRegistry;
-
- ServiceDescriptor serviceADesc = new LazyServiceADescriptor();
-
- ServiceDescriptor serviceA10Desc = new LazyServiceA10Descriptor();
-
- ServiceDescriptor serviceBDesc = new LazyServiceBDescriptor();
-
- ServiceDescriptor serviceCDesc = new ServiceCDescriptor();
-
- ServiceDescriptor servicePojoADesc = new LazyServicePojoADescriptor();
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- servicesRegistry = new ServicesRegistry();
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.infra.core.services.ServicesRegistry#add(org.eclipse.papyrus.infra.core.services.ServiceDescriptor)}
- * .
- *
- * @throws ServiceMultiException
- */
- @Test
- public void testAdd() throws ServiceMultiException {
-
- servicesRegistry.add(serviceADesc);
- servicesRegistry.add(serviceBDesc);
- servicesRegistry.add(serviceCDesc);
- servicesRegistry.add(servicePojoADesc);
-
- // Test entries creation
- // try {
- // assertFalse("serviceA stopped", servicesRegistry.isStarted(serviceADesc.getKey()));
- // assertFalse("serviceB stopped", servicesRegistry.isStarted(serviceBDesc.getKey()));
- // assertFalse("serviceC stopped", servicesRegistry.isStarted(serviceCDesc.getKey()));
- // assertFalse("servicePojoA stopped", servicesRegistry.isStarted(servicePojoADesc.getKey()));
- // } catch (ServiceNotFoundException e) {
- // fail("Service should exist." + e.getMessage());
- // }
-
- // Test startup
- servicesRegistry.startRegistry();
-
- // Test always started
- try {
- assertFalse("serviceA stopped", servicesRegistry.isStarted(serviceADesc.getKey()));
- assertFalse("serviceB stopped", servicesRegistry.isStarted(serviceBDesc.getKey()));
- assertEquals("serviceC state", ServiceState.started, servicesRegistry.serviceState(serviceCDesc.getKey()));
- assertTrue("serviceC started", servicesRegistry.isStarted(serviceCDesc.getKey()));
- assertFalse("servicePojoA stopped", servicesRegistry.isStarted(servicePojoADesc.getKey()));
- } catch (ServiceNotFoundException e) {
- fail("Service should exist.");
- }
-
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.infra.core.services.ServicesRegistry#getService(java.lang.Object)}.
- *
- * @throws ServiceException
- */
- @Test
- public void testGetService() throws ServiceException {
- servicesRegistry.add(serviceADesc);
- servicesRegistry.add(serviceBDesc);
- servicesRegistry.add(serviceCDesc);
- servicesRegistry.add(servicePojoADesc);
-
-
- servicesRegistry.startRegistry();
-
- // Test lazy service
- Object serviceA = servicesRegistry.getService(serviceADesc.getKey());
- assertNotNull("service created", serviceA);
- assertEquals("right class", ServiceA.class, serviceA.getClass());
-
- Object serviceA2 = servicesRegistry.getService(serviceADesc.getKey());
- assertEquals("Second retrieve get the same service", serviceA, serviceA2);
-
- // test startup service
- Object serviceC = servicesRegistry.getService(serviceCDesc.getKey());
- assertNotNull("service created", serviceC);
- assertEquals("right class", ServiceC.class, serviceC.getClass());
-
- Object serviceC2 = servicesRegistry.getService(serviceCDesc.getKey());
- assertEquals("Second retrieve get the same service", serviceC, serviceC2);
-
- // test pojo service
- Object servicePojo = servicesRegistry.getService(servicePojoADesc.getKey());
- assertNotNull("service created", servicePojo);
- assertEquals("right class", ServicePojoA.class, servicePojo.getClass());
-
- Object servicePojo2 = servicesRegistry.getService(servicePojoADesc.getKey());
- assertEquals("Second retrieve get the same service", servicePojo, servicePojo2);
-
-
- }
-
- /**
- * Test method for {@link org.eclipse.papyrus.infra.core.services.ServicesRegistry#getService(java.lang.Object)}.
- *
- * @throws ServiceException
- */
- @Test
- public void testGetServiceByClass() throws ServiceException {
- servicesRegistry.add(serviceADesc);
- servicesRegistry.add(serviceBDesc);
- servicesRegistry.add(serviceCDesc);
- servicesRegistry.add(servicePojoADesc);
-
-
- servicesRegistry.startRegistry();
-
- // Test lazy service
- ServiceA serviceA = servicesRegistry.getService(ServiceA.class);
- assertNotNull("service created", serviceA);
- assertEquals("right class", ServiceA.class, serviceA.getClass());
-
- ServiceA serviceA2 = servicesRegistry.getService(ServiceA.class);
- assertEquals("Second retrieve get the same service", serviceA, serviceA2);
-
- // test startup service
- ServiceC serviceC = servicesRegistry.getService(ServiceC.class);
- assertNotNull("service created", serviceC);
- assertEquals("right class", ServiceC.class, serviceC.getClass());
-
- // test pojo service
- ServicePojoA servicePojo = servicesRegistry.getService(ServicePojoA.class);
- assertNotNull("service created", servicePojo);
- assertEquals("right class", ServicePojoA.class, servicePojo.getClass());
-
- Object servicePojo2 = servicesRegistry.getService(ServicePojoA.class);
- assertEquals("Second retrieve get the same service", servicePojo, servicePojo2);
-
-
- }
-
- /**
- * Try to register 2 services under the same name, but with different priorities.
- *
- * @throws ServiceException
- */
- @Test
- public void testPriority() throws ServiceException {
- servicesRegistry.add(serviceADesc);
- servicesRegistry.add(serviceA10Desc);
- servicesRegistry.add(serviceBDesc);
-
- // Test creation
- // try {
- // assertFalse("serviceA stopped", servicesRegistry.isStarted(serviceADesc.getKey()));
- // assertFalse("serviceB stopped", servicesRegistry.isStarted(serviceBDesc.getKey()));
- // } catch (ServiceNotFoundException e) {
- // fail("Service should exist.");
- // }
-
- servicesRegistry.startRegistry();
-
- Object serviceA = servicesRegistry.getService(serviceADesc.getKey());
-
- assertNotNull("Service created", serviceA);
- assertEquals("right class", ServiceA10.class, serviceA.getClass());
-
-
- }
-
- /**
- * Test add for a direct instance of service.
- *
- * @throws ServiceException
- */
- @Test
- public void testAddDirectInstance() throws ServiceException {
- IService instanciatedService = new ServiceA();
- String key = instanciatedService.getClass().getName();
-
- servicesRegistry.add(key, 1, instanciatedService);
-
- servicesRegistry.add(serviceCDesc);
- servicesRegistry.add(serviceBDesc);
-
- servicesRegistry.startRegistry();
-
- Object serviceA = servicesRegistry.getService(key);
-
- assertNotNull("Service created", serviceA);
- assertEquals("right object", instanciatedService, serviceA);
- assertEquals("right class", ServiceA.class, serviceA.getClass());
-
-
- }
-
- /**
- * Test life cycle for directly registered services
- *
- * @throws ServiceException
- */
- @Test
- public void testCallsOrder() throws ServiceException {
- // Register services as STARTUP !
- servicesRegistry.add(ServiceA.class, 1, new ServiceA());
- // Lazy - generate no trace
- servicesRegistry.add(ServiceB.class, 1, new ServiceB(), ServiceStartKind.LAZY);
- servicesRegistry.add(ServiceC.class, 1, new ServiceC());
- servicesRegistry.add(ServicePojoA.class, 1, new ServicePojoA());
-
-
- ServiceA.resetTrace();
- servicesRegistry.startRegistry();
-
- // Check orders
- //
- int i = 0;
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
- // assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
-
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
- // assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
-
- // Now, start lazy service
- ServiceB service = servicesRegistry.getService(ServiceB.class);
- assertNotNull("service found", service);
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
-
-
- // Check dispose
- servicesRegistry.disposeRegistry();
- assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
- // assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
-
- //
- }
-
- /**
- * Test life cycle for services registered wih descriptors
- *
- * @throws ServiceException
- */
- @Test
- public void testCallsOrderForDescriptors() throws ServiceException {
- // Register services as STARTUP !
- // Lazy - generate no trace
- servicesRegistry.add(new LazyServiceBDescriptor());
- servicesRegistry.add(new ServiceCDescriptor());
-
-
- ServiceA.resetTrace();
- servicesRegistry.startRegistry();
-
- // Check orders
- //
- int i = 0;
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
- // assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
-
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
- // assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
-
- // Now, start lazy service
- ServiceB service = (ServiceB)servicesRegistry.getService(ServiceB.class.getName());
- assertNotNull("service found", service);
- assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
-
-
- // Check dispose
- servicesRegistry.disposeRegistry();
- assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
- assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
- // assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
-
- //
- }
-
- /**
- * Test the start order for services of type Start and Service
- *
- * @throws ServiceException
- */
- @Test
- public void testStartDependantOrder() throws ServiceException {
-
- String A = "A";
- String B = "B";
- String C = "C";
- String D = "D";
- String E = "E";
- // String F = "F";
-
- // Create services E --> D --> C --> B --> A
- FakeService.getTrace().reset();
-
- servicesRegistry.add(new ServiceDesc(E, ServiceStartKind.STARTUP, Arrays.asList(D)));
- servicesRegistry.add(new ServiceDesc(D, ServiceStartKind.STARTUP, Arrays.asList(C)));
- servicesRegistry.add(new ServiceDesc(C, ServiceStartKind.STARTUP, Arrays.asList(B)));
- servicesRegistry.add(new ServiceDesc(B, ServiceStartKind.STARTUP, Arrays.asList(A)));
- servicesRegistry.add(new ServiceDesc(A, ServiceStartKind.STARTUP));
- // servicesRegistry.add( new ServiceDesc( F, ServiceStartKind.STARTUP, Arrays.asList(E) ));
-
- // Start services
- servicesRegistry.startRegistry();
-
- // check services
- assertTrue("service started", servicesRegistry.isStarted(A));
- assertTrue("service started", servicesRegistry.isStarted(B));
- assertNotSame("services are different", servicesRegistry.getService(A), servicesRegistry.getService(B));
-
- // Get names of created services
- String nameA = ((FakeService)servicesRegistry.getService(A)).getName();
- String nameB = ((FakeService)servicesRegistry.getService(B)).getName();
- String nameC = ((FakeService)servicesRegistry.getService(C)).getName();
- String nameD = ((FakeService)servicesRegistry.getService(D)).getName();
- String nameE = ((FakeService)servicesRegistry.getService(E)).getName();
- // String nameF = ((FakeService)servicesRegistry.getService(F)).getName();
-
-
- // check order (E and F order are not guaranteed)
- // order should be A, B, C, D, E
- TestTrace trace = FakeService.getTrace();
- int i = 0;
- // assertEquals("order", nameF + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameD + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameE + ",create", trace.getNameTrace(i++));
-
- // assertEquals("order", nameF + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameD + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameE + ",init", trace.getNameTrace(i++));
-
- // assertEquals("order", nameF + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameD + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameE + ",start", trace.getNameTrace(i++));
-
- }
-
- /**
- * Start regular services, then add a new service and try to start it.
- * This should work.
- *
- * @throws ServiceException
- */
- @Test
- public void testStartRegistryAndThenAddNewServiceAndStartIt() throws ServiceException {
-
- // Register some services
- String A = "A";
- String B = "B";
- String C = "C";
- servicesRegistry.add(new ServiceFactoryDesc(C, ServiceStartKind.STARTUP));
- servicesRegistry.add(new ServiceFactoryDesc(B, ServiceStartKind.STARTUP, Arrays.asList(C)));
- servicesRegistry.add(new ServiceFactoryDesc(A, ServiceStartKind.STARTUP, Arrays.asList(B)));
-
- // Start them
- servicesRegistry.startRegistry();
-
- // Register another services as pojo
- IService instanciatedService = new ServiceA();
- String key = instanciatedService.getClass().getName();
- servicesRegistry.add(key, 1, instanciatedService);
-
- // Try to start it
- servicesRegistry.startServices(key);
-
- // check services
- assertTrue("service started", servicesRegistry.isStarted(A));
- assertTrue("service started", servicesRegistry.isStarted(B));
- assertTrue("service started", servicesRegistry.isStarted(C));
-
- assertTrue("service started", servicesRegistry.isStarted(key));
-
- assertEquals("get registered service", instanciatedService, servicesRegistry.getService(key));
-
- }
-
- /**
- * Test Service Factory creation
- *
- * @throws ServiceException
- */
- @Test
- public void testServiceFactoryCreation() throws ServiceException {
-
- String A = "A";
- String B = "B";
- String C = "C";
-
- // Create services
- FakeService.getTrace().reset();
-
- servicesRegistry.add(new ServiceFactoryDesc(C, ServiceStartKind.STARTUP));
- servicesRegistry.add(new ServiceFactoryDesc(B, ServiceStartKind.STARTUP, Arrays.asList(C)));
- servicesRegistry.add(new ServiceFactoryDesc(A, ServiceStartKind.STARTUP, Arrays.asList(B)));
-
- // Start services
- servicesRegistry.startRegistry();
-
- // check services
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(A).getClass());
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(B).getClass());
-
- // Get names of created services
- String nameA = ((FakeCreatedService)servicesRegistry.getService(A)).getName();
- String nameB = ((FakeCreatedService)servicesRegistry.getService(B)).getName();
- String nameC = ((FakeCreatedService)servicesRegistry.getService(C)).getName();
-
-
- // check order
- // Order should be: C, B, A
- TestTrace trace = FakeService.getTrace();
- int i = 0;
- assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
-
- // next order is the order of getService()
- assertEquals("order", nameA + ",createInstance", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",createInstance", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
- }
-
- /**
- * Test Creation of Service Factory used with class as key.
- *
- * @throws ServiceException
- */
- @Test
- public void testServiceFactoryWithClassKey() throws ServiceException {
-
- //
- Class<?> A = ServiceA.class;
- Class<?> B = ServiceB.class;
- Class<?> C = ServiceC.class;
-
- // Specify service types as String
- String serviceClassname1 = FakeServiceFactory.class.getName();;
- String serviceClassname2 = FakeServiceFactory.class.getName();
- String serviceClassname3 = FakeServiceFactory.class.getName();
-
- // Create services
- FakeService.getTrace().reset();
-
- servicesRegistry.add(new ServiceFactoryDesc(C, serviceClassname3, ServiceStartKind.STARTUP));
- servicesRegistry.add(new ServiceFactoryDesc(B, serviceClassname2, ServiceStartKind.STARTUP, Arrays.asList(C.getName())));
- servicesRegistry.add(new ServiceFactoryDesc(A, serviceClassname1, ServiceStartKind.STARTUP, Arrays.asList(B.getName())));
-
- // Start services
- servicesRegistry.startRegistry();
-
- // check services
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(A).getClass());
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(B).getClass());
-
- // Get names of created services
- String nameA = ((FakeCreatedService)servicesRegistry.getService(A)).getName();
- String nameB = ((FakeCreatedService)servicesRegistry.getService(B)).getName();
- String nameC = ((FakeCreatedService)servicesRegistry.getService(C)).getName();
-
-
- // check order (E and F order are not guaranteed)
- // Order should be
- TestTrace trace = FakeService.getTrace();
- int i = 0;
- assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
-
- // next order is the order of getService()
- assertEquals("order", nameA + ",createInstance", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",createInstance", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
- }
-
- /**
- * Test Service Factory creation order.
- * One of the factory try to get the required service from its init() method.
- *
- * @throws ServiceException
- */
- @Test
- public void testServiceFactoryWithRequiredInInit() throws ServiceException {
-
- String A = "A";
- String B = "B";
- String C = "C";
-
- // Create services C --> A --> B
- FakeService.getTrace().reset();
-
- // FakeWithRequiredServiceFactory try to retrieve service "C"
- servicesRegistry.add(new ServiceFactoryDesc(B, FakeWithRequiredServiceFactory.class.getName(), ServiceStartKind.STARTUP, 1, Arrays.asList(C)));
- servicesRegistry.add(new ServiceFactoryDesc(A, FakeWithRequiredServiceFactory.class.getName(), ServiceStartKind.STARTUP, 1, Arrays.asList(B, C)));
- servicesRegistry.add(new ServiceFactoryDesc(C, FakeServiceFactory.class.getName(), ServiceStartKind.STARTUP, 1));
-
- // Start services
- servicesRegistry.startRegistry();
-
- // check services
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(A).getClass());
- assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(B).getClass());
-
- // Get names of created services
- String nameA = ((FakeCreatedService)servicesRegistry.getService(A)).getName();
- String nameB = ((FakeCreatedService)servicesRegistry.getService(B)).getName();
- String nameC = ((FakeCreatedService)servicesRegistry.getService(C)).getName();
-
-
- // check order
- // Order should be: C, B, A
- TestTrace trace = FakeService.getTrace();
- int i = 0;
- assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
- assertEquals("value", servicesRegistry.getService(C), trace.getValue(i));
- assertEquals("order", nameB + ",initEnd", trace.getNameTrace(i++));
-
- assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",initEnd", trace.getNameTrace(i++));
-
- assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
-
- // next order is the order of getService()
- assertEquals("order", nameA + ",createInstance", trace.getNameTrace(i++));
- // assertEquals("order", nameB + ",createInstance", trace.getNameTrace(i++));
- // assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
- }
-
- /**
- * Test {@link ServicesRegistry#startServicesByClassKeys(List)}.
- * Check that services are started.
- *
- * @throws ServiceException
- */
- @Test
- public void testStartService() throws ServiceException {
-
- String A = "A";
- String B = "B";
- String C = "C";
- String D = "D";
- String E = "E";
-
- // Create services E --> D --> C --> B --> A
- FakeService.getTrace().reset();
-
- servicesRegistry.add(new ServiceDesc(E, ServiceStartKind.STARTUP, Arrays.asList(D)));
- servicesRegistry.add(new ServiceDesc(D, ServiceStartKind.STARTUP, Arrays.asList(C)));
- servicesRegistry.add(new ServiceDesc(C, ServiceStartKind.STARTUP, Arrays.asList(A, B)));
- servicesRegistry.add(new ServiceDesc(B, ServiceStartKind.STARTUP, Arrays.asList(A)));
- servicesRegistry.add(new ServiceDesc(A, ServiceStartKind.STARTUP));
-
- // Start services
- servicesRegistry.startServices(Arrays.asList(C));
-
- // check services
- assertTrue("service started", servicesRegistry.isStarted(A));
- assertTrue("service started", servicesRegistry.isStarted(B));
- assertTrue("service started", servicesRegistry.isStarted(C));
-
- // Get names of created services
- String nameA = ((FakeService)servicesRegistry.getService(A)).getName();
- String nameB = ((FakeService)servicesRegistry.getService(B)).getName();
- String nameC = ((FakeService)servicesRegistry.getService(C)).getName();
- // String nameD = ((FakeService)servicesRegistry.getService(D)).getName();
- // String nameE = ((FakeService)servicesRegistry.getService(E)).getName();
- // String nameF = ((FakeService)servicesRegistry.getService(F)).getName();
-
-
- // check order (E and F order are not guaranteed)
- // order should be A, B, C
- TestTrace trace = FakeService.getTrace();
- int i = 0;
- assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
- // assertEquals("order", nameD + ",create", trace.getNameTrace(i++));
- // assertEquals("order", nameE + ",create", trace.getNameTrace(i++));
-
- assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
- // assertEquals("order", nameD + ",init", trace.getNameTrace(i++));
- // assertEquals("order", nameE + ",init", trace.getNameTrace(i++));
-
- assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
- assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
- // assertEquals("order", nameD + ",start", trace.getNameTrace(i++));
- // assertEquals("order", nameE + ",start", trace.getNameTrace(i++));
-
- }
-
- /* **************************************** */
-
-
-
-
-
- /**
- * General purpose descriptor.
- */
- public class ServiceDesc extends ServiceDescriptor {
-
-
- public ServiceDesc(String key, ServiceStartKind startKind) {
- super(key, FakeService.class.getName(), startKind, 1);
- }
-
- public ServiceDesc(String key, ServiceStartKind startKind, List<String> requiredService) {
- super(key, FakeService.class.getName(), startKind, 1, requiredService);
- }
- }
-
- /**
- * General purpose descriptor.
- */
- public class ServiceFactoryDesc extends ServiceDescriptor {
-
-
- public ServiceFactoryDesc(String key, ServiceStartKind startKind) {
- super(key, FakeServiceFactory.class.getName(), startKind, 1);
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
-
- public ServiceFactoryDesc(String key, ServiceStartKind startKind, List<String> requiredService) {
- super(key, FakeServiceFactory.class.getName(), startKind, 1, requiredService);
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
-
- /**
- * Constructor with a classname and {@link ServiceDescriptor#isStartAtStartup()} = true.
- * Constructor.
- *
- * @param key
- * @param startKind
- * @param requiredService
- */
- public ServiceFactoryDesc(Class<?> key, String classname, ServiceStartKind startKind, List<String> requiredService) {
- super(key, classname, startKind, 1, requiredService);
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
-
- /**
- * Constructor with a classname and {@link ServiceDescriptor#isStartAtStartup()} = true.
- * Constructor.
- *
- * @param key
- * @param startKind
- * @param requiredService
- */
- public ServiceFactoryDesc(Class<?> key, String classname, ServiceStartKind startKind) {
- super(key, classname, startKind, 1);
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
-
- public ServiceFactoryDesc(String key, String serviceClassname, ServiceStartKind serviceStartKind, int priority, List<String> requiredServices) {
- super(key, serviceClassname, serviceStartKind, priority, requiredServices);
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
-
- public ServiceFactoryDesc(String key, String serviceClassname, ServiceStartKind serviceStartKind, int priority) {
- super(key, serviceClassname, serviceStartKind, priority);
- setServiceTypeKind(ServiceTypeKind.serviceFactory);
- }
- }
-
- /**
- *
- * @author dumoulin
- *
- */
- public class LazyServiceADescriptor extends ServiceDescriptor {
-
-
- public LazyServiceADescriptor() {
- super(ServiceA.class.getName(), ServiceStartKind.LAZY, 1);
- }
- }
-
- public class LazyServiceA10Descriptor extends ServiceDescriptor {
-
-
- public LazyServiceA10Descriptor() {
- super(ServiceA.class.getName(), ServiceA10.class.getName(), ServiceStartKind.LAZY, 10);
- }
- }
-
- public class LazyServiceBDescriptor extends ServiceDescriptor {
-
-
- public LazyServiceBDescriptor() {
- super(ServiceB.class.getName(), ServiceStartKind.LAZY, 1);
- }
- }
-
- public class ServiceCDescriptor extends ServiceDescriptor {
-
-
- public ServiceCDescriptor() {
- super(ServiceC.class.getName(), ServiceStartKind.STARTUP, 1);
- }
- }
-
- public class LazyServicePojoADescriptor extends ServiceDescriptor {
-
-
- public LazyServicePojoADescriptor() {
- super(ServicePojoA.class.getName(), ServiceStartKind.LAZY, 1);
- }
- }
-
- public class PojoServiceDescriptor extends ServiceDescriptor {
-
-
- public PojoServiceDescriptor() {
- super(Object.class.getName(), ServiceStartKind.STARTUP, 1);
- }
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2016 LIFL, CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * LIFL - Initial API and implementation
+ * Christian W. Damus - bug 488791
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.services;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.papyrus.infra.core.services.FakeServiceFactory.FakeCreatedService;
+import org.eclipse.papyrus.infra.core.services.ServiceA.TraceKind;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * @author dumoulin
+ *
+ */
+public class ServicesRegistryTest extends AbstractPapyrusTest {
+
+ /** The registry to test */
+ ServicesRegistry servicesRegistry;
+
+ ServiceDescriptor serviceADesc = new LazyServiceADescriptor();
+
+ ServiceDescriptor serviceA10Desc = new LazyServiceA10Descriptor();
+
+ ServiceDescriptor serviceBDesc = new LazyServiceBDescriptor();
+
+ ServiceDescriptor serviceCDesc = new ServiceCDescriptor();
+
+ ServiceDescriptor servicePojoADesc = new LazyServicePojoADescriptor();
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ servicesRegistry = new ServicesRegistry();
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.services.ServicesRegistry#add(org.eclipse.papyrus.infra.core.services.ServiceDescriptor)}
+ * .
+ *
+ * @throws ServiceMultiException
+ */
+ @Test
+ public void testAdd() throws ServiceMultiException {
+
+ servicesRegistry.add(serviceADesc);
+ servicesRegistry.add(serviceBDesc);
+ servicesRegistry.add(serviceCDesc);
+ servicesRegistry.add(servicePojoADesc);
+
+ // Test entries creation
+ // try {
+ // assertFalse("serviceA stopped", servicesRegistry.isStarted(serviceADesc.getKey()));
+ // assertFalse("serviceB stopped", servicesRegistry.isStarted(serviceBDesc.getKey()));
+ // assertFalse("serviceC stopped", servicesRegistry.isStarted(serviceCDesc.getKey()));
+ // assertFalse("servicePojoA stopped", servicesRegistry.isStarted(servicePojoADesc.getKey()));
+ // } catch (ServiceNotFoundException e) {
+ // fail("Service should exist." + e.getMessage());
+ // }
+
+ // Test startup
+ servicesRegistry.startRegistry();
+
+ // Test always started
+ try {
+ assertFalse("serviceA stopped", servicesRegistry.isStarted(serviceADesc.getKey()));
+ assertFalse("serviceB stopped", servicesRegistry.isStarted(serviceBDesc.getKey()));
+ assertEquals("serviceC state", ServiceState.started, servicesRegistry.serviceState(serviceCDesc.getKey()));
+ assertTrue("serviceC started", servicesRegistry.isStarted(serviceCDesc.getKey()));
+ assertFalse("servicePojoA stopped", servicesRegistry.isStarted(servicePojoADesc.getKey()));
+ } catch (ServiceNotFoundException e) {
+ fail("Service should exist.");
+ }
+
+
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.services.ServicesRegistry#getService(java.lang.Object)}.
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testGetService() throws ServiceException {
+ servicesRegistry.add(serviceADesc);
+ servicesRegistry.add(serviceBDesc);
+ servicesRegistry.add(serviceCDesc);
+ servicesRegistry.add(servicePojoADesc);
+
+
+ servicesRegistry.startRegistry();
+
+ // Test lazy service
+ Object serviceA = servicesRegistry.getService(serviceADesc.getKey());
+ assertNotNull("service created", serviceA);
+ assertEquals("right class", ServiceA.class, serviceA.getClass());
+
+ Object serviceA2 = servicesRegistry.getService(serviceADesc.getKey());
+ assertEquals("Second retrieve get the same service", serviceA, serviceA2);
+
+ // test startup service
+ Object serviceC = servicesRegistry.getService(serviceCDesc.getKey());
+ assertNotNull("service created", serviceC);
+ assertEquals("right class", ServiceC.class, serviceC.getClass());
+
+ Object serviceC2 = servicesRegistry.getService(serviceCDesc.getKey());
+ assertEquals("Second retrieve get the same service", serviceC, serviceC2);
+
+ // test pojo service
+ Object servicePojo = servicesRegistry.getService(servicePojoADesc.getKey());
+ assertNotNull("service created", servicePojo);
+ assertEquals("right class", ServicePojoA.class, servicePojo.getClass());
+
+ Object servicePojo2 = servicesRegistry.getService(servicePojoADesc.getKey());
+ assertEquals("Second retrieve get the same service", servicePojo, servicePojo2);
+
+
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.infra.core.services.ServicesRegistry#getService(java.lang.Object)}.
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testGetServiceByClass() throws ServiceException {
+ servicesRegistry.add(serviceADesc);
+ servicesRegistry.add(serviceBDesc);
+ servicesRegistry.add(serviceCDesc);
+ servicesRegistry.add(servicePojoADesc);
+
+
+ servicesRegistry.startRegistry();
+
+ // Test lazy service
+ ServiceA serviceA = servicesRegistry.getService(ServiceA.class);
+ assertNotNull("service created", serviceA);
+ assertEquals("right class", ServiceA.class, serviceA.getClass());
+
+ ServiceA serviceA2 = servicesRegistry.getService(ServiceA.class);
+ assertEquals("Second retrieve get the same service", serviceA, serviceA2);
+
+ // test startup service
+ ServiceC serviceC = servicesRegistry.getService(ServiceC.class);
+ assertNotNull("service created", serviceC);
+ assertEquals("right class", ServiceC.class, serviceC.getClass());
+
+ // test pojo service
+ ServicePojoA servicePojo = servicesRegistry.getService(ServicePojoA.class);
+ assertNotNull("service created", servicePojo);
+ assertEquals("right class", ServicePojoA.class, servicePojo.getClass());
+
+ Object servicePojo2 = servicesRegistry.getService(ServicePojoA.class);
+ assertEquals("Second retrieve get the same service", servicePojo, servicePojo2);
+
+
+ }
+
+ /**
+ * Try to register 2 services under the same name, but with different priorities.
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testPriority() throws ServiceException {
+ servicesRegistry.add(serviceADesc);
+ servicesRegistry.add(serviceA10Desc);
+ servicesRegistry.add(serviceBDesc);
+
+ // Test creation
+ // try {
+ // assertFalse("serviceA stopped", servicesRegistry.isStarted(serviceADesc.getKey()));
+ // assertFalse("serviceB stopped", servicesRegistry.isStarted(serviceBDesc.getKey()));
+ // } catch (ServiceNotFoundException e) {
+ // fail("Service should exist.");
+ // }
+
+ servicesRegistry.startRegistry();
+
+ Object serviceA = servicesRegistry.getService(serviceADesc.getKey());
+
+ assertNotNull("Service created", serviceA);
+ assertEquals("right class", ServiceA10.class, serviceA.getClass());
+
+
+ }
+
+ /**
+ * Test add for a direct instance of service.
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testAddDirectInstance() throws ServiceException {
+ IService instanciatedService = new ServiceA();
+ String key = instanciatedService.getClass().getName();
+
+ servicesRegistry.add(key, 1, instanciatedService);
+
+ servicesRegistry.add(serviceCDesc);
+ servicesRegistry.add(serviceBDesc);
+
+ servicesRegistry.startRegistry();
+
+ Object serviceA = servicesRegistry.getService(key);
+
+ assertNotNull("Service created", serviceA);
+ assertEquals("right object", instanciatedService, serviceA);
+ assertEquals("right class", ServiceA.class, serviceA.getClass());
+
+
+ }
+
+ /**
+ * Test life cycle for directly registered services
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testCallsOrder() throws ServiceException {
+ // Register services as STARTUP !
+ servicesRegistry.add(ServiceA.class, 1, new ServiceA());
+ // Lazy - generate no trace
+ servicesRegistry.add(ServiceB.class, 1, new ServiceB(), ServiceStartKind.LAZY);
+ servicesRegistry.add(ServiceC.class, 1, new ServiceC());
+ servicesRegistry.add(ServicePojoA.class, 1, new ServicePojoA());
+
+
+ ServiceA.resetTrace();
+ servicesRegistry.startRegistry();
+
+ // Check orders
+ //
+ int i = 0;
+ assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
+ assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
+ assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
+ // assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
+
+ assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
+ assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
+ assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
+ // assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
+
+ // Now, start lazy service
+ ServiceB service = servicesRegistry.getService(ServiceB.class);
+ assertNotNull("service found", service);
+ assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
+ assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
+
+
+ // Check dispose
+ servicesRegistry.disposeRegistry();
+ assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
+ assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
+ assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
+ // assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
+
+ //
+ }
+
+ /**
+ * Test life cycle for services registered wih descriptors
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testCallsOrderForDescriptors() throws ServiceException {
+ // Register services as STARTUP !
+ // Lazy - generate no trace
+ servicesRegistry.add(new LazyServiceBDescriptor());
+ servicesRegistry.add(new ServiceCDescriptor());
+
+
+ ServiceA.resetTrace();
+ servicesRegistry.startRegistry();
+
+ // Check orders
+ //
+ int i = 0;
+ assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
+ // assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
+
+ assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
+ // assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
+
+ // Now, start lazy service
+ ServiceB service = (ServiceB) servicesRegistry.getService(ServiceB.class.getName());
+ assertNotNull("service found", service);
+ assertEquals("service", TraceKind.init, ServiceA.getEvent(i++));
+ assertEquals("service", TraceKind.start, ServiceA.getEvent(i++));
+
+
+ // Check dispose
+ servicesRegistry.disposeRegistry();
+ assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
+ assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
+ // assertEquals("service", TraceKind.dispose, ServiceA.getEvent(i++));
+
+ //
+ }
+
+ /**
+ * Test the start order for services of type Start and Service
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testStartDependantOrder() throws ServiceException {
+
+ String A = "A";
+ String B = "B";
+ String C = "C";
+ String D = "D";
+ String E = "E";
+ // String F = "F";
+
+ // Create services E --> D --> C --> B --> A
+ FakeService.getTrace().reset();
+
+ servicesRegistry.add(new ServiceDesc(E, ServiceStartKind.STARTUP, Arrays.asList(D)));
+ servicesRegistry.add(new ServiceDesc(D, ServiceStartKind.STARTUP, Arrays.asList(C)));
+ servicesRegistry.add(new ServiceDesc(C, ServiceStartKind.STARTUP, Arrays.asList(B)));
+ servicesRegistry.add(new ServiceDesc(B, ServiceStartKind.STARTUP, Arrays.asList(A)));
+ servicesRegistry.add(new ServiceDesc(A, ServiceStartKind.STARTUP));
+ // servicesRegistry.add( new ServiceDesc( F, ServiceStartKind.STARTUP, Arrays.asList(E) ));
+
+ // Start services
+ servicesRegistry.startRegistry();
+
+ // check services
+ assertTrue("service started", servicesRegistry.isStarted(A));
+ assertTrue("service started", servicesRegistry.isStarted(B));
+ assertNotSame("services are different", servicesRegistry.getService(A), servicesRegistry.getService(B));
+
+ // Get names of created services
+ String nameA = ((FakeService) servicesRegistry.getService(A)).getName();
+ String nameB = ((FakeService) servicesRegistry.getService(B)).getName();
+ String nameC = ((FakeService) servicesRegistry.getService(C)).getName();
+ String nameD = ((FakeService) servicesRegistry.getService(D)).getName();
+ String nameE = ((FakeService) servicesRegistry.getService(E)).getName();
+ // String nameF = ((FakeService)servicesRegistry.getService(F)).getName();
+
+
+ // check order (E and F order are not guaranteed)
+ // order should be A, B, C, D, E
+ TestTrace trace = FakeService.getTrace();
+ int i = 0;
+ // assertEquals("order", nameF + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameD + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameE + ",create", trace.getNameTrace(i++));
+
+ // assertEquals("order", nameF + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameD + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameE + ",init", trace.getNameTrace(i++));
+
+ // assertEquals("order", nameF + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameD + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameE + ",start", trace.getNameTrace(i++));
+
+ }
+
+ /**
+ * Start regular services, then add a new service and try to start it.
+ * This should work.
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testStartRegistryAndThenAddNewServiceAndStartIt() throws ServiceException {
+
+ // Register some services
+ String A = "A";
+ String B = "B";
+ String C = "C";
+ servicesRegistry.add(new ServiceFactoryDesc(C, ServiceStartKind.STARTUP));
+ servicesRegistry.add(new ServiceFactoryDesc(B, ServiceStartKind.STARTUP, Arrays.asList(C)));
+ servicesRegistry.add(new ServiceFactoryDesc(A, ServiceStartKind.STARTUP, Arrays.asList(B)));
+
+ // Start them
+ servicesRegistry.startRegistry();
+
+ // Register another services as pojo
+ IService instanciatedService = new ServiceA();
+ String key = instanciatedService.getClass().getName();
+ servicesRegistry.add(key, 1, instanciatedService);
+
+ // Try to start it
+ servicesRegistry.startServices(key);
+
+ // check services
+ assertTrue("service started", servicesRegistry.isStarted(A));
+ assertTrue("service started", servicesRegistry.isStarted(B));
+ assertTrue("service started", servicesRegistry.isStarted(C));
+
+ assertTrue("service started", servicesRegistry.isStarted(key));
+
+ assertEquals("get registered service", instanciatedService, servicesRegistry.getService(key));
+
+ }
+
+ /**
+ * Test Service Factory creation
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testServiceFactoryCreation() throws ServiceException {
+
+ String A = "A";
+ String B = "B";
+ String C = "C";
+
+ // Create services
+ FakeService.getTrace().reset();
+
+ servicesRegistry.add(new ServiceFactoryDesc(C, ServiceStartKind.STARTUP));
+ servicesRegistry.add(new ServiceFactoryDesc(B, ServiceStartKind.STARTUP, Arrays.asList(C)));
+ servicesRegistry.add(new ServiceFactoryDesc(A, ServiceStartKind.STARTUP, Arrays.asList(B)));
+
+ // Start services
+ servicesRegistry.startRegistry();
+
+ // check services
+ assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(A).getClass());
+ assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(B).getClass());
+
+ // Get names of created services
+ String nameA = ((FakeCreatedService) servicesRegistry.getService(A)).getName();
+ String nameB = ((FakeCreatedService) servicesRegistry.getService(B)).getName();
+ String nameC = ((FakeCreatedService) servicesRegistry.getService(C)).getName();
+
+
+ // check order
+ // Order should be: C, B, A
+ TestTrace trace = FakeService.getTrace();
+ int i = 0;
+ assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
+
+ assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
+
+ assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
+
+ // next order is the order of getService()
+ assertEquals("order", nameA + ",createInstance", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",createInstance", trace.getNameTrace(i++));
+ assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
+ }
+
+ /**
+ * Test Creation of Service Factory used with class as key.
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testServiceFactoryWithClassKey() throws ServiceException {
+
+ //
+ Class<?> A = ServiceA.class;
+ Class<?> B = ServiceB.class;
+ Class<?> C = ServiceC.class;
+
+ // Specify service types as String
+ String serviceClassname1 = FakeServiceFactory.class.getName();
+ ;
+ String serviceClassname2 = FakeServiceFactory.class.getName();
+ String serviceClassname3 = FakeServiceFactory.class.getName();
+
+ // Create services
+ FakeService.getTrace().reset();
+
+ servicesRegistry.add(new ServiceFactoryDesc(C, serviceClassname3, ServiceStartKind.STARTUP));
+ servicesRegistry.add(new ServiceFactoryDesc(B, serviceClassname2, ServiceStartKind.STARTUP, Arrays.asList(C.getName())));
+ servicesRegistry.add(new ServiceFactoryDesc(A, serviceClassname1, ServiceStartKind.STARTUP, Arrays.asList(B.getName())));
+
+ // Start services
+ servicesRegistry.startRegistry();
+
+ // check services
+ assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(A).getClass());
+ assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(B).getClass());
+
+ // Get names of created services
+ String nameA = ((FakeCreatedService) servicesRegistry.getService(A)).getName();
+ String nameB = ((FakeCreatedService) servicesRegistry.getService(B)).getName();
+ String nameC = ((FakeCreatedService) servicesRegistry.getService(C)).getName();
+
+
+ // check order (E and F order are not guaranteed)
+ // Order should be
+ TestTrace trace = FakeService.getTrace();
+ int i = 0;
+ assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
+
+ assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
+
+ assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
+
+ // next order is the order of getService()
+ assertEquals("order", nameA + ",createInstance", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",createInstance", trace.getNameTrace(i++));
+ assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
+ }
+
+ /**
+ * Test Service Factory creation order.
+ * One of the factory try to get the required service from its init() method.
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testServiceFactoryWithRequiredInInit() throws ServiceException {
+
+ String A = "A";
+ String B = "B";
+ String C = "C";
+
+ // Create services C --> A --> B
+ FakeService.getTrace().reset();
+
+ // FakeWithRequiredServiceFactory try to retrieve service "C"
+ servicesRegistry.add(new ServiceFactoryDesc(B, FakeWithRequiredServiceFactory.class.getName(), ServiceStartKind.STARTUP, 1, Arrays.asList(C)));
+ servicesRegistry.add(new ServiceFactoryDesc(A, FakeWithRequiredServiceFactory.class.getName(), ServiceStartKind.STARTUP, 1, Arrays.asList(B, C)));
+ servicesRegistry.add(new ServiceFactoryDesc(C, FakeServiceFactory.class.getName(), ServiceStartKind.STARTUP, 1));
+
+ // Start services
+ servicesRegistry.startRegistry();
+
+ // check services
+ assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(A).getClass());
+ assertSame("service type", FakeCreatedService.class, servicesRegistry.getService(B).getClass());
+
+ // Get names of created services
+ String nameA = ((FakeCreatedService) servicesRegistry.getService(A)).getName();
+ String nameB = ((FakeCreatedService) servicesRegistry.getService(B)).getName();
+ String nameC = ((FakeCreatedService) servicesRegistry.getService(C)).getName();
+
+
+ // check order
+ // Order should be: C, B, A
+ TestTrace trace = FakeService.getTrace();
+ int i = 0;
+ assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
+
+ assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
+
+ assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
+ assertEquals("value", servicesRegistry.getService(C), trace.getValue(i));
+ assertEquals("order", nameB + ",initEnd", trace.getNameTrace(i++));
+
+ assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",initEnd", trace.getNameTrace(i++));
+
+ assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
+
+ // next order is the order of getService()
+ assertEquals("order", nameA + ",createInstance", trace.getNameTrace(i++));
+ // assertEquals("order", nameB + ",createInstance", trace.getNameTrace(i++));
+ // assertEquals("order", nameC + ",createInstance", trace.getNameTrace(i++));
+ }
+
+ /**
+ * Test {@link ServicesRegistry#startServicesByClassKeys(List)}.
+ * Check that services are started.
+ *
+ * @throws ServiceException
+ */
+ @Test
+ public void testStartService() throws ServiceException {
+
+ String A = "A";
+ String B = "B";
+ String C = "C";
+ String D = "D";
+ String E = "E";
+
+ // Create services E --> D --> C --> B --> A
+ FakeService.getTrace().reset();
+
+ servicesRegistry.add(new ServiceDesc(E, ServiceStartKind.STARTUP, Arrays.asList(D)));
+ servicesRegistry.add(new ServiceDesc(D, ServiceStartKind.STARTUP, Arrays.asList(C)));
+ servicesRegistry.add(new ServiceDesc(C, ServiceStartKind.STARTUP, Arrays.asList(A, B)));
+ servicesRegistry.add(new ServiceDesc(B, ServiceStartKind.STARTUP, Arrays.asList(A)));
+ servicesRegistry.add(new ServiceDesc(A, ServiceStartKind.STARTUP));
+
+ // Start services
+ servicesRegistry.startServices(Arrays.asList(C));
+
+ // check services
+ assertTrue("service started", servicesRegistry.isStarted(A));
+ assertTrue("service started", servicesRegistry.isStarted(B));
+ assertTrue("service started", servicesRegistry.isStarted(C));
+
+ // Get names of created services
+ String nameA = ((FakeService) servicesRegistry.getService(A)).getName();
+ String nameB = ((FakeService) servicesRegistry.getService(B)).getName();
+ String nameC = ((FakeService) servicesRegistry.getService(C)).getName();
+ // String nameD = ((FakeService)servicesRegistry.getService(D)).getName();
+ // String nameE = ((FakeService)servicesRegistry.getService(E)).getName();
+ // String nameF = ((FakeService)servicesRegistry.getService(F)).getName();
+
+
+ // check order (E and F order are not guaranteed)
+ // order should be A, B, C
+ TestTrace trace = FakeService.getTrace();
+ int i = 0;
+ assertEquals("order", nameA + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",create", trace.getNameTrace(i++));
+ assertEquals("order", nameC + ",create", trace.getNameTrace(i++));
+ // assertEquals("order", nameD + ",create", trace.getNameTrace(i++));
+ // assertEquals("order", nameE + ",create", trace.getNameTrace(i++));
+
+ assertEquals("order", nameA + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",init", trace.getNameTrace(i++));
+ assertEquals("order", nameC + ",init", trace.getNameTrace(i++));
+ // assertEquals("order", nameD + ",init", trace.getNameTrace(i++));
+ // assertEquals("order", nameE + ",init", trace.getNameTrace(i++));
+
+ assertEquals("order", nameA + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameB + ",start", trace.getNameTrace(i++));
+ assertEquals("order", nameC + ",start", trace.getNameTrace(i++));
+ // assertEquals("order", nameD + ",start", trace.getNameTrace(i++));
+ // assertEquals("order", nameE + ",start", trace.getNameTrace(i++));
+
+ }
+
+ /* **************************************** */
+
+
+ abstract static class TestServiceDescriptor extends ServiceDescriptor {
+ {
+ setClassBundleID("org.eclipse.papyrus.infra.core.tests");
+ }
+
+ public TestServiceDescriptor(Class<?> key, String serviceClassname, ServiceStartKind serviceStartKind, int priority, boolean isAnonymous, List<String> requiredServices) {
+ super(key, serviceClassname, serviceStartKind, priority, isAnonymous, requiredServices);
+ }
+
+ public TestServiceDescriptor(Class<?> key, String serviceClassname, ServiceStartKind serviceStartKind, int priority, List<String> requiredServices) {
+ super(key, serviceClassname, serviceStartKind, priority, requiredServices);
+ }
+
+ public TestServiceDescriptor(Class<?> key, String serviceClassname, ServiceStartKind serviceStartKind, int priority) {
+ super(key, serviceClassname, serviceStartKind, priority);
+ }
+
+ public TestServiceDescriptor(String serviceClassname, ServiceStartKind serviceStartKind, int priority, boolean isAnonymous) {
+ super(serviceClassname, serviceStartKind, priority, isAnonymous);
+ }
+
+ public TestServiceDescriptor(String serviceClassname, ServiceStartKind serviceStartKind, int priority, List<String> requiredServices) {
+ super(serviceClassname, serviceStartKind, priority, requiredServices);
+ }
+
+ public TestServiceDescriptor(String serviceClassname, ServiceStartKind serviceStartKind, int priority) {
+ super(serviceClassname, serviceStartKind, priority);
+ }
+
+ public TestServiceDescriptor(String key, String serviceClassname, ServiceStartKind serviceStartKind, int priority, boolean isAnonymous, List<String> requiredServices) {
+ super(key, serviceClassname, serviceStartKind, priority, isAnonymous, requiredServices);
+ }
+
+ public TestServiceDescriptor(String key, String serviceClassname, ServiceStartKind serviceStartKind, int priority, List<String> requiredServices) {
+ super(key, serviceClassname, serviceStartKind, priority, requiredServices);
+ }
+
+ public TestServiceDescriptor(String key, String serviceClassname, ServiceStartKind serviceStartKind, int priority) {
+ super(key, serviceClassname, serviceStartKind, priority);
+ }
+
+ }
+
+
+ /**
+ * General purpose descriptor.
+ */
+ public class ServiceDesc extends TestServiceDescriptor {
+
+
+ public ServiceDesc(String key, ServiceStartKind startKind) {
+ super(key, FakeService.class.getName(), startKind, 1);
+ }
+
+ public ServiceDesc(String key, ServiceStartKind startKind, List<String> requiredService) {
+ super(key, FakeService.class.getName(), startKind, 1, requiredService);
+ }
+ }
+
+ /**
+ * General purpose descriptor.
+ */
+ public class ServiceFactoryDesc extends TestServiceDescriptor {
+
+
+ public ServiceFactoryDesc(String key, ServiceStartKind startKind) {
+ super(key, FakeServiceFactory.class.getName(), startKind, 1);
+ setServiceTypeKind(ServiceTypeKind.serviceFactory);
+ }
+
+ public ServiceFactoryDesc(String key, ServiceStartKind startKind, List<String> requiredService) {
+ super(key, FakeServiceFactory.class.getName(), startKind, 1, requiredService);
+ setServiceTypeKind(ServiceTypeKind.serviceFactory);
+ }
+
+ /**
+ * Constructor with a classname and {@link ServiceDescriptor#isStartAtStartup()} = true.
+ * Constructor.
+ *
+ * @param key
+ * @param startKind
+ * @param requiredService
+ */
+ public ServiceFactoryDesc(Class<?> key, String classname, ServiceStartKind startKind, List<String> requiredService) {
+ super(key, classname, startKind, 1, requiredService);
+ setServiceTypeKind(ServiceTypeKind.serviceFactory);
+ }
+
+ /**
+ * Constructor with a classname and {@link ServiceDescriptor#isStartAtStartup()} = true.
+ * Constructor.
+ *
+ * @param key
+ * @param startKind
+ * @param requiredService
+ */
+ public ServiceFactoryDesc(Class<?> key, String classname, ServiceStartKind startKind) {
+ super(key, classname, startKind, 1);
+ setServiceTypeKind(ServiceTypeKind.serviceFactory);
+ }
+
+ public ServiceFactoryDesc(String key, String serviceClassname, ServiceStartKind serviceStartKind, int priority, List<String> requiredServices) {
+ super(key, serviceClassname, serviceStartKind, priority, requiredServices);
+ setServiceTypeKind(ServiceTypeKind.serviceFactory);
+ }
+
+ public ServiceFactoryDesc(String key, String serviceClassname, ServiceStartKind serviceStartKind, int priority) {
+ super(key, serviceClassname, serviceStartKind, priority);
+ setServiceTypeKind(ServiceTypeKind.serviceFactory);
+ }
+ }
+
+ /**
+ *
+ * @author dumoulin
+ *
+ */
+ public class LazyServiceADescriptor extends TestServiceDescriptor {
+
+
+ public LazyServiceADescriptor() {
+ super(ServiceA.class.getName(), ServiceStartKind.LAZY, 1);
+ }
+ }
+
+ public class LazyServiceA10Descriptor extends TestServiceDescriptor {
+
+
+ public LazyServiceA10Descriptor() {
+ super(ServiceA.class.getName(), ServiceA10.class.getName(), ServiceStartKind.LAZY, 10);
+ }
+ }
+
+ public class LazyServiceBDescriptor extends TestServiceDescriptor {
+
+
+ public LazyServiceBDescriptor() {
+ super(ServiceB.class.getName(), ServiceStartKind.LAZY, 1);
+ }
+ }
+
+ public class ServiceCDescriptor extends TestServiceDescriptor {
+
+
+ public ServiceCDescriptor() {
+ super(ServiceC.class.getName(), ServiceStartKind.STARTUP, 1);
+ }
+ }
+
+ public class LazyServicePojoADescriptor extends TestServiceDescriptor {
+
+
+ public LazyServicePojoADescriptor() {
+ super(ServicePojoA.class.getName(), ServiceStartKind.LAZY, 1);
+ }
+ }
+
+ public class PojoServiceDescriptor extends TestServiceDescriptor {
+
+
+ public PojoServiceDescriptor() {
+ super(Object.class.getName(), ServiceStartKind.STARTUP, 1);
+ }
+ }
+
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
index 8055401609e..484b3600ece 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
@@ -3,9 +3,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0",
org.eclipse.papyrus.uml.diagram.common.tests;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.service.types;bundle-version="1.2.0",
- org.eclipse.papyrus.sysml.service.types;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.resourceloading.tests;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.service.types.tests;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml.service.types.tests;bundle-version="1.2.0",
org.eclipse.papyrus.sysml.tests;bundle-version="1.2.0",
org.eclipse.papyrus.uml.diagram.clazz.tests;bundle-version="1.2.0",
org.eclipse.papyrus.bundles.tests;bundle-version="1.2.0",
@@ -19,15 +19,17 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.uml.diagram.dnd.tests;bundle-version="1.2.0",
org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests;bundle-version="1.2.0",
org.eclipse.papyrus.uml.diagram.tests;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
- org.eclipse.papyrus.sysml.diagram.blockdefinition;bundle-version="1.2.0",
- org.eclipse.papyrus.sysml.diagram.internalblock;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf.tests;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml.diagram.blockdefinition.tests;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml.diagram.internalblock.tests;bundle-version="1.2.0",
org.eclipse.papyrus.sysml.diagram.requirement.tests;bundle-version="1.2.0",
- org.eclipse.papyrus.sysml.modelexplorer;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml.diagram.parametric.tests;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml.modelexplorer.tests;bundle-version="1.2.0",
org.eclipse.papyrus.customization.properties.tests;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor.tests;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor.di.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0",
org.eclipse.papyrus.infra.services.labelprovider.tests;bundle-version="1.2.0",
org.eclipse.papyrus.uml.diagram.timing.tests;bundle-version="1.2.0",
@@ -45,13 +47,13 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.css.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.types.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.extendedtypes.tests;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands.tests;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf.readonly.tests;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.common.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.tools.tests;bundle-version="1.2.0",
org.eclipse.papyrus.uml.diagram.wizards.tests;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.modelrepair;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.profile;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.modelrepair.tests;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.profile.tests;bundle-version="1.2.0",
org.eclipse.papyrus.uml.diagram.profile.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.services.controlmode.tests;bundle-version="1.2.0",
org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
@@ -71,7 +73,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.menu.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.nattable.model.tests;bundle-version="1.2.0",
org.eclipse.papyrus.tests.diagramassistants;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.profile.drafter;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.profile.drafter.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.gmfdiag.canonical.tests;bundle-version="1.2.0",
org.eclipse.papyrus.uml.alf.tests;bundle-version="1.2.0",
org.eclipse.papyrus.uml.textedit.valuespecification.tests;bundle-version="1.2.0",
@@ -85,13 +87,13 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.welcome.tests;bundle-version="1.2.0",
org.eclipse.papyrus.uml.validation.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.ui.tests;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.ui.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.ui.emf.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.services.edit.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.services.edit.ui.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.types.ui.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.extendedtypes.ui.tests;bundle-version="1.2.0",
org.eclipse.papyrus.infra.services.semantic.tests;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.service.types.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.service.types.ui.tests;bundle-version="1.2.0",
org.eclipse.papyrus.eclipse.project.editors.tests;bundle-version="2.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
@@ -101,21 +103,4 @@ Bundle-Localization: plugin
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.tests.Activator
Bundle-SymbolicName: org.eclipse.papyrus.tests
-Import-Package: org.eclipse.papyrus.infra.core.sasheditor.di.tests,
- org.eclipse.papyrus.infra.core.sasheditor.tests,
- org.eclipse.papyrus.infra.core.tests,
- org.eclipse.papyrus.infra.emf.readonly.tests,
- org.eclipse.papyrus.infra.emf.tests,
- org.eclipse.papyrus.infra.gmfdiag.commands.tests,
- org.eclipse.papyrus.infra.gmfdiag.common.tests,
- org.eclipse.papyrus.infra.services.edit.tests,
- org.eclipse.papyrus.infra.services.resourceloading.tests,
- org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.suites,
- org.eclipse.papyrus.sysml.diagram.internalblock.tests.suites,
- org.eclipse.papyrus.sysml.diagram.parametric.tests.suites,
- org.eclipse.papyrus.sysml.service.types.tests.suites,
- org.eclipse.papyrus.uml.modelrepair.tests,
- org.eclipse.papyrus.uml.service.types.tests.suites,
- org.eclipse.papyrus.uml.profile.drafter.tests,
- org.eclipse.papyrus.uml.profile.tests
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus SysML tests.launch b/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus SysML tests.launch
index 521edd10456..c08c0593162 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus SysML tests.launch
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus SysML tests.launch
@@ -26,7 +26,7 @@
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.tests.AllSysMLTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.tests"/>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllSysMLTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllSysMLTests.java
index 2acb3dbcf03..09fce0e38b6 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllSysMLTests.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllSysMLTests.java
@@ -1,46 +1,45 @@
-/*****************************************************************************
- * Copyright (c) 2010, 2015 CEA LIST, Christian W. Damus, and others.
- *
- * 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) remi.schnekenburger@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 451230
- *
- *****************************************************************************/
-package org.eclipse.papyrus.tests;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.papyrus.junit.framework.runner.AllTestsRunner;
-import org.eclipse.papyrus.junit.framework.runner.FragmentTestSuiteClass;
-import org.eclipse.papyrus.junit.framework.runner.ITestSuiteClass;
-import org.eclipse.papyrus.junit.framework.runner.PluginTestSuiteClass;
-import org.eclipse.papyrus.junit.framework.runner.SuiteSpot;
-import org.junit.runner.RunWith;
-
-@RunWith(AllTestsRunner.class)
-public class AllSysMLTests {
-
- @SuiteSpot
- public static final List<ITestSuiteClass> suiteClasses;
-
- static {
- suiteClasses = new ArrayList<ITestSuiteClass>();
-
- /* sysml */
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.tests.SysmlAllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.sysml.service.types.Activator.PLUGIN_ID, "org.eclipse.papyrus.sysml.service.types.tests.suites.AllTests"));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.modelexplorer.tests.suites.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.sysml.diagram.internalblock.Activator.PLUGIN_ID, "org.eclipse.papyrus.sysml.diagram.internalblock.tests.suites.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass("org.eclipse.papyrus.sysml.diagram.blockdefinition", "org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.suites.AllTests"));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.diagram.requirement.test.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass("org.eclipse.papyrus.sysml.diagram.parametric", "org.eclipse.papyrus.sysml.diagram.parametric.tests.suites.AllTests"));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.nattable.requirement.tests.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.nattable.allocation.tests.tests.AllTests.class));
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Christian W. Damus - bugs 451230, 488791
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.junit.framework.runner.AllTestsRunner;
+import org.eclipse.papyrus.junit.framework.runner.ITestSuiteClass;
+import org.eclipse.papyrus.junit.framework.runner.PluginTestSuiteClass;
+import org.eclipse.papyrus.junit.framework.runner.SuiteSpot;
+import org.junit.runner.RunWith;
+
+@RunWith(AllTestsRunner.class)
+public class AllSysMLTests {
+
+ @SuiteSpot
+ public static final List<ITestSuiteClass> suiteClasses;
+
+ static {
+ suiteClasses = new ArrayList<ITestSuiteClass>();
+
+ /* sysml */
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.tests.SysmlAllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.service.types.tests.suites.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.modelexplorer.tests.suites.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.diagram.internalblock.tests.suites.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.suites.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.diagram.requirement.test.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.diagram.parametric.tests.suites.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.nattable.requirement.tests.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.nattable.allocation.tests.tests.AllTests.class));
+ }
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
index ce7711d3be2..005c3333ce8 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
@@ -9,7 +9,7 @@
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bugs 402525, 323802, 431953, 433310, 434993
- * Christian W. Damus - bugs 399859, 451230, 433206, 463156, 474610, 469188, 485220
+ * Christian W. Damus - bugs 399859, 451230, 433206, 463156, 474610, 469188, 485220, 488791
*
*****************************************************************************/
package org.eclipse.papyrus.tests;
@@ -18,7 +18,6 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.papyrus.junit.framework.runner.AllTestsRunner;
-import org.eclipse.papyrus.junit.framework.runner.FragmentTestSuiteClass;
import org.eclipse.papyrus.junit.framework.runner.ITestSuiteClass;
import org.eclipse.papyrus.junit.framework.runner.PluginTestSuiteClass;
import org.eclipse.papyrus.junit.framework.runner.SuiteSpot;
@@ -28,7 +27,6 @@ import org.junit.runner.RunWith;
/**
* Test class for all tests for Papyrus
*/
-@SuppressWarnings("restriction")
@RunWith(AllTestsRunner.class)
public class AllTests {
@@ -44,9 +42,9 @@ public class AllTests {
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.bundles.tests.AllTests.class));
/* core */
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.core.tests.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.core.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.core.clipboard.tests.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.core.sasheditor.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.core.sasheditor.tests.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.core.sasheditor.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.core.sasheditor.di.tests.AllTests.class));
/* infra */
@@ -56,17 +54,17 @@ public class AllTests {
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.edit.ui.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.labelprovider.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.semantic.tests.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.tests.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.ui.internal.emf.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.ui.emf.tests.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.emf.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.ui.emf.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.extendedtypes.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.extendedtypes.ui.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.types.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.types.ui.tests.AllTests.class));
// suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.openelement.tests.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.commands.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.gmfdiag.commands.tests.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.common.Activator.ID, "org.eclipse.papyrus.infra.gmfdiag.common.tests.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.commands.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.common.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.canonical.tests.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.readonly.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.readonly.tests.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.emf.readonly.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.viewpoints.configuration.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.editor.welcome.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.welcome.tests.AllTests.class));
@@ -82,7 +80,7 @@ public class AllTests {
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.editor.integration.tests.AllTests.class));
// FIXME: Workaround for Bug 441246: Move the ResourceLoading tests after EditorReloadTest, since they are currently conflicting
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.services.resourceloading.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.services.resourceloading.tests.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.resourceloading.tests.AllTests.class));
/* search */
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.search.tests.suites.AllTests.class));
@@ -108,16 +106,16 @@ public class AllTests {
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.profile.drafter.tests.AllTests.class));
/* uml */
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.service.types.Activator.PLUGIN_ID, "org.eclipse.papyrus.uml.service.types.tests.suites.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.service.types.internal.ui.Activator.PLUGIN_ID, "org.eclipse.papyrus.uml.service.types.ui.tests.suites.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.service.types.tests.suites.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.service.types.ui.tests.suites.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.modelexplorer.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.dnd.tests.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.tools.tests.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.tools.utils.tests.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.stereotypeproperty.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.wizards.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.modelrepair.Activator.PLUGIN_ID, "org.eclipse.papyrus.uml.modelrepair.tests.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.profile.Activator.PLUGIN_ID, "org.eclipse.papyrus.uml.profile.tests.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.modelrepair.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.profile.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.decoratormodel.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.decoratormodel.controlmode.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.validation.tests.AllTests.class));
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/META-INF/MANIFEST.MF
index f4324fa7da9..4b653ccffb2 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/META-INF/MANIFEST.MF
@@ -1,19 +1,19 @@
-Manifest-Version: 1.0
-Require-Bundle: org.junit;bundle-version="4.10.0",
- org.eclipse.uml2.uml;bundle-version="5.0.0",
- com.google.guava;bundle-version="11.0.0",
- org.eclipse.papyrus.infra.services.controlmode;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.notation;bundle-version="1.7.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.9.0"
-Export-Package: org.eclipse.papyrus.infra.emf.readonly,
- org.eclipse.papyrus.infra.emf.readonly.tests
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: fragment
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.readonly.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.uml2.uml;bundle-version="5.0.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.services.controlmode;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.notation;bundle-version="1.7.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.9.0",
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0"
+Export-Package: org.eclipse.papyrus.infra.emf.readonly,
+ org.eclipse.papyrus.infra.emf.readonly.tests
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.readonly.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/build.properties b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/build.properties
index c905634491b..6a342ac18dc 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/build.properties
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/build.properties
@@ -14,7 +14,7 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- fragment.properties,\
+ plugin.properties,\
about.html
src.includes = about.html,\
org.eclipse.papyrus.infra.emf.readonly.tests.launch
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/fragment.properties b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/plugin.properties
index fbac3436f5d..fbac3436f5d 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/fragment.properties
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/plugin.properties
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTesterTest.java b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTesterTest.java
index ede13201f22..c91861173f5 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTesterTest.java
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly.tests/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTesterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others.
+ * Copyright (c) 2014, 2016 CEA, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
- * Christian W. Damus - bug 463564
+ * Christian W. Damus - bugs 463564, 488791
*
*/
package org.eclipse.papyrus.infra.emf.readonly;
@@ -16,6 +16,8 @@ package org.eclipse.papyrus.infra.emf.readonly;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import java.util.Iterator;
+
import org.eclipse.papyrus.infra.emf.readonly.tests.PapyrusROEditingDomainFixture;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
import org.eclipse.papyrus.junit.utils.rules.JavaResource;
@@ -43,7 +45,7 @@ public class ReadOnlyTesterTest extends AbstractPapyrusTest {
private final ProjectFixture project = domain.getProject();
- private ReadOnlyTester fixture;
+ private MyReadOnlyTester fixture;
@Test
public void testAsBoolean() {
@@ -83,7 +85,7 @@ public class ReadOnlyTesterTest extends AbstractPapyrusTest {
@Before
public void createFixture() throws Exception {
- fixture = new ReadOnlyTester();
+ fixture = new MyReadOnlyTester();
}
@After
@@ -91,4 +93,27 @@ public class ReadOnlyTesterTest extends AbstractPapyrusTest {
fixture = null;
}
+ private static class MyReadOnlyTester extends ReadOnlyTester {
+ MyReadOnlyTester() {
+ super();
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected Boolean asBoolean(Object expectedValue) {
+ return super.asBoolean(expectedValue);
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected boolean canMakeWritable(Iterator<?> objects, Boolean expectedValue) {
+ return super.canMakeWritable(objects, expectedValue);
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected boolean testIsReadOnly(Iterator<?> objects, Boolean expectedValue) {
+ return super.testIsReadOnly(objects, expectedValue);
+ }
+ }
}
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/META-INF/MANIFEST.MF
index c623666ed8f..3f619512f80 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.emf.tests/META-INF/MANIFEST.MF
@@ -1,19 +1,19 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.infra.emf.advice,
- org.eclipse.papyrus.infra.emf.resource.index,
- org.eclipse.papyrus.infra.emf.tests,
- org.eclipse.papyrus.infra.emf.utils
-Require-Bundle: org.eclipse.emf.ecore.xmi;bundle-version="2.8.0",
- org.junit;bundle-version="4.10.0",
- org.eclipse.uml2.uml;bundle-version="5.0.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.types.core;bundle-version="1.2.0"
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.infra.emf;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: fragment
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.tests
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.infra.emf.advice,
+ org.eclipse.papyrus.infra.emf.resource.index,
+ org.eclipse.papyrus.infra.emf.tests,
+ org.eclipse.papyrus.infra.emf.utils
+Require-Bundle: org.eclipse.emf.ecore.xmi;bundle-version="2.8.0",
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.uml2.uml;bundle-version="5.0.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.types.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.2.0"
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: fragment
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/META-INF/MANIFEST.MF
index 4b8de23889d..c4f33567f76 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/META-INF/MANIFEST.MF
@@ -6,14 +6,15 @@ Require-Bundle: org.junit;bundle-version="4.10.0",
org.eclipse.gmf.runtime.notation;bundle-version="1.7.0",
org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.9.0"
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.9.0",
+ org.eclipse.papyrus.infra.ui.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="2.0.0"
Export-Package: org.eclipse.papyrus.infra.ui.emf.tests,
org.eclipse.papyrus.infra.ui.internal.emf.readonly.handlers
Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.infra.ui.emf;bundle-version="1.2.0"
Bundle-Version: 1.2.0.qualifier
Bundle-Name: %pluginName
-Bundle-Localization: fragment
+Bundle-Localization: plugin
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.ui.emf.tests
+Bundle-SymbolicName: org.eclipse.papyrus.infra.ui.emf.tests;singleton:=true
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/build.properties b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/build.properties
index ce5d0aee6cf..c45e8466334 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/build.properties
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/build.properties
@@ -13,7 +13,7 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- fragment.properties,\
+ plugin.properties,\
about.html,\
resources/
src.includes = about.html,\
diff --git a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/fragment.properties b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/plugin.properties
index 2acc6750200..2acc6750200 100644
--- a/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/fragment.properties
+++ b/tests/junit/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf.tests/plugin.properties
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/META-INF/MANIFEST.MF
index 39290bb8f9b..e85d24dc487 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/META-INF/MANIFEST.MF
@@ -1,14 +1,14 @@
-Manifest-Version: 1.0
-Require-Bundle: org.junit;bundle-version="4.10.0",
- com.google.guava;bundle-version="11.0.0",
- org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.infra.gmfdiag.commands.tests
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: fragment
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.commands.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0"
+Export-Package: org.eclipse.papyrus.infra.gmfdiag.commands.tests
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.commands.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/build.properties b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/build.properties
index 6f802cf9614..a36a2f6f512 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/build.properties
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/build.properties
@@ -2,7 +2,7 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- fragment.properties,\
+ plugin.properties,\
org.eclipse.papyrus.infra.gmfdiag.commands.tests.launch,\
about.html
src.includes = about.html
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/fragment.properties b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/plugin.properties
index b370be84c3e..b370be84c3e 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/fragment.properties
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.commands.tests/plugin.properties
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/META-INF/MANIFEST.MF
index 07f3c77fe7c..dfdbcb3f064 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/META-INF/MANIFEST.MF
@@ -6,14 +6,14 @@ Require-Bundle: org.junit;bundle-version="4.10.0",
org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0",
org.eclipse.papyrus.infra.gmfdiag.canonical;bundle-version="1.2.0",
org.eclipse.uml2.uml;bundle-version="5.1.0",
- org.eclipse.papyrus.infra.types.core;bundle-version="1.2.0"
+ org.eclipse.papyrus.infra.types.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0"
Export-Package: org.eclipse.papyrus.infra.gmfdiag.common.tests,
org.eclipse.papyrus.infra.gmfdiag.common.utils
Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0"
Bundle-Version: 1.2.0.qualifier
Bundle-Name: %pluginName
-Bundle-Localization: fragment
+Bundle-Localization: plugin
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.common.tests;singleton:=true
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/build.properties b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/build.properties
index e88e96ad2ff..a0357c662c1 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/build.properties
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/build.properties
@@ -3,9 +3,9 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
about.html,\
- fragment.properties,\
+ plugin.properties,\
models/,\
- fragment.xml
+ plugin.xml
src.includes = about.html,\
org.eclipse.papyrus.infra.gmfdiag.common.tests.launch,\
models/
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/fragment.properties b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/plugin.properties
index 7d566c9e214..7d566c9e214 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/fragment.properties
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/plugin.properties
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/fragment.xml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/plugin.xml
index 0c39a506f83..0c39a506f83 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/fragment.xml
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/plugin.xml
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java
index af4c6d57e52..d61f5a6c7c2 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java
@@ -1,216 +1,217 @@
-/*****************************************************************************
- * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.common.tests;
-
-import java.util.List;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantService;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.gmfdiag.assistant.core.IModelingAssistantModelProvider;
-import org.eclipse.papyrus.infra.gmfdiag.assistant.internal.core.DefaultModelingAssistantModelProvider;
-import org.eclipse.papyrus.infra.gmfdiag.assistant.internal.core.ModelingAssistantModelRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.assistant.internal.core.util.ProxyElementType;
-import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
-import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * this Test is used to test if it is possible to add compartment
- * see #Test T003-Add Child Label
- *
- *
- */
-public class AssistantUsage extends AbstractEditorTest {
-
- /**
- *
- */
- protected static final String NESTED_INTERFACE_LABEL = "Interface_Label";
-
- public void openDiagram(IMultiDiagramEditor editor, final String name) {
-
- try {
- ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
- NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
- Diagram diagram = notation.getDiagram(name);
- ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
- flushDisplayEvents();
- } catch (Exception e) {
- throw new IllegalStateException("Cannot initialize test", e);
- }
-
- }
-
- /**
- *
- */
- protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
- /**
- *
- */
- protected static final String CLASS_VISUALID = "2008";
- /**
- *
- */
- protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
-
- @Test
- public void testAssistantForLabelNode() {
- // loading
- DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi");
- Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
-
- // test the data structure that is interpreted by the framework
- ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
- System.out.println(childrenListRepresentation);
- Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
- Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID));
- Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT));
- List<String> the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID);
- Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size());
- Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0));
-
- Assert.assertNotNull("The Nested Interface has to be added", childrenListRepresentation.IDMap.get(NESTED_INTERFACE_LABEL));
- List<String> the_IMPLEMENTED_INTERFACES_Children = childrenListRepresentation.parentChildrenRelation.get(IMPLEMENTED_INTERFACES_HINT);
- Assert.assertEquals("Nested Interface can have a new compartment", 1, the_IMPLEMENTED_INTERFACES_Children.size());
- Assert.assertEquals("Nested Interface has to contain " + NESTED_INTERFACE_LABEL, NESTED_INTERFACE_LABEL, the_IMPLEMENTED_INTERFACES_Children.get(0));
- // the model is valid
- // now launch a class diagram
-
- try {
- initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
- openDiagram(editor, "NewDiagram");
- SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor();
- DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
- Assert.assertNotNull("The diagram must be opened", diagramEditPart);
- IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
- Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
-
- // verify editpolicy
- EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY);
- Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator);
-
-
- // test in the notation
- View classNotationView = classEditPart.getNotationView();
- Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008");
- Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6);
- View compartment = (View) classNotationView.getPersistedChildren().get(5);
- Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType());
-
- // test in the editpart is created for this notation
- Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6);
- IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5);
- Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType());
-
- // load model assistant
- URI assistantURI = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
- assistantURI = assistantURI.appendSegment("models");
- assistantURI = assistantURI.appendSegment("MyChildLabelAssistant.assistants");
- // Assert.assertTrue("The assistant file exist", assistantURI.isFile());
-
- IModelingAssistantModelProvider result = new DefaultModelingAssistantModelProvider(assistantURI);
- Assert.assertNotNull("the assistant model must be loaded", result);
- ModelingAssistantModelRegistry.getInstance().loadModels(result);
- // try to create a label inside this compartment.
- final IElementType interfaceLabelelementType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label");
- List<?> types = ModelingAssistantService.getInstance().getTypesForPopupBar(classEditPart);
- boolean founded = false;
-
- // test the construction of the popupbar
- for (Object object : types) {
- if (object instanceof ProxyElementType) {
- ProxyElementType proxyElementType = (ProxyElementType) object;
- System.out.println(proxyElementType);
-
-
- if (("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label".equals(proxyElementType.getId()))
- && interfaceLabelelementType.equals(proxyElementType.resolveSemanticType())
- && interfaceLabelelementType.equals(proxyElementType.resolveVisualType())) {
-
- // find the good short cut
- founded = true;
- // now construct the request and command to simulate the display inside popup bar
- Request req = CreateViewRequestFactory.getCreateShapeRequest(proxyElementType,
- classEditPart.getDiagramPreferencesHint());
- EditPart targetEditpart = classEditPart.getTargetEditPart(req);
- Assert.assertEquals("the request must be redirect to compartment", compartmentEdiPart, targetEditpart);
- Command cmd = targetEditpart.getCommand(req);
- Assert.assertNotNull("The command must not be null", cmd);
- Assert.assertTrue("The command must be executable", cmd.canExecute());
- }
- }
- }
- Assert.assertTrue("the assistant must contain the shortcut of interface label ", founded);
-
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
- DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
- Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
- URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
- badContextExpansion = badContextExpansion.appendSegment("models");
- badContextExpansion = badContextExpansion.appendSegment(filename);
-
- diagramExpansionsRegistry.loadExpansion(badContextExpansion);
-
- return diagramExpansionsRegistry;
- }
-
- /**
- * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
- *
- * @return
- */
- @Override
- protected String getSourcePath() {
- return "models/";
- }
-
- @Override
- protected Bundle getBundle() {
- return org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getBundle();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.tests;
+
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantService;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.gmfdiag.assistant.core.IModelingAssistantModelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.assistant.internal.core.DefaultModelingAssistantModelProvider;
+import org.eclipse.papyrus.infra.gmfdiag.assistant.internal.core.ModelingAssistantModelRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.assistant.internal.core.util.ProxyElementType;
+import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * this Test is used to test if it is possible to add compartment
+ * see #Test T003-Add Child Label
+ *
+ *
+ */
+public class AssistantUsage extends AbstractEditorTest {
+
+ /**
+ *
+ */
+ protected static final String NESTED_INTERFACE_LABEL = "Interface_Label";
+
+ public void openDiagram(IMultiDiagramEditor editor, final String name) {
+
+ try {
+ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
+ NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
+ Diagram diagram = notation.getDiagram(name);
+ ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
+ flushDisplayEvents();
+ } catch (Exception e) {
+ throw new IllegalStateException("Cannot initialize test", e);
+ }
+
+ }
+
+ /**
+ *
+ */
+ protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
+ /**
+ *
+ */
+ protected static final String CLASS_VISUALID = "2008";
+ /**
+ *
+ */
+ protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
+
+ @Test
+ public void testAssistantForLabelNode() {
+ // loading
+ DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi");
+ Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
+
+ // test the data structure that is interpreted by the framework
+ ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
+ System.out.println(childrenListRepresentation);
+ Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
+ Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID));
+ Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT));
+ List<String> the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID);
+ Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size());
+ Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0));
+
+ Assert.assertNotNull("The Nested Interface has to be added", childrenListRepresentation.IDMap.get(NESTED_INTERFACE_LABEL));
+ List<String> the_IMPLEMENTED_INTERFACES_Children = childrenListRepresentation.parentChildrenRelation.get(IMPLEMENTED_INTERFACES_HINT);
+ Assert.assertEquals("Nested Interface can have a new compartment", 1, the_IMPLEMENTED_INTERFACES_Children.size());
+ Assert.assertEquals("Nested Interface has to contain " + NESTED_INTERFACE_LABEL, NESTED_INTERFACE_LABEL, the_IMPLEMENTED_INTERFACES_Children.get(0));
+ // the model is valid
+ // now launch a class diagram
+
+ try {
+ initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
+ openDiagram(editor, "NewDiagram");
+ SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor();
+ DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
+ Assert.assertNotNull("The diagram must be opened", diagramEditPart);
+ IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
+ Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
+
+ // verify editpolicy
+ EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY);
+ Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator);
+
+
+ // test in the notation
+ View classNotationView = classEditPart.getNotationView();
+ Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008");
+ Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6);
+ View compartment = (View) classNotationView.getPersistedChildren().get(5);
+ Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType());
+
+ // test in the editpart is created for this notation
+ Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6);
+ IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5);
+ Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType());
+
+ // load model assistant
+ URI assistantURI = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
+ assistantURI = assistantURI.appendSegment("models");
+ assistantURI = assistantURI.appendSegment("MyChildLabelAssistant.assistants");
+ // Assert.assertTrue("The assistant file exist", assistantURI.isFile());
+
+ IModelingAssistantModelProvider result = new DefaultModelingAssistantModelProvider(assistantURI);
+ Assert.assertNotNull("the assistant model must be loaded", result);
+ ModelingAssistantModelRegistry.getInstance().loadModels(result);
+ // try to create a label inside this compartment.
+ final IElementType interfaceLabelelementType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label");
+ List<?> types = ModelingAssistantService.getInstance().getTypesForPopupBar(classEditPart);
+ boolean founded = false;
+
+ // test the construction of the popupbar
+ for (Object object : types) {
+ if (object instanceof ProxyElementType) {
+ ProxyElementType proxyElementType = (ProxyElementType) object;
+ System.out.println(proxyElementType);
+
+
+ if (("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label".equals(proxyElementType.getId()))
+ && interfaceLabelelementType.equals(proxyElementType.resolveSemanticType())
+ && interfaceLabelelementType.equals(proxyElementType.resolveVisualType())) {
+
+ // find the good short cut
+ founded = true;
+ // now construct the request and command to simulate the display inside popup bar
+ Request req = CreateViewRequestFactory.getCreateShapeRequest(proxyElementType,
+ classEditPart.getDiagramPreferencesHint());
+ EditPart targetEditpart = classEditPart.getTargetEditPart(req);
+ Assert.assertEquals("the request must be redirect to compartment", compartmentEdiPart, targetEditpart);
+ Command cmd = targetEditpart.getCommand(req);
+ Assert.assertNotNull("The command must not be null", cmd);
+ Assert.assertTrue("The command must be executable", cmd.canExecute());
+ }
+ }
+ }
+ Assert.assertTrue("the assistant must contain the shortcut of interface label ", founded);
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
+ DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
+ diagramExpansionsRegistry.clear();
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
+ URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
+ badContextExpansion = badContextExpansion.appendSegment("models");
+ badContextExpansion = badContextExpansion.appendSegment(filename);
+
+ diagramExpansionsRegistry.loadExpansion(badContextExpansion);
+
+ return diagramExpansionsRegistry;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
+ *
+ * @return
+ */
+ @Override
+ protected String getSourcePath() {
+ return "models/";
+ }
+
+ @Override
+ protected Bundle getBundle() {
+ return FrameworkUtil.getBundle(getClass());
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java
index 115e38f6a47..6697e147972 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java
@@ -1,143 +1,144 @@
-/*****************************************************************************
- * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.common.tests;
-
-import java.util.List;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
-import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * this Test is used to test if it is possible to add compartment
- * see #Test T004-Add Border Item
- *
- *
- */
-public class ExpansionAddBorderItem extends AbstractEditorTest {
-
- /**
- *
- */
- protected static final String INTERFACE_BORDER_ITEM = "Interface_BorderItem";
- /**
- *
- */
- protected static final String NESTED_INTERFACE_LABEL = "Interface_Label";
-
- public void openDiagram(IMultiDiagramEditor editor, final String name) {
-
- try {
- ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
- NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
- Diagram diagram = notation.getDiagram(name);
- ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
- flushDisplayEvents();
- } catch (Exception e) {
- throw new IllegalStateException("Cannot initialize test", e);
- }
-
- }
-
- /**
- *
- */
- protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
- /**
- *
- */
- protected static final String CLASS_VISUALID = "2008";
- /**
- *
- */
- protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
-
- @Test
- public void load_DiagramExpansion() {
- // loading
- DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddBorderItem.xmi");
- Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
-
- // test the data structure that is interpreted by the framework
- ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
- System.out.println(childrenListRepresentation);
- Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
- Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID));
-
- Assert.assertNotNull("The BorderItem of class has been added", childrenListRepresentation.IDMap.get(INTERFACE_BORDER_ITEM));
- List<String> the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID);
- Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size());
- Assert.assertEquals("2008 has to contain " + INTERFACE_BORDER_ITEM, INTERFACE_BORDER_ITEM, the_2008_Children.get(0));
-
- // the model is valid
- // now launch a class diagram
-
- try {
- initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
- openDiagram(editor, "NewDiagram");
- DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
- Assert.assertNotNull("The diagram must be opened", diagramEditPart);
- IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
- Assert.assertNotNull("A Class edit Part must exist", classEditPart);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
- DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
- Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
- URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
- badContextExpansion = badContextExpansion.appendSegment("models");
- badContextExpansion = badContextExpansion.appendSegment(filename);
-
- diagramExpansionsRegistry.loadExpansion(badContextExpansion);
-
- return diagramExpansionsRegistry;
- }
-
- /**
- * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
- *
- * @return
- */
- @Override
- protected String getSourcePath() {
- return "models/";
- }
-
- @Override
- protected Bundle getBundle() {
- return org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getBundle();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.tests;
+
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * this Test is used to test if it is possible to add compartment
+ * see #Test T004-Add Border Item
+ *
+ *
+ */
+public class ExpansionAddBorderItem extends AbstractEditorTest {
+
+ /**
+ *
+ */
+ protected static final String INTERFACE_BORDER_ITEM = "Interface_BorderItem";
+ /**
+ *
+ */
+ protected static final String NESTED_INTERFACE_LABEL = "Interface_Label";
+
+ public void openDiagram(IMultiDiagramEditor editor, final String name) {
+
+ try {
+ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
+ NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
+ Diagram diagram = notation.getDiagram(name);
+ ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
+ flushDisplayEvents();
+ } catch (Exception e) {
+ throw new IllegalStateException("Cannot initialize test", e);
+ }
+
+ }
+
+ /**
+ *
+ */
+ protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
+ /**
+ *
+ */
+ protected static final String CLASS_VISUALID = "2008";
+ /**
+ *
+ */
+ protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
+
+ @Test
+ public void load_DiagramExpansion() {
+ // loading
+ DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddBorderItem.xmi");
+ Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
+
+ // test the data structure that is interpreted by the framework
+ ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
+ System.out.println(childrenListRepresentation);
+ Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
+ Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID));
+
+ Assert.assertNotNull("The BorderItem of class has been added", childrenListRepresentation.IDMap.get(INTERFACE_BORDER_ITEM));
+ List<String> the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID);
+ Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size());
+ Assert.assertEquals("2008 has to contain " + INTERFACE_BORDER_ITEM, INTERFACE_BORDER_ITEM, the_2008_Children.get(0));
+
+ // the model is valid
+ // now launch a class diagram
+
+ try {
+ initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
+ openDiagram(editor, "NewDiagram");
+ DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
+ Assert.assertNotNull("The diagram must be opened", diagramEditPart);
+ IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
+ Assert.assertNotNull("A Class edit Part must exist", classEditPart);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
+ DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
+ diagramExpansionsRegistry.clear();
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
+ URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
+ badContextExpansion = badContextExpansion.appendSegment("models");
+ badContextExpansion = badContextExpansion.appendSegment(filename);
+
+ diagramExpansionsRegistry.loadExpansion(badContextExpansion);
+
+ return diagramExpansionsRegistry;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
+ *
+ * @return
+ */
+ @Override
+ protected String getSourcePath() {
+ return "models/";
+ }
+
+ @Override
+ protected Bundle getBundle() {
+ return FrameworkUtil.getBundle(getClass());
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java
index 4ac12ca2254..f7e1c9197a0 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java
@@ -1,183 +1,184 @@
-/*****************************************************************************
- * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.common.tests;
-
-import java.util.List;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
-import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * this Test is used to test if it is possible to add compartment
- * see #Test T003-Add Child Label
- *
- *
- */
-public class ExpansionAddChildLabel extends AbstractEditorTest {
-
- /**
- *
- */
- protected static final String NESTED_INTERFACE_LABEL = "Interface_Label";
-
- public void openDiagram(IMultiDiagramEditor editor, final String name) {
-
- try {
- ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
- NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
- Diagram diagram = notation.getDiagram(name);
- ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
- flushDisplayEvents();
- } catch (Exception e) {
- throw new IllegalStateException("Cannot initialize test", e);
- }
-
- }
-
- /**
- *
- */
- protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
- /**
- *
- */
- protected static final String CLASS_VISUALID = "2008";
- /**
- *
- */
- protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
-
- @Test
- public void load_DiagramExpansion() {
- // loading
- DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi");
- Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
-
- // test the data structure that is interpreted by the framework
- ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
- System.out.println(childrenListRepresentation);
- Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
- Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID));
- Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT));
- List<String> the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID);
- Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size());
- Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0));
-
- Assert.assertNotNull("The Nested Interface has to be added", childrenListRepresentation.IDMap.get(NESTED_INTERFACE_LABEL));
- List<String> the_IMPLEMENTED_INTERFACES_Children = childrenListRepresentation.parentChildrenRelation.get(IMPLEMENTED_INTERFACES_HINT);
- Assert.assertEquals("Nested Interface can have a new compartment", 1, the_IMPLEMENTED_INTERFACES_Children.size());
- Assert.assertEquals("Nested Interface has to contain " + NESTED_INTERFACE_LABEL, NESTED_INTERFACE_LABEL, the_IMPLEMENTED_INTERFACES_Children.get(0));
- // the model is valid
- // now launch a class diagram
-
- try {
- initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
- openDiagram(editor, "NewDiagram");
- SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor();
- DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
- Assert.assertNotNull("The diagram must be opened", diagramEditPart);
- IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
- Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
-
- // verify editpolicy
- EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY);
- Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator);
-
-
- // test in the notation
- View classNotationView = classEditPart.getNotationView();
- Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008");
- Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6);
- View compartment = (View) classNotationView.getPersistedChildren().get(5);
- Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType());
-
- // test in the editpart is created for this notation
- Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6);
- IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5);
- Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType());
-
- // try to create a label inside this compartment.
- final IElementType interfaceLabelelementType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label");
- CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(interfaceLabelelementType, diagramEditPart.getDiagramPreferencesHint());
- Command command = compartmentEdiPart.getCommand(requestcreation);
- Assert.assertNotNull("the command musbe given", command);
- Assert.assertNotEquals("The command must be not equls to UnexecutableCommand", command, UnexecutableCommand.INSTANCE);
- Assert.assertTrue("The command must be executable", command.canExecute()); //$NON-NLS-1$
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- Assert.assertTrue("The notation compartment must contain a child", compartment.getChildren().size() == 1);
- EditPart createdEditPart = (EditPart) compartmentEdiPart.getChildren().get(0);
- Assert.assertNotNull("the editPart child must be created", createdEditPart);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
- DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
- Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
- URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
- badContextExpansion = badContextExpansion.appendSegment("models");
- badContextExpansion = badContextExpansion.appendSegment(filename);
-
- diagramExpansionsRegistry.loadExpansion(badContextExpansion);
-
- return diagramExpansionsRegistry;
- }
-
- /**
- * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
- *
- * @return
- */
- @Override
- protected String getSourcePath() {
- return "models/";
- }
-
- @Override
- protected Bundle getBundle() {
- return org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getBundle();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.tests;
+
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * this Test is used to test if it is possible to add compartment
+ * see #Test T003-Add Child Label
+ *
+ *
+ */
+public class ExpansionAddChildLabel extends AbstractEditorTest {
+
+ /**
+ *
+ */
+ protected static final String NESTED_INTERFACE_LABEL = "Interface_Label";
+
+ public void openDiagram(IMultiDiagramEditor editor, final String name) {
+
+ try {
+ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
+ NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
+ Diagram diagram = notation.getDiagram(name);
+ ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
+ flushDisplayEvents();
+ } catch (Exception e) {
+ throw new IllegalStateException("Cannot initialize test", e);
+ }
+
+ }
+
+ /**
+ *
+ */
+ protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
+ /**
+ *
+ */
+ protected static final String CLASS_VISUALID = "2008";
+ /**
+ *
+ */
+ protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
+
+ @Test
+ public void load_DiagramExpansion() {
+ // loading
+ DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi");
+ Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
+
+ // test the data structure that is interpreted by the framework
+ ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
+ System.out.println(childrenListRepresentation);
+ Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
+ Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID));
+ Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT));
+ List<String> the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID);
+ Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size());
+ Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0));
+
+ Assert.assertNotNull("The Nested Interface has to be added", childrenListRepresentation.IDMap.get(NESTED_INTERFACE_LABEL));
+ List<String> the_IMPLEMENTED_INTERFACES_Children = childrenListRepresentation.parentChildrenRelation.get(IMPLEMENTED_INTERFACES_HINT);
+ Assert.assertEquals("Nested Interface can have a new compartment", 1, the_IMPLEMENTED_INTERFACES_Children.size());
+ Assert.assertEquals("Nested Interface has to contain " + NESTED_INTERFACE_LABEL, NESTED_INTERFACE_LABEL, the_IMPLEMENTED_INTERFACES_Children.get(0));
+ // the model is valid
+ // now launch a class diagram
+
+ try {
+ initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
+ openDiagram(editor, "NewDiagram");
+ SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor();
+ DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
+ Assert.assertNotNull("The diagram must be opened", diagramEditPart);
+ IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
+ Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
+
+ // verify editpolicy
+ EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY);
+ Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator);
+
+
+ // test in the notation
+ View classNotationView = classEditPart.getNotationView();
+ Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008");
+ Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6);
+ View compartment = (View) classNotationView.getPersistedChildren().get(5);
+ Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType());
+
+ // test in the editpart is created for this notation
+ Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6);
+ IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5);
+ Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType());
+
+ // try to create a label inside this compartment.
+ final IElementType interfaceLabelelementType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.diagram.testexpansion.Interface_Label");
+ CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(interfaceLabelelementType, diagramEditPart.getDiagramPreferencesHint());
+ Command command = compartmentEdiPart.getCommand(requestcreation);
+ Assert.assertNotNull("the command musbe given", command);
+ Assert.assertNotEquals("The command must be not equls to UnexecutableCommand", command, UnexecutableCommand.INSTANCE);
+ Assert.assertTrue("The command must be executable", command.canExecute()); //$NON-NLS-1$
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ Assert.assertTrue("The notation compartment must contain a child", compartment.getChildren().size() == 1);
+ EditPart createdEditPart = (EditPart) compartmentEdiPart.getChildren().get(0);
+ Assert.assertNotNull("the editPart child must be created", createdEditPart);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
+ DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
+ diagramExpansionsRegistry.clear();
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
+ URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
+ badContextExpansion = badContextExpansion.appendSegment("models");
+ badContextExpansion = badContextExpansion.appendSegment(filename);
+
+ diagramExpansionsRegistry.loadExpansion(badContextExpansion);
+
+ return diagramExpansionsRegistry;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
+ *
+ * @return
+ */
+ @Override
+ protected String getSourcePath() {
+ return "models/";
+ }
+
+ @Override
+ protected Bundle getBundle() {
+ return FrameworkUtil.getBundle(getClass());
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java
index 39bd3da6bd0..7363af14111 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java
@@ -1,154 +1,155 @@
-/*****************************************************************************
- * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.common.tests;
-
-import java.util.List;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
-import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * this Test is used to test if it is possible to add compartment
- * see #Test T002-Add a compartment
- *
- *
- */
-public class ExpansionAddCompartment extends AbstractEditorTest {
-
- public void openDiagram(IMultiDiagramEditor editor, final String name) {
-
- try {
- ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
- NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
- Diagram diagram = notation.getDiagram(name);
- ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
- flushDisplayEvents();
- } catch (Exception e) {
- throw new IllegalStateException("Cannot initialize test", e);
- }
-
- }
-
- /**
- *
- */
- protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
- /**
- *
- */
- protected static final String CLASS_VISUALID = "2008";
- /**
- *
- */
- protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
-
- @Test
- public void load_DiagramExpansion() {
- // loading
- DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddCompartment.xmi");
- Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
-
- // test the data structure that is interpreted by the framework
- ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
- System.out.println(childrenListRepresentation);
- Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
- Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID));
- Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT));
- List<String> the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID);
- Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size());
- Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0));
-
- // the model is valid
- // now launch a class diagram
-
- try {
- initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
- openDiagram(editor, "NewDiagram");
- DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
- Assert.assertNotNull("The diagram must be opened", diagramEditPart);
- IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
- Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
-
- // verify editpolicy
- EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY);
- Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator);
-
-
- // test in the notation
- View classNotationView = classEditPart.getNotationView();
- Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008");
- Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6);
- View compartment = (View) classNotationView.getPersistedChildren().get(5);
- Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType());
-
- // test in the editpart is created for this notation
- Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6);
- IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5);
- if (compartmentEdiPart.getNotationView().equals(compartment)) {
- Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
- DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
- Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
- URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
- badContextExpansion = badContextExpansion.appendSegment("models");
- badContextExpansion = badContextExpansion.appendSegment(filename);
-
- diagramExpansionsRegistry.loadExpansion(badContextExpansion);
-
- return diagramExpansionsRegistry;
- }
-
- /**
- * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
- *
- * @return
- */
- @Override
- protected String getSourcePath() {
- return "models/";
- }
-
- @Override
- protected Bundle getBundle() {
- return org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getBundle();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.tests;
+
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * this Test is used to test if it is possible to add compartment
+ * see #Test T002-Add a compartment
+ *
+ *
+ */
+public class ExpansionAddCompartment extends AbstractEditorTest {
+
+ public void openDiagram(IMultiDiagramEditor editor, final String name) {
+
+ try {
+ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
+ NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
+ Diagram diagram = notation.getDiagram(name);
+ ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
+ flushDisplayEvents();
+ } catch (Exception e) {
+ throw new IllegalStateException("Cannot initialize test", e);
+ }
+
+ }
+
+ /**
+ *
+ */
+ protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
+ /**
+ *
+ */
+ protected static final String CLASS_VISUALID = "2008";
+ /**
+ *
+ */
+ protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
+
+ @Test
+ public void load_DiagramExpansion() {
+ // loading
+ DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddCompartment.xmi");
+ Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
+
+ // test the data structure that is interpreted by the framework
+ ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
+ System.out.println(childrenListRepresentation);
+ Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
+ Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID));
+ Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT));
+ List<String> the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID);
+ Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size());
+ Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0));
+
+ // the model is valid
+ // now launch a class diagram
+
+ try {
+ initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
+ openDiagram(editor, "NewDiagram");
+ DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
+ Assert.assertNotNull("The diagram must be opened", diagramEditPart);
+ IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
+ Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
+
+ // verify editpolicy
+ EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY);
+ Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator);
+
+
+ // test in the notation
+ View classNotationView = classEditPart.getNotationView();
+ Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008");
+ Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6);
+ View compartment = (View) classNotationView.getPersistedChildren().get(5);
+ Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType());
+
+ // test in the editpart is created for this notation
+ Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6);
+ IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5);
+ if (compartmentEdiPart.getNotationView().equals(compartment)) {
+ Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
+ DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
+ diagramExpansionsRegistry.clear();
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
+ URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
+ badContextExpansion = badContextExpansion.appendSegment("models");
+ badContextExpansion = badContextExpansion.appendSegment(filename);
+
+ diagramExpansionsRegistry.loadExpansion(badContextExpansion);
+
+ return diagramExpansionsRegistry;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
+ *
+ * @return
+ */
+ @Override
+ protected String getSourcePath() {
+ return "models/";
+ }
+
+ @Override
+ protected Bundle getBundle() {
+ return FrameworkUtil.getBundle(getClass());
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java
index b2ab26852ff..e58fc89830c 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java
@@ -1,154 +1,155 @@
-/*****************************************************************************
- * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.common.tests;
-
-import java.util.List;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
-import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * this Test is used to test if it is possible to add compartment
- * see #Test T006-Add Compartment with Kind
- *
- *
- */
-public class ExpansionAddCompartmentWithKind extends AbstractEditorTest {
-
- public void openDiagram(IMultiDiagramEditor editor, final String name) {
-
- try {
- ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
- NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
- Diagram diagram = notation.getDiagram(name);
- ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
- flushDisplayEvents();
- } catch (Exception e) {
- throw new IllegalStateException("Cannot initialize test", e);
- }
-
- }
-
- /**
- *
- */
- protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
- /**
- *
- */
- protected static final String CLASS_VISUALID = "2008";
- /**
- *
- */
- protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
-
- @Test
- public void load_DiagramExpansion() {
- // loading
- DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddCompartmentWithKind.xmi");
- Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
-
- // test the data structure that is interpreted by the framework
- ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
- System.out.println(childrenListRepresentation);
- Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
- Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID));
- Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT));
- List<String> the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID);
- Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size());
- Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0));
-
- // the model is valid
- // now launch a class diagram
-
- try {
- initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
- openDiagram(editor, "NewDiagram");
- DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
- Assert.assertNotNull("The diagram must be opened", diagramEditPart);
- IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
- Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
-
- // verify editpolicy
- EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY);
- Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator);
-
-
- // test in the notation
- View classNotationView = classEditPart.getNotationView();
- Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008");
- Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6);
- View compartment = (View) classNotationView.getPersistedChildren().get(5);
- Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType());
-
- // test in the editpart is created for this notation
- Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6);
- IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5);
- if (compartmentEdiPart.getNotationView().equals(compartment)) {
- Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
- DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
- Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
- URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
- badContextExpansion = badContextExpansion.appendSegment("models");
- badContextExpansion = badContextExpansion.appendSegment(filename);
-
- diagramExpansionsRegistry.loadExpansion(badContextExpansion);
-
- return diagramExpansionsRegistry;
- }
-
- /**
- * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
- *
- * @return
- */
- @Override
- protected String getSourcePath() {
- return "models/";
- }
-
- @Override
- protected Bundle getBundle() {
- return org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getBundle();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.tests;
+
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.InducedRepresentationCreationEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * this Test is used to test if it is possible to add compartment
+ * see #Test T006-Add Compartment with Kind
+ *
+ *
+ */
+public class ExpansionAddCompartmentWithKind extends AbstractEditorTest {
+
+ public void openDiagram(IMultiDiagramEditor editor, final String name) {
+
+ try {
+ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
+ NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
+ Diagram diagram = notation.getDiagram(name);
+ ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
+ flushDisplayEvents();
+ } catch (Exception e) {
+ throw new IllegalStateException("Cannot initialize test", e);
+ }
+
+ }
+
+ /**
+ *
+ */
+ protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
+ /**
+ *
+ */
+ protected static final String CLASS_VISUALID = "2008";
+ /**
+ *
+ */
+ protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
+
+ @Test
+ public void load_DiagramExpansion() {
+ // loading
+ DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddCompartmentWithKind.xmi");
+ Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
+
+ // test the data structure that is interpreted by the framework
+ ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
+ System.out.println(childrenListRepresentation);
+ Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
+ Assert.assertNotNull("The class has been redefined", childrenListRepresentation.IDMap.get(CLASS_VISUALID));
+ Assert.assertNotNull("The compartment of class has been added", childrenListRepresentation.IDMap.get(IMPLEMENTED_INTERFACES_HINT));
+ List<String> the_2008_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_VISUALID);
+ Assert.assertEquals("2008 can have a new compartment", 1, the_2008_Children.size());
+ Assert.assertEquals("2008 has to contain " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, the_2008_Children.get(0));
+
+ // the model is valid
+ // now launch a class diagram
+
+ try {
+ initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
+ openDiagram(editor, "NewDiagram");
+ DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
+ Assert.assertNotNull("The diagram must be opened", diagramEditPart);
+ IGraphicalEditPart classEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
+ Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
+
+ // verify editpolicy
+ EditPolicy inducedRepresentationCreator = classEditPart.getEditPolicy(InducedRepresentationCreationEditPolicy.INDUCED_REPRESENTATION_CREATOR_EDITPOLICY);
+ Assert.assertNotNull("A Class must have this editpolicy", inducedRepresentationCreator);
+
+
+ // test in the notation
+ View classNotationView = classEditPart.getNotationView();
+ Assert.assertEquals("the Type of class editpart must be 2008", classNotationView.getType(), "2008");
+ Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classNotationView.getPersistedChildren().size(), 6);
+ View compartment = (View) classNotationView.getPersistedChildren().get(5);
+ Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartment.getType());
+
+ // test in the editpart is created for this notation
+ Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", classEditPart.getChildren().size(), 6);
+ IGraphicalEditPart compartmentEdiPart = (IGraphicalEditPart) classEditPart.getChildren().get(5);
+ if (compartmentEdiPart.getNotationView().equals(compartment)) {
+ Assert.assertEquals("The last compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPart.getNotationView().getType());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
+ DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
+ diagramExpansionsRegistry.clear();
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
+ URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
+ badContextExpansion = badContextExpansion.appendSegment("models");
+ badContextExpansion = badContextExpansion.appendSegment(filename);
+
+ diagramExpansionsRegistry.loadExpansion(badContextExpansion);
+
+ return diagramExpansionsRegistry;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
+ *
+ * @return
+ */
+ @Override
+ protected String getSourcePath() {
+ return "models/";
+ }
+
+ @Override
+ protected Bundle getBundle() {
+ return FrameworkUtil.getBundle(getClass());
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java
index 235c7ba2d84..5fa63a5da02 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java
@@ -1,169 +1,170 @@
-/*****************************************************************************
- * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.common.tests;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
-import org.eclipse.papyrus.infra.types.core.registries.ElementTypeConfigurationTypeRegistry;
-import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * this Test is used to test if it is possible to add compartment
- * see #Test T005-Add link
- *
- *
- */
-public class ExpansionAddLink extends AbstractEditorTest {
-
-
- public void openDiagram(IMultiDiagramEditor editor, final String name) {
-
- try {
- ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
- NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
- Diagram diagram = notation.getDiagram(name);
- ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
- flushDisplayEvents();
- } catch (Exception e) {
- throw new IllegalStateException("Cannot initialize test", e);
- }
-
- }
-
- protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
- protected static final String DEPENDENCY_HINT = "Dependency_Link";
- protected static final String NEW_DEPENDENCY_ELEMENTTYPE_ID = "org.eclipse.papyrus.uml.diagram.testexpansion.Dependency_Link";
-
- @Test
- public void load_DiagramExpansion() {
- // loading
- DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddLink.xmi");
- Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
-
- // test the data structure that is interpreted by the framework
- ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
- System.out.println(childrenListRepresentation);
- Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
-
- Assert.assertNotNull("The Link of NewDependency has been added", childrenListRepresentation.IDMap.get(DEPENDENCY_HINT));
- List<String> the_ClassDiagram_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_DIAGRAM_TYPE);
- Assert.assertEquals("The class Diagram can have a new child", 1, the_ClassDiagram_Children.size());
- Assert.assertEquals("class Diagram has to contain " + DEPENDENCY_HINT, DEPENDENCY_HINT, the_ClassDiagram_Children.get(0));
-
-
- // the model is valid
- // now launch a class diagram
-
- try {
- initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
- openDiagram(editor, "NewDiagram");
- SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor();
- DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
- Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
- Assert.assertNotNull("The diagram must be opened", diagramEditPart);
- Assert.assertEquals("The class diagram has to contain two class representation", 2, diagramEditPart.getChildren().size());
- IGraphicalEditPart myclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
- IGraphicalEditPart myOtherclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(1);
- Assert.assertNotNull("myclassEditPart edit Part must exist", myclassEditPart);
- Assert.assertNotNull("myOtherclassEditPart edit Part must exist", myOtherclassEditPart);
- ElementTypeConfigurationTypeRegistry.getInstance();
- final IElementType elementType_Dependency = ElementTypeRegistry.getInstance().getType(NEW_DEPENDENCY_ELEMENTTYPE_ID);
-
- Command command = myOtherclassEditPart.getCommand(createConnectionViewRequest(elementType_Dependency, myclassEditPart, myOtherclassEditPart, diagramEditPart));
- assertNotNull("The command to create link must be not null", command);
- assertTrue("The command to create link must be executable", command.canExecute() == true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue("The edge must be created", (diagramEditPart.getDiagramView()).getEdges().size() == 1);
- org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart linkEditPart = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) diagramEditPart.getConnections().get(0);
- Assert.assertNotNull("linkEditPart edit Part must exist", linkEditPart);
- Assert.assertEquals("The link must have the type " + DEPENDENCY_HINT, DEPENDENCY_HINT, linkEditPart.getNotationView().getType());
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, DiagramEditPart diagramEditPart) {
- CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, diagramEditPart.getDiagramPreferencesHint());
- connectionRequest.setSourceEditPart(null);
- connectionRequest.setTargetEditPart(source);
- connectionRequest.setType(RequestConstants.REQ_CONNECTION_START);
- source.getCommand(connectionRequest);
- // Now, setup the request in preparation to get the
- // connection end
- // command.
- connectionRequest.setSourceEditPart(source);
- connectionRequest.setTargetEditPart(target);
- connectionRequest.setType(RequestConstants.REQ_CONNECTION_END);
- return connectionRequest;
- }
-
- protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
- DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
- Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
- URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
- badContextExpansion = badContextExpansion.appendSegment("models");
- badContextExpansion = badContextExpansion.appendSegment(filename);
-
- diagramExpansionsRegistry.loadExpansion(badContextExpansion);
-
- return diagramExpansionsRegistry;
- }
-
- /**
- * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
- *
- * @return
- */
- @Override
- protected String getSourcePath() {
- return "models/";
- }
-
- @Override
- protected Bundle getBundle() {
- return org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getBundle();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.tests;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.types.core.registries.ElementTypeConfigurationTypeRegistry;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * this Test is used to test if it is possible to add compartment
+ * see #Test T005-Add link
+ *
+ *
+ */
+public class ExpansionAddLink extends AbstractEditorTest {
+
+
+ public void openDiagram(IMultiDiagramEditor editor, final String name) {
+
+ try {
+ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
+ NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
+ Diagram diagram = notation.getDiagram(name);
+ ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
+ flushDisplayEvents();
+ } catch (Exception e) {
+ throw new IllegalStateException("Cannot initialize test", e);
+ }
+
+ }
+
+ protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
+ protected static final String DEPENDENCY_HINT = "Dependency_Link";
+ protected static final String NEW_DEPENDENCY_ELEMENTTYPE_ID = "org.eclipse.papyrus.uml.diagram.testexpansion.Dependency_Link";
+
+ @Test
+ public void load_DiagramExpansion() {
+ // loading
+ DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddLink.xmi");
+ Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
+
+ // test the data structure that is interpreted by the framework
+ ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
+ System.out.println(childrenListRepresentation);
+ Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
+
+ Assert.assertNotNull("The Link of NewDependency has been added", childrenListRepresentation.IDMap.get(DEPENDENCY_HINT));
+ List<String> the_ClassDiagram_Children = childrenListRepresentation.parentChildrenRelation.get(CLASS_DIAGRAM_TYPE);
+ Assert.assertEquals("The class Diagram can have a new child", 1, the_ClassDiagram_Children.size());
+ Assert.assertEquals("class Diagram has to contain " + DEPENDENCY_HINT, DEPENDENCY_HINT, the_ClassDiagram_Children.get(0));
+
+
+ // the model is valid
+ // now launch a class diagram
+
+ try {
+ initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
+ openDiagram(editor, "NewDiagram");
+ SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor();
+ DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
+ Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
+ Assert.assertNotNull("The diagram must be opened", diagramEditPart);
+ Assert.assertEquals("The class diagram has to contain two class representation", 2, diagramEditPart.getChildren().size());
+ IGraphicalEditPart myclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
+ IGraphicalEditPart myOtherclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(1);
+ Assert.assertNotNull("myclassEditPart edit Part must exist", myclassEditPart);
+ Assert.assertNotNull("myOtherclassEditPart edit Part must exist", myOtherclassEditPart);
+ ElementTypeConfigurationTypeRegistry.getInstance();
+ final IElementType elementType_Dependency = ElementTypeRegistry.getInstance().getType(NEW_DEPENDENCY_ELEMENTTYPE_ID);
+
+ Command command = myOtherclassEditPart.getCommand(createConnectionViewRequest(elementType_Dependency, myclassEditPart, myOtherclassEditPart, diagramEditPart));
+ assertNotNull("The command to create link must be not null", command);
+ assertTrue("The command to create link must be executable", command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue("The edge must be created", (diagramEditPart.getDiagramView()).getEdges().size() == 1);
+ org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart linkEditPart = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) diagramEditPart.getConnections().get(0);
+ Assert.assertNotNull("linkEditPart edit Part must exist", linkEditPart);
+ Assert.assertEquals("The link must have the type " + DEPENDENCY_HINT, DEPENDENCY_HINT, linkEditPart.getNotationView().getType());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, DiagramEditPart diagramEditPart) {
+ CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, diagramEditPart.getDiagramPreferencesHint());
+ connectionRequest.setSourceEditPart(null);
+ connectionRequest.setTargetEditPart(source);
+ connectionRequest.setType(RequestConstants.REQ_CONNECTION_START);
+ source.getCommand(connectionRequest);
+ // Now, setup the request in preparation to get the
+ // connection end
+ // command.
+ connectionRequest.setSourceEditPart(source);
+ connectionRequest.setTargetEditPart(target);
+ connectionRequest.setType(RequestConstants.REQ_CONNECTION_END);
+ return connectionRequest;
+ }
+
+ protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
+ DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
+ diagramExpansionsRegistry.clear();
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
+ URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
+ badContextExpansion = badContextExpansion.appendSegment("models");
+ badContextExpansion = badContextExpansion.appendSegment(filename);
+
+ diagramExpansionsRegistry.loadExpansion(badContextExpansion);
+
+ return diagramExpansionsRegistry;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
+ *
+ * @return
+ */
+ @Override
+ protected String getSourcePath() {
+ return "models/";
+ }
+
+ @Override
+ protected Bundle getBundle() {
+ return FrameworkUtil.getBundle(getClass());
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java
index 02af83eeaec..39b3ddd3375 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java
@@ -1,231 +1,232 @@
-/*****************************************************************************
- * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.common.tests;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
-import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
-import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Element;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * this Test is used to test if it is possible to drop element from the model explorer
- * see #Test T006-Drop of Elements
- *
- *
- */
-public class ExpansionDropElements extends AbstractEditorTest {
-
-
- public void openDiagram(IMultiDiagramEditor editor, final String name) {
-
- try {
- ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
- NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
- Diagram diagram = notation.getDiagram(name);
- ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
- flushDisplayEvents();
- } catch (Exception e) {
- throw new IllegalStateException("Cannot initialize test", e);
- }
-
- }
-
- protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
- protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
-
- @Test
- public void testDropInsidecontainer() {
- // loading
- DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi");
- Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
-
- // test the data structure that is interpreted by the framework
- ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
- Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
-
-
-
- // the model is valid
- // now launch a class diagram
-
- try {
- initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
- openDiagram(editor, "NewDiagram");
- SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor();
- DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
- Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
- Assert.assertNotNull("The diagram must be opened", diagramEditPart);
- Assert.assertEquals("The class diagram has to contain two class representation", 2, diagramEditPart.getChildren().size());
- IGraphicalEditPart myclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
- IGraphicalEditPart myOtherclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(1);
- Assert.assertNotNull("myclassEditPart edit Part must exist", myclassEditPart);
- Assert.assertNotNull("myOtherclassEditPart edit Part must exist", myOtherclassEditPart);
- // get Child of myclassEditPart
- Class myclass = (Class) myclassEditPart.resolveSemanticElement();
- Assert.assertEquals("The class must be called", "MyClass", myclass.getName());
- Classifier nestedInterface = myclass.getNestedClassifier("MyNestedInterface");
- Assert.assertNotNull("MyClass must have a nested Interface called --MyNestedInterface--", nestedInterface);
-
- // try to drop on my class
- Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", myclassEditPart.getChildren().size(), 6);
- IGraphicalEditPart compartmentEdiPartMyClass = (IGraphicalEditPart) myclassEditPart.getChildren().get(5);
- Assert.assertEquals("the compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPartMyClass.getNotationView().getType());
-
- DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
- ArrayList<Element> list = new ArrayList<Element>();
- list.add(nestedInterface);
- dropObjectsRequest.setObjects(list);
- dropObjectsRequest.setLocation(new Point(40, 40));
- Command command = compartmentEdiPartMyClass.getCommand(dropObjectsRequest);
- assertNotNull("the command of drop must not be null", command);
- assertTrue("The command of drop must be executable", command != UnexecutableCommand.INSTANCE);
- assertTrue("The command of drop must be executable", command.canExecute());
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- Assert.assertEquals("The representation of the child must be dropped", 1, compartmentEdiPartMyClass.getChildren().size());
-
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- @Test
- public void testDropInsideBadcontainer() {
- // loading
- DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi");
- Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
-
- // test the data structure that is interpreted by the framework
- ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
- Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
-
-
-
- // the model is valid
- // now launch a class diagram
-
- try {
- initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
- openDiagram(editor, "NewDiagram");
- DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
- Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
- Assert.assertNotNull("The diagram must be opened", diagramEditPart);
- Assert.assertEquals("The class diagram has to contain two class representation", 2, diagramEditPart.getChildren().size());
- IGraphicalEditPart myclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
- IGraphicalEditPart myOtherclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(1);
- Assert.assertNotNull("myclassEditPart edit Part must exist", myclassEditPart);
- Assert.assertNotNull("myOtherclassEditPart edit Part must exist", myOtherclassEditPart);
- // get Child of myclassEditPart
- Class myclass = (Class) myclassEditPart.resolveSemanticElement();
- Assert.assertEquals("The class must be called", "MyClass", myclass.getName());
- Classifier nestedInterface = myclass.getNestedClassifier("MyNestedInterface");
- Assert.assertNotNull("MyClass must have a nested Interface called --MyNestedInterface--", nestedInterface);
-
- // try to drop on my class
- Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", myclassEditPart.getChildren().size(), 6);
- IGraphicalEditPart compartmentEdiPartMyOtherClass = (IGraphicalEditPart) myOtherclassEditPart.getChildren().get(5);
- Assert.assertEquals("the compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPartMyOtherClass.getNotationView().getType());
-
- DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
- ArrayList<Element> list = new ArrayList<Element>();
- list.add(nestedInterface);
- dropObjectsRequest.setObjects(list);
- dropObjectsRequest.setLocation(new Point(40, 40));
- Command command = compartmentEdiPartMyOtherClass.getCommand(dropObjectsRequest);
- Assert.assertNull("the command of drop must be null", command);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, DiagramEditPart diagramEditPart) {
- CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, diagramEditPart.getDiagramPreferencesHint());
- connectionRequest.setSourceEditPart(null);
- connectionRequest.setTargetEditPart(source);
- connectionRequest.setType(RequestConstants.REQ_CONNECTION_START);
- source.getCommand(connectionRequest);
- // Now, setup the request in preparation to get the
- // connection end
- // command.
- connectionRequest.setSourceEditPart(source);
- connectionRequest.setTargetEditPart(target);
- connectionRequest.setType(RequestConstants.REQ_CONNECTION_END);
- return connectionRequest;
- }
-
- protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
- DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
- Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
- URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
- badContextExpansion = badContextExpansion.appendSegment("models");
- badContextExpansion = badContextExpansion.appendSegment(filename);
-
- diagramExpansionsRegistry.loadExpansion(badContextExpansion);
-
- return diagramExpansionsRegistry;
- }
-
- /**
- * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
- *
- * @return
- */
- @Override
- protected String getSourcePath() {
- return "models/";
- }
-
- @Override
- protected Bundle getBundle() {
- return org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getBundle();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.gmfdiag.common.tests;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.ChildrenListRepresentation;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
+import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Element;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * this Test is used to test if it is possible to drop element from the model explorer
+ * see #Test T006-Drop of Elements
+ *
+ *
+ */
+public class ExpansionDropElements extends AbstractEditorTest {
+
+
+ public void openDiagram(IMultiDiagramEditor editor, final String name) {
+
+ try {
+ ModelSet modelSet = ServiceUtils.getInstance().getModelSet(editor.getServicesRegistry());
+ NotationModel notation = (NotationModel) modelSet.getModel(NotationModel.MODEL_ID);
+ Diagram diagram = notation.getDiagram(name);
+ ServiceUtils.getInstance().getService(IPageManager.class, editor.getServicesRegistry()).openPage(diagram);
+ flushDisplayEvents();
+ } catch (Exception e) {
+ throw new IllegalStateException("Cannot initialize test", e);
+ }
+
+ }
+
+ protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
+ protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
+
+ @Test
+ public void testDropInsidecontainer() {
+ // loading
+ DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi");
+ Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
+
+ // test the data structure that is interpreted by the framework
+ ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
+ Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
+
+
+
+ // the model is valid
+ // now launch a class diagram
+
+ try {
+ initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
+ openDiagram(editor, "NewDiagram");
+ SynchronizableGmfDiagramEditor diagramEditor = (SynchronizableGmfDiagramEditor) editor.getActiveEditor();
+ DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
+ Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
+ Assert.assertNotNull("The diagram must be opened", diagramEditPart);
+ Assert.assertEquals("The class diagram has to contain two class representation", 2, diagramEditPart.getChildren().size());
+ IGraphicalEditPart myclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
+ IGraphicalEditPart myOtherclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(1);
+ Assert.assertNotNull("myclassEditPart edit Part must exist", myclassEditPart);
+ Assert.assertNotNull("myOtherclassEditPart edit Part must exist", myOtherclassEditPart);
+ // get Child of myclassEditPart
+ Class myclass = (Class) myclassEditPart.resolveSemanticElement();
+ Assert.assertEquals("The class must be called", "MyClass", myclass.getName());
+ Classifier nestedInterface = myclass.getNestedClassifier("MyNestedInterface");
+ Assert.assertNotNull("MyClass must have a nested Interface called --MyNestedInterface--", nestedInterface);
+
+ // try to drop on my class
+ Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", myclassEditPart.getChildren().size(), 6);
+ IGraphicalEditPart compartmentEdiPartMyClass = (IGraphicalEditPart) myclassEditPart.getChildren().get(5);
+ Assert.assertEquals("the compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPartMyClass.getNotationView().getType());
+
+ DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
+ ArrayList<Element> list = new ArrayList<Element>();
+ list.add(nestedInterface);
+ dropObjectsRequest.setObjects(list);
+ dropObjectsRequest.setLocation(new Point(40, 40));
+ Command command = compartmentEdiPartMyClass.getCommand(dropObjectsRequest);
+ assertNotNull("the command of drop must not be null", command);
+ assertTrue("The command of drop must be executable", command != UnexecutableCommand.INSTANCE);
+ assertTrue("The command of drop must be executable", command.canExecute());
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ Assert.assertEquals("The representation of the child must be dropped", 1, compartmentEdiPartMyClass.getChildren().size());
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testDropInsideBadcontainer() {
+ // loading
+ DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("AddChildLabel.xmi");
+ Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 1", 1, diagramExpansionsRegistry.mapChildreen.size());
+
+ // test the data structure that is interpreted by the framework
+ ChildrenListRepresentation childrenListRepresentation = diagramExpansionsRegistry.mapChildreen.get(CLASS_DIAGRAM_TYPE);
+ Assert.assertNotNull("A usage contex has been defined for " + CLASS_DIAGRAM_TYPE, childrenListRepresentation);
+
+
+
+ // the model is valid
+ // now launch a class diagram
+
+ try {
+ initModel("ExpansionModelProject", "ExpansionModelTest", getBundle());
+ openDiagram(editor, "NewDiagram");
+ DiagramEditPart diagramEditPart = editor.getAdapter(DiagramEditPart.class);
+ Assert.assertNotNull("A Class edit Part must exist", diagramEditPart);
+ Assert.assertNotNull("The diagram must be opened", diagramEditPart);
+ Assert.assertEquals("The class diagram has to contain two class representation", 2, diagramEditPart.getChildren().size());
+ IGraphicalEditPart myclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(0);
+ IGraphicalEditPart myOtherclassEditPart = (IGraphicalEditPart) diagramEditPart.getChildren().get(1);
+ Assert.assertNotNull("myclassEditPart edit Part must exist", myclassEditPart);
+ Assert.assertNotNull("myOtherclassEditPart edit Part must exist", myOtherclassEditPart);
+ // get Child of myclassEditPart
+ Class myclass = (Class) myclassEditPart.resolveSemanticElement();
+ Assert.assertEquals("The class must be called", "MyClass", myclass.getName());
+ Classifier nestedInterface = myclass.getNestedClassifier("MyNestedInterface");
+ Assert.assertNotNull("MyClass must have a nested Interface called --MyNestedInterface--", nestedInterface);
+
+ // try to drop on my class
+ Assert.assertEquals("the Type of class editpart must be 2008 must contains 2 labels and 4 compartments", myclassEditPart.getChildren().size(), 6);
+ IGraphicalEditPart compartmentEdiPartMyOtherClass = (IGraphicalEditPart) myOtherclassEditPart.getChildren().get(5);
+ Assert.assertEquals("the compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPartMyOtherClass.getNotationView().getType());
+
+ DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
+ ArrayList<Element> list = new ArrayList<Element>();
+ list.add(nestedInterface);
+ dropObjectsRequest.setObjects(list);
+ dropObjectsRequest.setLocation(new Point(40, 40));
+ Command command = compartmentEdiPartMyOtherClass.getCommand(dropObjectsRequest);
+ Assert.assertNull("the command of drop must be null", command);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target, DiagramEditPart diagramEditPart) {
+ CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, diagramEditPart.getDiagramPreferencesHint());
+ connectionRequest.setSourceEditPart(null);
+ connectionRequest.setTargetEditPart(source);
+ connectionRequest.setType(RequestConstants.REQ_CONNECTION_START);
+ source.getCommand(connectionRequest);
+ // Now, setup the request in preparation to get the
+ // connection end
+ // command.
+ connectionRequest.setSourceEditPart(source);
+ connectionRequest.setTargetEditPart(target);
+ connectionRequest.setType(RequestConstants.REQ_CONNECTION_END);
+ return connectionRequest;
+ }
+
+ protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
+ DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
+ diagramExpansionsRegistry.clear();
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
+ URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
+ badContextExpansion = badContextExpansion.appendSegment("models");
+ badContextExpansion = badContextExpansion.appendSegment(filename);
+
+ diagramExpansionsRegistry.loadExpansion(badContextExpansion);
+
+ return diagramExpansionsRegistry;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest#getSourcePath()
+ *
+ * @return
+ */
+ @Override
+ protected String getSourcePath() {
+ return "models/";
+ }
+
+ @Override
+ protected Bundle getBundle() {
+ return FrameworkUtil.getBundle(getClass());
+ }
+}
diff --git a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/META-INF/MANIFEST.MF
index 0da19b0558a..b89a151e759 100644
--- a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/META-INF/MANIFEST.MF
@@ -4,15 +4,15 @@ Require-Bundle: org.eclipse.uml2.uml;bundle-version="3.1.0",
org.junit;bundle-version="4.10.0",
org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.notation;bundle-version="1.8.0"
+ org.eclipse.gmf.runtime.notation;bundle-version="1.8.0",
+ org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.2.0"
Export-Package: org.eclipse.papyrus.infra.services.resourceloading.tests,
org.eclipse.papyrus.infra.services.resourceloading.tests.testModel1,
org.eclipse.papyrus.infra.services.resourceloading.tests.testModel2
Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.2.0"
Bundle-Version: 1.2.0.qualifier
Bundle-Name: %fragmentName
-Bundle-Localization: fragment
+Bundle-Localization: plugin
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.infra.services.resourceloading.tests
+Bundle-SymbolicName: org.eclipse.papyrus.infra.services.resourceloading.tests;singleton:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/build.properties b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/build.properties
index 258671abad7..1221a4d74f2 100644
--- a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/build.properties
+++ b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/build.properties
@@ -1,8 +1,8 @@
-source.. = test/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- resources/,\
- about.html,\
- fragment.properties
-src.includes = about.html
+source.. = test/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ resources/,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/fragment.properties b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/plugin.properties
index cf08034680c..cf08034680c 100644
--- a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/fragment.properties
+++ b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading.tests/plugin.properties
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.framework/src/org/eclipse/papyrus/junit/framework/runner/FragmentTestSuiteClass.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.framework/src/org/eclipse/papyrus/junit/framework/runner/FragmentTestSuiteClass.java
index f397b6c0038..8f1e3ed6e93 100644
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.framework/src/org/eclipse/papyrus/junit/framework/runner/FragmentTestSuiteClass.java
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.framework/src/org/eclipse/papyrus/junit/framework/runner/FragmentTestSuiteClass.java
@@ -1,67 +1,71 @@
-/*****************************************************************************
- * Copyright (c) 2010, 2015 CEA LIST, Christian W. Damus, and others.
- *
- * 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) remi.schnekenburger@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 451230
- *****************************************************************************/
-package org.eclipse.papyrus.junit.framework.runner;
-
-import org.eclipse.core.runtime.Platform;
-import org.osgi.framework.Bundle;
-
-
-/**
- * Test Suite class entry for a test fragment
- */
-public class FragmentTestSuiteClass implements ITestSuiteClass {
-
- /** unique identifier of the bundle host */
- private final String hostBundleId;
-
- /** qualified name of the test suite class */
- private final String classQualifiedName;
-
- /**
- * Constructor.
- *
- * @param hostBundleId
- * unique identifier of the bundle host
- * @param classQualifiedName
- * qualified name of the test suite class
- */
- public FragmentTestSuiteClass(String hostBundleId, String classQualifiedName) {
- this.hostBundleId = hostBundleId;
- this.classQualifiedName = classQualifiedName;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Class<?> getMainTestSuiteClass() {
- Bundle bundle = Platform.getBundle(hostBundleId);
- if(bundle == null) {
- System.err.println("Impossible to find bundle: " + hostBundleId);
- } else {
- try {
- Class<?> class_ = bundle.loadClass(classQualifiedName);
- return class_;
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-
- @Override
- public String toString() {
- return String.format("FragmentTestSuite %s/%s", hostBundleId, classQualifiedName);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Christian W. Damus - bugs 451230, 488791
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.junit.framework.runner;
+
+import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * Test Suite class entry for a test fragment.
+ *
+ * @deprecated As of 2.0, All test suites should be plug-in bundles, not fragment bundles.
+ */
+@Deprecated
+public class FragmentTestSuiteClass implements ITestSuiteClass {
+
+ /** unique identifier of the bundle host */
+ private final String hostBundleId;
+
+ /** qualified name of the test suite class */
+ private final String classQualifiedName;
+
+ /**
+ * Constructor.
+ *
+ * @param hostBundleId
+ * unique identifier of the bundle host
+ * @param classQualifiedName
+ * qualified name of the test suite class
+ */
+ public FragmentTestSuiteClass(String hostBundleId, String classQualifiedName) {
+ this.hostBundleId = hostBundleId;
+ this.classQualifiedName = classQualifiedName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<?> getMainTestSuiteClass() {
+ Bundle bundle = Platform.getBundle(hostBundleId);
+ if (bundle == null) {
+ System.err.println("Impossible to find bundle: " + hostBundleId);
+ } else {
+ try {
+ Class<?> class_ = bundle.loadClass(classQualifiedName);
+ return class_;
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("FragmentTestSuite %s/%s", hostBundleId, classQualifiedName);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/META-INF/MANIFEST.MF
index 45c00ddea11..141793b4586 100644
--- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/META-INF/MANIFEST.MF
@@ -1,13 +1,17 @@
-Manifest-Version: 1.0
-Require-Bundle: org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.utils;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.suites
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.sysml.diagram.blockdefinition;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.blockdefinition.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml.diagram.blockdefinition;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="2.0.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="2.0.0",
+ org.eclipse.papyrus.sysml.service.types;bundle-version="1.2.0"
+Export-Package: org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.suites
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.blockdefinition.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/AbstractTest.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/AbstractTest.java
index 18b68ef0992..1b1cc847a9d 100644
--- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/AbstractTest.java
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition.tests/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/tests/AbstractTest.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2014 CEA LIST and others.
+ * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,6 +11,7 @@
* CEA LIST - Initial API and implementation
* Christian W. Damus (CEA) - bug 434993
* Fanch Bonnabesse (ALL4TEC) fanch.bonnabesse@alltec.net - Bug 419357
+ * Christian W. Damus - 488791
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.blockdefinition.tests;
@@ -18,6 +19,7 @@ package org.eclipse.papyrus.sysml.diagram.blockdefinition.tests;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
@@ -28,6 +30,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.intro.IIntroPart;
import org.junit.BeforeClass;
import org.junit.ClassRule;
+import org.osgi.framework.Bundle;
/**
* Abstract Papyrus initialization class (required to get Service activation).
@@ -58,9 +61,10 @@ public abstract class AbstractTest extends AbstractPapyrusTest {
IFile emptyModel_no = testProject.getFile("ModelWithBDD.notation");
IFile emptyModel_uml = testProject.getFile("ModelWithBDD.uml");
- emptyModel_di.create(Activator.getInstance().getBundle().getResource("/model/ModelWithBDD.di").openStream(), true, new NullProgressMonitor());
- emptyModel_no.create(Activator.getInstance().getBundle().getResource("/model/ModelWithBDD.notation").openStream(), true, new NullProgressMonitor());
- emptyModel_uml.create(Activator.getInstance().getBundle().getResource("/model/ModelWithBDD.uml").openStream(), true, new NullProgressMonitor());
+ Bundle bundle = Platform.getBundle("org.eclipse.papyrus.sysml.diagram.blockdefinition.tests");
+ emptyModel_di.create(bundle.getResource("/model/ModelWithBDD.di").openStream(), true, new NullProgressMonitor());
+ emptyModel_no.create(bundle.getResource("/model/ModelWithBDD.notation").openStream(), true, new NullProgressMonitor());
+ emptyModel_uml.create(bundle.getResource("/model/ModelWithBDD.uml").openStream(), true, new NullProgressMonitor());
// Open the EmptyModel.di file with Papyrus (assumed to be the default editor for "di" files here).
editor = houseKeeper.openPapyrusEditor(emptyModel_di);
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/META-INF/MANIFEST.MF
index af771aae201..c8fa0fb2e1a 100644
--- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/META-INF/MANIFEST.MF
@@ -1,15 +1,19 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
- org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
- com.google.guava;bundle-version="11.0.0"
-Export-Package: org.eclipse.papyrus.sysml.diagram.internalblock.tests.suites
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.sysml.diagram.internalblock;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.internalblock.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.sysml.diagram.internalblock;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="2.0.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="2.0.0",
+ org.eclipse.papyrus.sysml.service.types;bundle-version="1.2.0"
+Export-Package: org.eclipse.papyrus.sysml.diagram.internalblock.tests.suites
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.internalblock.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/src/org/eclipse/papyrus/sysml/diagram/internalblock/tests/AbstractTest.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/src/org/eclipse/papyrus/sysml/diagram/internalblock/tests/AbstractTest.java
index 9ca27005334..97aa9bd273a 100644
--- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/src/org/eclipse/papyrus/sysml/diagram/internalblock/tests/AbstractTest.java
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock.tests/src/org/eclipse/papyrus/sysml/diagram/internalblock/tests/AbstractTest.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2014 CEA LIST and others.
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,6 +11,7 @@
* CEA LIST - Initial API and implementation
* Christian W. Damus (CEA) - bug 434993
* Fanch Bonnabesse (ALL4TEC) fanch.bonnabesse@alltec.net - Bug 419357
+ * Christian W. Damus - bug 488791
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.internalblock.tests;
@@ -18,6 +19,7 @@ package org.eclipse.papyrus.sysml.diagram.internalblock.tests;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
@@ -26,6 +28,7 @@ import org.eclipse.papyrus.sysml.diagram.internalblock.Activator;
import org.eclipse.ui.IEditorPart;
import org.junit.BeforeClass;
import org.junit.ClassRule;
+import org.osgi.framework.Bundle;
/**
* Abstract Papyrus initialization class (required to get Service activation).
@@ -47,9 +50,10 @@ public abstract class AbstractTest extends AbstractPapyrusTest {
IFile emptyModel_no = testProject.getFile("ModelWithIBD.notation");
IFile emptyModel_uml = testProject.getFile("ModelWithIBD.uml");
- emptyModel_di.create(Activator.getInstance().getBundle().getResource("/model/ModelWithIBD.di").openStream(), true, new NullProgressMonitor());
- emptyModel_no.create(Activator.getInstance().getBundle().getResource("/model/ModelWithIBD.notation").openStream(), true, new NullProgressMonitor());
- emptyModel_uml.create(Activator.getInstance().getBundle().getResource("/model/ModelWithIBD.uml").openStream(), true, new NullProgressMonitor());
+ Bundle bundle = Platform.getBundle("org.eclipse.papyrus.sysml.diagram.internalblock.tests");
+ emptyModel_di.create(bundle.getResource("/model/ModelWithIBD.di").openStream(), true, new NullProgressMonitor());
+ emptyModel_no.create(bundle.getResource("/model/ModelWithIBD.notation").openStream(), true, new NullProgressMonitor());
+ emptyModel_uml.create(bundle.getResource("/model/ModelWithIBD.uml").openStream(), true, new NullProgressMonitor());
// Open the EmptyModel.di file with Papyrus (assumed to be the default editor for "di" files here).
editor = houseKeeper.openPapyrusEditor(emptyModel_di);
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF
index ccdef7fc379..84e40c4b03e 100644
--- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF
@@ -1,15 +1,20 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
- org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.sysml.diagram.parametric.tests.suites
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.sysml.diagram.parametric;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.parametric.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml.diagram.parametric;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="2.0.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="2.0.0",
+ org.eclipse.papyrus.sysml.service.types;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml.diagram.internalblock;bundle-version="2.0.0"
+Export-Package: org.eclipse.papyrus.sysml.diagram.parametric.tests.suites
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.parametric.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java
index cd38897e75b..e06038c5370 100644
--- a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java
@@ -1,83 +1,85 @@
-/*****************************************************************************
- * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
- *
- * 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:
- *
- * CEA LIST - Initial API and implementation
- * Christian W. Damus (CEA) - bug 434993
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.tests;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
-import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
-import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
-import org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.Constants;
-import org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils;
-import org.eclipse.ui.IEditorPart;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-
-/**
- * Abstract Papyrus initialization class (required to get Service activation).
- */
-public abstract class AbstractTest4B extends AbstractPapyrusTest {
-
- @ClassRule
- public static final HouseKeeper.Static houseKeeper = new HouseKeeper.Static();
-
- public static IEditorPart editor = null;
-
- @BeforeClass
- public static void openPapyrusWithAParametricDiagramOwnedByBlock() throws Exception {
- // Prepare new project for tests
- IProject testProject = houseKeeper.createProject("TestProject");
-
- // Copy EmptyModel from bundle to the test project
- final IFile emptyModel_di = testProject.getFile("ModelWithPD.di");
- IFile emptyModel_no = testProject.getFile("ModelWithPD.notation");
- IFile emptyModel_uml = testProject.getFile("ModelWithPD.uml");
-
- emptyModel_di.create(Activator.getInstance().getBundle().getResource("/model/ModelWithPD.di").openStream(), true, new NullProgressMonitor());
- emptyModel_no.create(Activator.getInstance().getBundle().getResource("/model/ModelWithPD.notation").openStream(), true, new NullProgressMonitor());
- emptyModel_uml.create(Activator.getInstance().getBundle().getResource("/model/ModelWithPD.uml").openStream(), true, new NullProgressMonitor());
-
- // Open the EmptyModel.di file with Papyrus (assumed to be the default editor for "di" files here).
- editor = houseKeeper.openPapyrusEditor(emptyModel_di);
-
- setActiveDiagramViewByName(Constants.PARAMETRIC_OWNED_BY_BLOCK_DIAGRAM_NAME);
- }
-
- public static boolean setActiveDiagramViewByName(String diagramName) throws Exception {
- if (diagramName == null) {
- return false;
- }
- ServicesRegistry serviceRegistry = EditorUtils.getEditor().getAdapter(ServicesRegistry.class);
- IPageManager iPageManager = ServiceUtils.getInstance().getService(IPageManager.class, serviceRegistry);
- List<Object> allPages = iPageManager.allPages();
- for (Object object : allPages) {
- if (object instanceof Diagram) {
- if (diagramName.equals(((Diagram) object).getName())) {
- iPageManager.selectPage(object);
- return true;
- }
- }
- }
- return false;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
+ *
+ * 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:
+ *
+ * CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 434993
+ * Christian W. Damus - bugs 485220, 488791
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.diagram.parametric.tests;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.Constants;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils;
+import org.eclipse.ui.IEditorPart;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.osgi.framework.Bundle;
+
+/**
+ * Abstract Papyrus initialization class (required to get Service activation).
+ */
+public abstract class AbstractTest4B extends AbstractPapyrusTest {
+
+ @ClassRule
+ public static final HouseKeeper.Static houseKeeper = new HouseKeeper.Static();
+
+ public static IEditorPart editor = null;
+
+ @BeforeClass
+ public static void openPapyrusWithAParametricDiagramOwnedByBlock() throws Exception {
+ // Prepare new project for tests
+ IProject testProject = houseKeeper.createProject("TestProject");
+
+ // Copy EmptyModel from bundle to the test project
+ final IFile emptyModel_di = testProject.getFile("ModelWithPD.di");
+ IFile emptyModel_no = testProject.getFile("ModelWithPD.notation");
+ IFile emptyModel_uml = testProject.getFile("ModelWithPD.uml");
+
+ Bundle bundle = Platform.getBundle("org.eclipse.papyrus.sysml.diagram.parametric.tests");
+ emptyModel_di.create(bundle.getResource("/model/ModelWithPD.di").openStream(), true, new NullProgressMonitor());
+ emptyModel_no.create(bundle.getResource("/model/ModelWithPD.notation").openStream(), true, new NullProgressMonitor());
+ emptyModel_uml.create(bundle.getResource("/model/ModelWithPD.uml").openStream(), true, new NullProgressMonitor());
+
+ // Open the EmptyModel.di file with Papyrus (assumed to be the default editor for "di" files here).
+ editor = houseKeeper.openPapyrusEditor(emptyModel_di);
+
+ setActiveDiagramViewByName(Constants.PARAMETRIC_OWNED_BY_BLOCK_DIAGRAM_NAME);
+ }
+
+ public static boolean setActiveDiagramViewByName(String diagramName) throws Exception {
+ if (diagramName == null) {
+ return false;
+ }
+ ServicesRegistry serviceRegistry = EditorUtils.getEditor().getAdapter(ServicesRegistry.class);
+ IPageManager iPageManager = ServiceUtils.getInstance().getService(IPageManager.class, serviceRegistry);
+ List<Object> allPages = iPageManager.allPages();
+ for (Object object : allPages) {
+ if (object instanceof Diagram) {
+ if (diagramName.equals(((Diagram) object).getName())) {
+ iPageManager.selectPage(object);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/META-INF/MANIFEST.MF
index 3142eb61b4b..f59fb1a9c75 100644
--- a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/META-INF/MANIFEST.MF
@@ -1,13 +1,14 @@
-Manifest-Version: 1.0
-Require-Bundle: org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.infra.types.core;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.sysml.service.types.tests.suites
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.sysml.service.types;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.sysml.service.types.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.infra.types.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml.service.types;bundle-version="1.2.0",
+ org.eclipse.papyrus.sysml;bundle-version="1.2.0"
+Export-Package: org.eclipse.papyrus.sysml.service.types.tests.suites
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.service.types.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/.classpath b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/.classpath
index 8a8f1668cdc..5a3a31216ec 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/.classpath
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/.classpath
@@ -1,7 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/papyrus/uml/modelrepair/**"/>
+ </accessrules>
+ </classpathentry>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/META-INF/MANIFEST.MF
index aad398cc7a5..fe304630c13 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/META-INF/MANIFEST.MF
@@ -1,14 +1,16 @@
-Manifest-Version: 1.0
-Require-Bundle: org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.utils;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.uml.modelrepair.internal.stereotypes,
- org.eclipse.papyrus.uml.modelrepair.tests
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.uml.modelrepair;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: fragment
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.modelrepair.tests;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Manifest-Version: 1.0
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.modelrepair;bundle-version="1.2.0",
+ org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)",
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="[2.0.0,3.0.0)"
+Export-Package: org.eclipse.papyrus.uml.modelrepair.internal.stereotypes,
+ org.eclipse.papyrus.uml.modelrepair.tests
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.uml.modelrepair.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/build.properties b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/build.properties
index 2423785a815..5371490a2c7 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/build.properties
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/build.properties
@@ -2,8 +2,8 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- fragment.properties,\
+ plugin.properties,\
about.html,\
resources/,\
- fragment.xml
+ plugin.xml
src.includes = about.html
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/fragment.properties b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/plugin.properties
index 0ac2bce5947..0ac2bce5947 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/fragment.properties
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/plugin.properties
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/fragment.xml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/plugin.xml
index c8f9d20ccbe..c8f9d20ccbe 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/fragment.xml
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/plugin.xml
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java
index bf26003d5a3..aaa2a200e05 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others.
+ * Copyright (c) 2014, 2016 CEA, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,8 +8,7 @@
*
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
- * Christian W. Damus - bug 436666
- * Christian W. Damus - bug 458736
+ * Christian W. Damus - bugs 436666, 458736, 488791
*
*/
package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes;
@@ -25,6 +24,7 @@ import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Set;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.util.EList;
@@ -33,24 +33,31 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.ExtendedMetaData;
import org.eclipse.emf.ecore.xmi.XMLResource;
-import org.eclipse.papyrus.infra.core.utils.AdapterUtils;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.utils.TransactionHelper;
+import org.eclipse.papyrus.infra.tools.util.PlatformHelper;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.junit.utils.rules.AbstractHouseKeeperRule.CleanUp;
import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture;
import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.uml.modelrepair.ui.IZombieStereotypePresenter;
import org.eclipse.uml2.common.util.UML2Util;
import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.ProfileApplication;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.UMLPackage;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import com.google.common.base.Function;
import com.google.common.base.Functions;
@@ -71,8 +78,9 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
private Class class1;
- private StereotypeApplicationRepairSnippet fixture;
+ private MyStereotypeApplicationRepairSnippet fixture;
+ @CleanUp
private ZombieStereotypesDescriptor zombies;
public StereotypeApplicationRepairSnippetTest() {
@@ -100,7 +108,7 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
assertThat("Should have found zombie stereotypes", zombies, notNullValue());
IAdaptable schema = getOnlyZombieSchema();
- EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get();
+ EPackage ePackage = PlatformHelper.getAdapter(schema, EPackage.class);
assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(ePackage), is((EObject) profile));
assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(ePackage)));
@@ -121,7 +129,7 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
assertThat("Should have found zombie stereotypes", zombies, notNullValue());
IAdaptable schema = getOnlyZombieSchema();
- EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get();
+ EPackage ePackage = PlatformHelper.getAdapter(schema, EPackage.class);
assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(ePackage), is((EObject) profile));
assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(ePackage)));
@@ -142,7 +150,7 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
assertThat("Should have found zombie stereotypes", zombies, notNullValue());
IAdaptable schema = getOnlyZombieSchema();
- EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get();
+ EPackage ePackage = PlatformHelper.getAdapter(schema, EPackage.class);
assertThat("EPackage is not an unknown schema", getExtendedMetadata().demandedPackages(), hasItem(ePackage));
IRepairAction action = zombies.getSuggestedRepairAction(schema);
@@ -181,9 +189,9 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
stereotype = profile.getOwnedStereotype("Stereo");
class1 = (Class) modelSet.getModel().getOwnedType("Class1");
- fixture = houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(null, Functions.constant(profile)), "dispose", modelSet.getResourceSet());
+ fixture = houseKeeper.cleanUpLater(new MyStereotypeApplicationRepairSnippet(null, Functions.constant(profile)), "dispose", modelSet.getResourceSet());
fixture.start(modelSet.getResourceSet());
- houseKeeper.setField("zombies", fixture.getZombieStereotypes(modelSet.getModelResource(), modelSet.getModel()));
+ zombies = fixture.getZombieStereotypes(modelSet.getModelResource(), modelSet.getModel());
}
void repair(final IAdaptable schema, final IRepairAction action) {
@@ -253,4 +261,47 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest
return result;
}
+
+ //
+ // Nested types
+ //
+
+ static class MyStereotypeApplicationRepairSnippet extends StereotypeApplicationRepairSnippet {
+
+ MyStereotypeApplicationRepairSnippet() {
+ super();
+ }
+
+ MyStereotypeApplicationRepairSnippet(Function<? super ModelSet, ? extends IZombieStereotypePresenter> presenterFunction, Function<? super EPackage, Profile> dynamicProfileSupplier) {
+ super(presenterFunction, dynamicProfileSupplier);
+ }
+
+ MyStereotypeApplicationRepairSnippet(Function<? super ModelSet, ? extends IZombieStereotypePresenter> presenterFunction) {
+ super(presenterFunction);
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected ZombieStereotypesDescriptor getZombieStereotypes(Resource resource) {
+ return super.getZombieStereotypes(resource);
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected ZombieStereotypesDescriptor getZombieStereotypes(Resource resource, Element root) {
+ return super.getZombieStereotypes(resource, root);
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected Element getRootUMLElement(Resource resource) {
+ return super.getRootUMLElement(resource);
+ }
+
+ // Overridden to make it accessible
+ @Override
+ protected Set<EPackage> getAppliedDefinitions(Iterable<? extends ProfileApplication> profileApplications) {
+ return super.getAppliedDefinitions(profileApplications);
+ }
+ }
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java
index c01897e5a8c..e2eb655806a 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others.
+ * Copyright (c) 2014, 2016 CEA, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,11 +8,7 @@
*
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
- * Christian W. Damus - bug 455248
- * Christian W. Damus - bug 455329
- * Christian W. Damus - bug 436666
- * Christian W. Damus - bug 458736
- * Christian W. Damus - bug 459488
+ * Christian W. Damus - bugs 455248, 455329, 436666, 458736, 459488, 488791
*
*/
package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes;
@@ -46,9 +42,11 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.papyrus.infra.core.utils.TransactionHelper;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.junit.utils.rules.AbstractHouseKeeperRule.CleanUp;
import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture;
import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.uml.modelrepair.internal.stereotypes.StereotypeApplicationRepairSnippetTest.MyStereotypeApplicationRepairSnippet;
import org.eclipse.papyrus.uml.modelrepair.ui.IZombieStereotypePresenter;
import org.eclipse.uml2.common.util.UML2Util;
import org.eclipse.uml2.uml.Class;
@@ -84,10 +82,12 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
@Rule
public final ReadOnlyCacheRule readonly = new ReadOnlyCacheRule();
- private StereotypeApplicationRepairSnippet fixture;
+ private MyStereotypeApplicationRepairSnippet fixture;
+ @CleanUp
private TestPresenter presenter; // For tests that use it
+ @CleanUp
private ZombieStereotypesDescriptor zombies;
private Package model;
@@ -370,19 +370,19 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
if (fixtureMethod == null) {
fixture = createDefaultFixture();
} else {
- fixture = (StereotypeApplicationRepairSnippet) fixtureMethod.invoke(this);
+ fixture = (MyStereotypeApplicationRepairSnippet) fixtureMethod.invoke(this);
}
fixture.start(modelSet.getResourceSet());
- houseKeeper.setField("zombies", fixture.getZombieStereotypes(modelSet.getModelResource(), modelSet.getModel()));
+ zombies = fixture.getZombieStereotypes(modelSet.getModelResource(), modelSet.getModel());
}
- protected StereotypeApplicationRepairSnippet createDefaultFixture() {
+ protected MyStereotypeApplicationRepairSnippet createDefaultFixture() {
final Profile rootProfile = model.getAppliedProfile("Profile");
final Profile nested1 = model.getNestedPackage("Package1").getAppliedProfile("Profile::Nested1");
final Profile nested2 = model.getNestedPackage("Package2").getAppliedProfile("Profile::Nested2");
- return houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(null, new Function<EPackage, Profile>() {
+ return houseKeeper.cleanUpLater(new MyStereotypeApplicationRepairSnippet(null, new Function<EPackage, Profile>() {
@Override
public Profile apply(EPackage input) {
@@ -403,11 +403,11 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
}
@Bug("436666")
- protected StereotypeApplicationRepairSnippet createBug436666Fixture() {
+ protected MyStereotypeApplicationRepairSnippet createBug436666Fixture() {
final Profile rootProfile = model.getAppliedProfile("Profile");
final Profile nestedProfile = model.getAppliedProfile("Profile::Profile1");
- return houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(null, new Function<EPackage, Profile>() {
+ return houseKeeper.cleanUpLater(new MyStereotypeApplicationRepairSnippet(null, new Function<EPackage, Profile>() {
@Override
public Profile apply(EPackage input) {
@@ -426,18 +426,18 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
}
@Bug({ "436666bis", "455248", "455329" })
- protected StereotypeApplicationRepairSnippet createSimpleFixture() {
- return houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(null, Functions.constant((Profile) null)), "dispose", modelSet.getResourceSet());
+ protected MyStereotypeApplicationRepairSnippet createSimpleFixture() {
+ return houseKeeper.cleanUpLater(new MyStereotypeApplicationRepairSnippet(null, Functions.constant((Profile) null)), "dispose", modelSet.getResourceSet());
}
@Bug("458736")
- protected StereotypeApplicationRepairSnippet createPresenterFixture() {
- TestPresenter presenter = houseKeeper.setField("presenter", new TestPresenter());
- return houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(Functions.constant(presenter)), "dispose", modelSet.getResourceSet());
+ protected MyStereotypeApplicationRepairSnippet createPresenterFixture() {
+ presenter = new TestPresenter();
+ return houseKeeper.cleanUpLater(new MyStereotypeApplicationRepairSnippet(Functions.constant(presenter)), "dispose", modelSet.getResourceSet());
}
@Bug("459488")
- protected StereotypeApplicationRepairSnippet createLocalProfileFixture() throws CoreException {
+ protected MyStereotypeApplicationRepairSnippet createLocalProfileFixture() throws CoreException {
// Get the profile to supply for repairing
URI profileURI = null;
for (IFile next : Iterables.filter(Arrays.asList(modelSet.getProject().getProject().members()), IFile.class)) {
@@ -451,9 +451,9 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
Profile profile = UML2Util.load(modelSet.getResourceSet(), profileURI, UMLPackage.Literals.PROFILE);
// And set up a presenter to enable incremental repair as resources are loaded
- TestPresenter presenter = houseKeeper.setField("presenter", new TestPresenter());
+ presenter = new TestPresenter();
- return houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(Functions.constant(presenter), Functions.constant(profile)), "dispose", modelSet.getResourceSet());
+ return houseKeeper.cleanUpLater(new MyStereotypeApplicationRepairSnippet(Functions.constant(presenter), Functions.constant(profile)), "dispose", modelSet.getResourceSet());
}
void repair(final IAdaptable schema, final IRepairAction action) {
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/.classpath b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/.classpath
index 098194ca4b7..96a60afc9f1 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/.classpath
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/.classpath
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/papyrus/uml/profile/**"/>
+ </accessrules>
+ </classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/META-INF/MANIFEST.MF
index 9ea08e0a02c..32f3ff7b907 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/META-INF/MANIFEST.MF
@@ -1,14 +1,14 @@
-Manifest-Version: 1.0
-Require-Bundle: org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.utils;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.uml.profile.service,
- org.eclipse.papyrus.uml.profile.tests
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.uml.profile;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: fragment
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.profile.tests;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Manifest-Version: 1.0
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.profile;bundle-version="1.2.0"
+Export-Package: org.eclipse.papyrus.uml.profile.service,
+ org.eclipse.papyrus.uml.profile.tests
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.uml.profile.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/build.properties b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/build.properties
index f4710d4bb4b..d4d0729e078 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/build.properties
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/build.properties
@@ -14,8 +14,8 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- fragment.properties,\
+ plugin.properties,\
about.html,\
resources/,\
- fragment.xml
+ plugin.xml
src.includes = about.html
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/org.eclipse.papyrus.uml.profile.tests.launch b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/org.eclipse.papyrus.uml.profile.tests.launch
index e57442f5003..539b87ddf31 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/org.eclipse.papyrus.uml.profile.tests.launch
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/org.eclipse.papyrus.uml.profile.tests.launch
@@ -27,7 +27,7 @@
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.uml.profile.tests.AllTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.uml.profile.tests"/>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/fragment.properties b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/plugin.properties
index e762b2985f8..e762b2985f8 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/fragment.properties
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/plugin.properties
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/fragment.xml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/plugin.xml
index 0db30446cce..0db30446cce 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/fragment.xml
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.profile.tests/plugin.xml
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF
index 4253cc6d48d..3461177d952 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF
@@ -1,19 +1,21 @@
-Manifest-Version: 1.0
-Require-Bundle: org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
- org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
- org.hamcrest.core,
- org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0"
-Export-Package: org.eclipse.papyrus.uml.service.types.tests.creation,
- org.eclipse.papyrus.uml.service.types.tests.deletion,
- org.eclipse.papyrus.uml.service.types.tests.registry,
- org.eclipse.papyrus.uml.service.types.tests.suites
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.uml.service.types;bundle-version="1.2.0"
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.service.types.tests;singleton:=true
-Import-Package: org.eclipse.papyrus.infra.newchild
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Manifest-Version: 1.0
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
+ org.hamcrest.core,
+ org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.service.types;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.newchild;bundle-version="1.2.0",
+ org.eclipse.uml2.uml;bundle-version="[5.2.0,6.0.0)",
+ org.eclipse.uml2.uml.profile.standard;bundle-version="[1.0.0,2.0.0)"
+Export-Package: org.eclipse.papyrus.uml.service.types.tests.creation,
+ org.eclipse.papyrus.uml.service.types.tests.deletion,
+ org.eclipse.papyrus.uml.service.types.tests.registry,
+ org.eclipse.papyrus.uml.service.types.tests.suites
+Bundle-Vendor: %providerName
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.uml.service.types.tests;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties
index 2abb0720e1b..e7f763d0fa1 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties
@@ -1,10 +1,10 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties,\
- resource/,\
- icons/,\
- fragment.xml
-src.includes = about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties,\
+ resource/,\
+ icons/,\
+ plugin.xml
+src.includes = about.html
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/fragment.xml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/plugin.xml
index 74da3baca63..74da3baca63 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/fragment.xml
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/plugin.xml
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreatePureUMLElementTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreatePureUMLElementTest.java
index 9326c7c5298..c444aff7af1 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreatePureUMLElementTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreatePureUMLElementTest.java
@@ -92,7 +92,7 @@ public class CreatePureUMLElementTest extends AbstractPapyrusTest {
// create UML resource
// import test model
try {
- copyPapyrusModel = PapyrusProjectUtils.copyIFile("/resource/TestPureUMLModel.uml", Platform.getBundle("org.eclipse.papyrus.uml.service.types"), createProject, "TestPureUMLModel.uml");
+ copyPapyrusModel = PapyrusProjectUtils.copyIFile("/resource/TestPureUMLModel.uml", Platform.getBundle("org.eclipse.papyrus.uml.service.types.tests"), createProject, "TestPureUMLModel.uml");
} catch (CoreException e) {
fail(e.getMessage());
} catch (IOException e) {
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/META-INF/MANIFEST.MF
index a724c0513b5..c355b55ca3e 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/META-INF/MANIFEST.MF
@@ -3,16 +3,16 @@ Require-Bundle: org.junit;bundle-version="4.10.0",
org.eclipse.papyrus.junit.framework;bundle-version="1.2.0",
org.eclipse.papyrus.junit.utils;bundle-version="1.2.0",
org.hamcrest.core,
- org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0"
+ org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0",
+ org.eclipse.papyrus.uml.service.types.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.newchild;bundle-version="1.2.0"
Export-Package: org.eclipse.papyrus.uml.service.types.ui.tests.creation,
org.eclipse.papyrus.uml.service.types.ui.tests.deletion,
org.eclipse.papyrus.uml.service.types.ui.tests.suites
Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.uml.service.types.ui;bundle-version="1.2.0"
Bundle-Version: 1.2.0.qualifier
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.papyrus.uml.service.types.ui.tests;singleton:=true
-Import-Package: org.eclipse.papyrus.infra.newchild
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateElementTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateElementTest.java
index a69cc4af6c4..58290fa86d0 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateElementTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateElementTest.java
@@ -100,7 +100,7 @@ public class CreateElementTest extends AbstractPapyrusTest {
// import test model
try {
- copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types.ui"), "/resource/", "TestModel");
+ copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types.ui.tests"), "/resource/", "TestModel");
} catch (CoreException e) {
fail(e.getMessage());
} catch (IOException e) {
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateProfileRelationshipTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateProfileRelationshipTest.java
index b7b74659db8..a37d20b1431 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateProfileRelationshipTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateProfileRelationshipTest.java
@@ -77,7 +77,7 @@ public class CreateProfileRelationshipTest extends AbstractCreateRelationshipTes
// import test model
try {
- copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types.ui"), "/resource/", "testprofile.profile");
+ copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types.ui.tests"), "/resource/", "testprofile.profile");
} catch (CoreException e) {
fail(e.getMessage());
} catch (IOException e) {
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateRelationshipTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateRelationshipTest.java
index 5849f04ad79..1a8e7f90989 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateRelationshipTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/CreateRelationshipTest.java
@@ -126,7 +126,7 @@ public class CreateRelationshipTest extends AbstractCreateRelationshipTest {
// import test model
try {
- copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types.ui"), "/resource/", "TestModel");
+ copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types.ui.tests"), "/resource/", "TestModel");
} catch (CoreException e) {
fail(e.getMessage());
} catch (IOException e) {
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/MoveElementTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/MoveElementTest.java
index c3e41379248..a4de6bb4f38 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/MoveElementTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/MoveElementTest.java
@@ -98,7 +98,7 @@ public class MoveElementTest extends AbstractPapyrusTest {
// import test model
try {
- copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types.ui"), "/resource/", "TestModel");
+ copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types.ui.tests"), "/resource/", "TestModel");
} catch (CoreException e) {
fail(e.getMessage());
} catch (IOException e) {
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/SetFeatureTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/SetFeatureTest.java
index a1a567f732c..25e29e4d49d 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/SetFeatureTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.ui.tests/src/org/eclipse/papyrus/uml/service/types/ui/tests/creation/SetFeatureTest.java
@@ -99,7 +99,7 @@ public class SetFeatureTest extends AbstractPapyrusTest {
// import test model
try {
- copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types.ui"), "/resource/", "TestModel");
+ copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types.ui.tests"), "/resource/", "TestModel");
} catch (CoreException e) {
fail(e.getMessage());
} catch (IOException e) {

Back to the top