Bug 532109 - [SysML 1.4] Wrong Location of PortsAndFlows sub-profile
- correct location for PortsAndFlows sub-profile in
org.eclipse.uml2.uml.generated_package mapping
- add a Parameterized unit test to check all profile location
Change-Id: I5a9552eebc8c0d43a46653b94780aed559480967
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
diff --git a/core/org.eclipse.papyrus.sysml14.tests/src/org/eclipse/papyrus/sysml14/tests/SysmlProfileTest.java b/core/org.eclipse.papyrus.sysml14.tests/src/org/eclipse/papyrus/sysml14/tests/SysmlProfileTest.java
index 6ff73aa..777656b 100644
--- a/core/org.eclipse.papyrus.sysml14.tests/src/org/eclipse/papyrus/sysml14/tests/SysmlProfileTest.java
+++ b/core/org.eclipse.papyrus.sysml14.tests/src/org/eclipse/papyrus/sysml14/tests/SysmlProfileTest.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST.
+ * Copyright (c) 2015,2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -13,9 +13,18 @@
*****************************************************************************/
package org.eclipse.papyrus.sysml14.tests;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.uml2.uml.UMLPlugin;
-import org.junit.Assert;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
/**
* Basic test for SysML 1.4 profile
@@ -23,20 +32,39 @@
* @author Benoit Maggi
*/
@SuppressWarnings("nls")
+@RunWith(Parameterized.class)
public class SysmlProfileTest {
+ @Parameters
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[][] {
+ { "http://www.eclipse.org/papyrus/sysml/1.4/SysML"},
+ { "http://www.eclipse.org/papyrus/sysml/1.4/SysML/Activities"},
+ { "http://www.eclipse.org/papyrus/sysml/1.4/SysML/Allocations"},
+ { "http://www.eclipse.org/papyrus/sysml/1.4/SysML/Blocks"},
+ { "http://www.eclipse.org/papyrus/sysml/1.4/SysML/ConstraintBlocks"},
+ { "http://www.eclipse.org/papyrus/sysml/1.4/SysML/DeprecatedElements"},
+ { "http://www.eclipse.org/papyrus/sysml/1.4/SysML/PortsAndFlows"},
+ { "http://www.eclipse.org/papyrus/sysml/1.4/SysML/ModelElements"},
+ { "http://www.eclipse.org/papyrus/sysml/1.4/SysML/Requirements"}
+ });
+ }
+
+ private String uri;
+
+ public SysmlProfileTest(String uri) {
+ this.uri = uri;
+ }
+
/**
- * Check that we have a profile registered here :
- * "http://www.eclipse.org/papyrus/sysml/1.4/SysML"
+ * Check that we have a location for the uri
+ * and that the location point to some existing EObject
*/
@Test
public void testProfilRegistration() {
- Assert.assertNotNull(
- UMLPlugin.getEPackageNsURIToProfileLocationMap().get("http://www.eclipse.org/papyrus/sysml/1.4/SysML"));
+ URI location = UMLPlugin.getEPackageNsURIToProfileLocationMap().get(uri);
+ assertNotNull("Location missing for this uri :"+uri, location);
+ assertNotNull("Location is refering to a non existing EObject :"+location, new ResourceSetImpl().getEObject(location,true));
}
-
-
-
-
}
diff --git a/core/org.eclipse.papyrus.sysml14/plugin.xml b/core/org.eclipse.papyrus.sysml14/plugin.xml
index ffee75f..5012b66 100644
--- a/core/org.eclipse.papyrus.sysml14/plugin.xml
+++ b/core/org.eclipse.papyrus.sysml14/plugin.xml
@@ -146,8 +146,6 @@
</factory>
</extension>
-
-
<extension point="org.eclipse.uml2.uml.generated_package">
<profile uri="http://www.eclipse.org/papyrus/sysml/1.4/SysML"
location="pathmap://SysML14_PROFILES/SysML.profile.uml#SysML"/>
@@ -172,7 +170,7 @@
uri="http://www.eclipse.org/papyrus/sysml/1.4/SysML/DeprecatedElements">
</profile>
<profile
- location="pathmap://SysML14_PROFILES/SysML.profile.uml#SysML.package_packagedElement_PortsAndFlows"
+ location="pathmap://SysML14_PROFILES/SysML.profile.uml#SysML.package_packagedElement_Ports_u0026Flows"
uri="http://www.eclipse.org/papyrus/sysml/1.4/SysML/PortsAndFlows">
</profile>
<profile