Bug 481728 - [SysML 1.4] (Plain UML) Activity diagrams dysfunctional
when SysML 1.4 plugins installed
- add unit test to check that all SpecializationTypeConfiguration have
a matcher
- add missing matcher
Change-Id: I4add9e03bae6a42b4e29cbd968ac98a01ac1a1d2
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
diff --git a/core/org.eclipse.papyrus.sysml14.service.types.tests/src/org/eclipse/papyrus/sysml14/service/types/tests/SysML14ElementTypesExtensionTest.java b/core/org.eclipse.papyrus.sysml14.service.types.tests/src/org/eclipse/papyrus/sysml14/service/types/tests/SysML14ElementTypesExtensionTest.java
index 62afa91..34cd70f 100644
--- a/core/org.eclipse.papyrus.sysml14.service.types.tests/src/org/eclipse/papyrus/sysml14/service/types/tests/SysML14ElementTypesExtensionTest.java
+++ b/core/org.eclipse.papyrus.sysml14.service.types.tests/src/org/eclipse/papyrus/sysml14/service/types/tests/SysML14ElementTypesExtensionTest.java
@@ -14,11 +14,17 @@
package org.eclipse.papyrus.sysml14.service.types.tests;
import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.Diagnostician;
+import org.eclipse.papyrus.infra.elementtypesconfigurations.ElementTypeConfiguration;
import org.eclipse.papyrus.infra.elementtypesconfigurations.ElementTypeSetConfiguration;
+import org.eclipse.papyrus.infra.elementtypesconfigurations.MatcherConfiguration;
+import org.eclipse.papyrus.infra.elementtypesconfigurations.SpecializationTypeConfiguration;
import org.eclipse.papyrus.infra.elementtypesconfigurations.registries.ElementTypeSetConfigurationRegistry;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.junit.Assert;
@@ -52,6 +58,35 @@
Assert.assertEquals("The SysML14ElementTypesExtension model is not valid ", Diagnostic.OK, diagnostic.getSeverity());
}
+ /**
+ * Check that all SpecializationTypeConfiguration have a matcher (avoid to broke UML Diagrams)
+ * TODO #482245 : a validation should be added to Papyrus core
+ */
+ @Test
+ public void checkElementTypeMatcher() {
+ URI createPlatformPluginURI = URI.createPlatformPluginURI(ELEMENTTYPE_EXTENSION_MENU_PATH, true);
+ ResourceSetImpl resourceSetImpl = new ResourceSetImpl();
+ Resource resource = resourceSetImpl.getResource(createPlatformPluginURI, true);
+
+
+ TreeIterator<EObject> allContents = resource.getAllContents();
+ while (allContents.hasNext()) {
+ EObject eObject = (EObject) allContents.next();
+ if (eObject instanceof ElementTypeSetConfiguration) {
+ ElementTypeSetConfiguration elementTypeSetConfiguration = (ElementTypeSetConfiguration) eObject;
+ EList<ElementTypeConfiguration> elementTypeConfigurations = elementTypeSetConfiguration.getElementTypeConfigurations();
+ for (ElementTypeConfiguration elementTypeConfiguration : elementTypeConfigurations) {
+ if (elementTypeConfiguration instanceof SpecializationTypeConfiguration) {
+ SpecializationTypeConfiguration specializationTypeConfiguration = (SpecializationTypeConfiguration) elementTypeConfiguration;
+ MatcherConfiguration matcherConfiguration = specializationTypeConfiguration.getMatcherConfiguration();
+ Assert.assertNotNull(specializationTypeConfiguration.getName()+"is missing its matcher. All SysML 1.4 SpecializationTypeConfiguration must have a matcher. By default, use org.eclipse.papyrus.sysml14.service.types.matcher.internal.SysML14ProfileMatcher)", matcherConfiguration);
+ }
+ }
+ }
+ }
+ }
+
+
@Test
public void testRegistryContentForUnit() {
Assert.assertTrue("Unit element type not found in SysML element type set ", ElementEditServiceUtils.getEditServiceProvider().isKnownElementType("org.eclipse.papyrus.SysML14.Unit"));
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common.tests/src/org/eclipse/papyrus/sysml14/diagram/common/tests/resources/SysML14ClassDiagramElementTypesExtensionTest.java b/diagram/org.eclipse.papyrus.sysml14.diagram.common.tests/src/org/eclipse/papyrus/sysml14/diagram/common/tests/resources/SysML14ClassDiagramElementTypesExtensionTest.java
index 84c6665..d97bb3c 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common.tests/src/org/eclipse/papyrus/sysml14/diagram/common/tests/resources/SysML14ClassDiagramElementTypesExtensionTest.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common.tests/src/org/eclipse/papyrus/sysml14/diagram/common/tests/resources/SysML14ClassDiagramElementTypesExtensionTest.java
@@ -14,11 +14,17 @@
package org.eclipse.papyrus.sysml14.diagram.common.tests.resources;
import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.Diagnostician;
+import org.eclipse.papyrus.infra.elementtypesconfigurations.ElementTypeConfiguration;
import org.eclipse.papyrus.infra.elementtypesconfigurations.ElementTypeSetConfiguration;
+import org.eclipse.papyrus.infra.elementtypesconfigurations.MatcherConfiguration;
+import org.eclipse.papyrus.infra.elementtypesconfigurations.SpecializationTypeConfiguration;
import org.eclipse.papyrus.infra.elementtypesconfigurations.registries.ElementTypeSetConfigurationRegistry;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.junit.Assert;
@@ -53,7 +59,34 @@
Diagnostic diagnostic = Diagnostician.INSTANCE.validate(resource.getContents().get(0));
Assert.assertEquals("The element type model is not valid ", Diagnostic.OK, diagnostic.getSeverity());
}
-
+
+ /**
+ * Check that all SpecializationTypeConfiguration have a matcher (avoid to broke UML Diagrams)
+ * TODO #482245 : a validation should be added to Papyrus core
+ */
+ @Test
+ public void checkElementTypeMatcher() {
+ URI createPlatformPluginURI = URI.createPlatformPluginURI(CLASS_DIAGRAM_EXTENSION_ELEMENT_TYPE_PATH, true);
+ ResourceSetImpl resourceSetImpl = new ResourceSetImpl();
+ Resource resource = resourceSetImpl.getResource(createPlatformPluginURI, true);
+
+
+ TreeIterator<EObject> allContents = resource.getAllContents();
+ while (allContents.hasNext()) {
+ EObject eObject = (EObject) allContents.next();
+ if (eObject instanceof ElementTypeSetConfiguration) {
+ ElementTypeSetConfiguration elementTypeSetConfiguration = (ElementTypeSetConfiguration) eObject;
+ EList<ElementTypeConfiguration> elementTypeConfigurations = elementTypeSetConfiguration.getElementTypeConfigurations();
+ for (ElementTypeConfiguration elementTypeConfiguration : elementTypeConfigurations) {
+ if (elementTypeConfiguration instanceof SpecializationTypeConfiguration) {
+ SpecializationTypeConfiguration specializationTypeConfiguration = (SpecializationTypeConfiguration) elementTypeConfiguration;
+ MatcherConfiguration matcherConfiguration = specializationTypeConfiguration.getMatcherConfiguration();
+ Assert.assertNotNull(specializationTypeConfiguration.getName()+"is missing its matcher. All SysML 1.4 SpecializationTypeConfiguration must have a matcher. By default, use org.eclipse.papyrus.sysml14.service.types.matcher.internal.SysML14ProfileMatcher)", matcherConfiguration);
+ }
+ }
+ }
+ }
+ }
@Test
public void testRegistryContentForBlockNestedBlockClassifier() {
Assert.assertTrue("Block (NestedBlock_Classifier) element type not found in SysML element type set ", ElementEditServiceUtils.getEditServiceProvider().isKnownElementType("org.eclipse.papyrus.SysML14.Block_NestedBlock_Classifier"));
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common.tests/src/org/eclipse/papyrus/sysml14/diagram/common/tests/resources/SysML14CompositeDiagramElementTypesExtensionTest.java b/diagram/org.eclipse.papyrus.sysml14.diagram.common.tests/src/org/eclipse/papyrus/sysml14/diagram/common/tests/resources/SysML14CompositeDiagramElementTypesExtensionTest.java
index e05b27e..5782677 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common.tests/src/org/eclipse/papyrus/sysml14/diagram/common/tests/resources/SysML14CompositeDiagramElementTypesExtensionTest.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common.tests/src/org/eclipse/papyrus/sysml14/diagram/common/tests/resources/SysML14CompositeDiagramElementTypesExtensionTest.java
@@ -14,11 +14,17 @@
package org.eclipse.papyrus.sysml14.diagram.common.tests.resources;
import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.Diagnostician;
+import org.eclipse.papyrus.infra.elementtypesconfigurations.ElementTypeConfiguration;
import org.eclipse.papyrus.infra.elementtypesconfigurations.ElementTypeSetConfiguration;
+import org.eclipse.papyrus.infra.elementtypesconfigurations.MatcherConfiguration;
+import org.eclipse.papyrus.infra.elementtypesconfigurations.SpecializationTypeConfiguration;
import org.eclipse.papyrus.infra.elementtypesconfigurations.registries.ElementTypeSetConfigurationRegistry;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.junit.Assert;
@@ -52,6 +58,34 @@
Assert.assertEquals("The element type model is not valid ", Diagnostic.OK, diagnostic.getSeverity());
}
+ /**
+ * Check that all SpecializationTypeConfiguration have a matcher (avoid to broke UML Diagrams)
+ * TODO #482245 : a validation should be added to Papyrus core
+ */
+ @Test
+ public void checkElementTypeMatcher() {
+ URI createPlatformPluginURI = URI.createPlatformPluginURI(COMPOSITE_DIAGRAM_EXTENSION_ELEMENT_TYPE_PATH, true);
+ ResourceSetImpl resourceSetImpl = new ResourceSetImpl();
+ Resource resource = resourceSetImpl.getResource(createPlatformPluginURI, true);
+
+
+ TreeIterator<EObject> allContents = resource.getAllContents();
+ while (allContents.hasNext()) {
+ EObject eObject = (EObject) allContents.next();
+ if (eObject instanceof ElementTypeSetConfiguration) {
+ ElementTypeSetConfiguration elementTypeSetConfiguration = (ElementTypeSetConfiguration) eObject;
+ EList<ElementTypeConfiguration> elementTypeConfigurations = elementTypeSetConfiguration.getElementTypeConfigurations();
+ for (ElementTypeConfiguration elementTypeConfiguration : elementTypeConfigurations) {
+ if (elementTypeConfiguration instanceof SpecializationTypeConfiguration) {
+ SpecializationTypeConfiguration specializationTypeConfiguration = (SpecializationTypeConfiguration) elementTypeConfiguration;
+ MatcherConfiguration matcherConfiguration = specializationTypeConfiguration.getMatcherConfiguration();
+ Assert.assertNotNull(specializationTypeConfiguration.getName()+"is missing its matcher. All SysML 1.4 SpecializationTypeConfiguration must have a matcher. By default, use org.eclipse.papyrus.sysml14.service.types.matcher.internal.SysML14ProfileMatcher)", matcherConfiguration);
+ }
+ }
+ }
+ }
+ }
+
@Test
public void testRegistryContentForConstraintProperty3070() {
Assert.assertTrue("ConstraintProperty (3070) element type not found in SysML element type set ", ElementEditServiceUtils.getEditServiceProvider().isKnownElementType("org.eclipse.papyrus.SysML14.ConstraintProperty_3070"));
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/resources/SysML14ClassDiagram-extension.elementtypesconfigurations b/diagram/org.eclipse.papyrus.sysml14.diagram.common/resources/SysML14ClassDiagram-extension.elementtypesconfigurations
index 392dc89..5c7630c 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common/resources/SysML14ClassDiagram-extension.elementtypesconfigurations
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/resources/SysML14ClassDiagram-extension.elementtypesconfigurations
@@ -209,6 +209,9 @@
iconPath="/icons/full/obj16/Constraint.gif"
bundleId="org.eclipse.uml2.uml.edit"/>
<specializedTypesID>org.eclipse.papyrus.uml.Constraint</specializedTypesID>
+ <matcherConfiguration
+ xmi:id="_Dro1UIxDEeWFTecuNLV29Q"
+ matcherClassName="org.eclipse.papyrus.sysml14.service.types.matcher.internal.SysML14ProfileMatcher"/>
</elementTypeConfigurations>
<elementTypeConfigurations
xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
@@ -222,6 +225,9 @@
iconPath="/icons/full/obj16/Constraint.gif"
bundleId="org.eclipse.uml2.uml.edit"/>
<specializedTypesID>org.eclipse.papyrus.uml.Actor</specializedTypesID>
+ <matcherConfiguration
+ xmi:id="_DlNdMIxDEeWFTecuNLV29Q"
+ matcherClassName="org.eclipse.papyrus.sysml14.service.types.matcher.internal.SysML14ProfileMatcher"/>
</elementTypeConfigurations>
<elementTypeConfigurations
xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"