Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian W. Damus2015-02-11 22:48:29 +0000
committerChristian W. Damus2015-02-11 22:48:29 +0000
commita970bab6673faa4b184de307bc6f8b43b7c3dda0 (patch)
tree4837dfaa9b19589a07dd23cc2c9b58fe80fb080f /tests
parent683c5eecdd2399f86e6a4bfbba01165da4a2dc61 (diff)
downloadorg.eclipse.papyrus-a970bab6673faa4b184de307bc6f8b43b7c3dda0.tar.gz
org.eclipse.papyrus-a970bab6673faa4b184de307bc6f8b43b7c3dda0.tar.xz
org.eclipse.papyrus-a970bab6673faa4b184de307bc6f8b43b7c3dda0.zip
Bug 451230: Modeling assistants customization for profiles
https://bugs.eclipse.org/bugs/show_bug.cgi?id=451230 Add a relationshipTypes subset of the elementTypes collection of the assistant provider to reliably determine which element types are relationships, because deriving this from the modeled connection assistants would omit element types for which there is no assistant. Update the assistants-model generators to reliably generate the relationshipTypes collection based on (a) links defined in the GMFGen model or (b) UML metaclasses conforming to Relationship in a profile. Re-generate the Class and Use Case assistants models.
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/j2ee-all.assistants2
-rw-r--r--tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/j2ee-usecase.assistants2
-rw-r--r--tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/test.assistants2
-rw-r--r--tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/src-gen/org/eclipse/papyrus/infra/gmfdiag/assistant/tests/AssistedElementTypeFilterTest.java3
-rw-r--r--tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/src-gen/org/eclipse/papyrus/infra/gmfdiag/assistant/tests/ModelingAssistantProviderTest.java32
5 files changed, 38 insertions, 3 deletions
diff --git a/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/j2ee-all.assistants b/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/j2ee-all.assistants
index 2fc1faa9cfd..6773b06aee8 100644
--- a/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/j2ee-all.assistants
+++ b/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/j2ee-all.assistants
@@ -268,4 +268,6 @@
<excludedElementTypeID>org.eclipse.papyrus.uml.diagram.clazz.Association_2015</excludedElementTypeID>
<excludedElementTypeID>org.eclipse.papyrus.uml.diagram.clazz.Dependency_4018</excludedElementTypeID>
<excludedElementTypeID>org.eclipse.papyrus.uml.diagram.clazz.Dependency_2014</excludedElementTypeID>
+ <relationshipTypeID>org.eclipse.papyrus.example.j2ee.Import</relationshipTypeID>
+ <relationshipTypeID>org.eclipse.papyrus.example.j2ee.Web</relationshipTypeID>
</assistant:ModelingAssistantProvider>
diff --git a/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/j2ee-usecase.assistants b/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/j2ee-usecase.assistants
index 7a583335c82..ac81b0d7075 100644
--- a/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/j2ee-usecase.assistants
+++ b/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/j2ee-usecase.assistants
@@ -122,4 +122,6 @@
<elementTypeID>org.eclipse.papyrus.example.j2ee.WebScenario_3012</elementTypeID>
<elementTypeID>org.eclipse.papyrus.example.j2ee.WebScenario_2013</elementTypeID>
<elementTypeID>org.eclipse.papyrus.example.j2ee.WebScenario_2014</elementTypeID>
+ <relationshipTypeID>org.eclipse.papyrus.example.j2ee.Import_4013</relationshipTypeID>
+ <relationshipTypeID>org.eclipse.papyrus.example.j2ee.Web_4011</relationshipTypeID>
</assistant:ModelingAssistantProvider>
diff --git a/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/test.assistants b/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/test.assistants
index a92253b3e28..52043825be4 100644
--- a/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/test.assistants
+++ b/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/resources/test.assistants
@@ -14,4 +14,6 @@
<elementTypeID>org.eclipse.papyrus.uml.Package</elementTypeID>
<elementTypeID>org.eclipse.papyrus.uml.Generalization</elementTypeID>
<excludedElementTypeID>org.eclipse.papyrus.uml.AssociationClass</excludedElementTypeID>
+ <relationshipTypeID>org.eclipse.papyrus.uml.Usage</relationshipTypeID>
+ <relationshipTypeID>org.eclipse.papyrus.uml.Generalization</relationshipTypeID>
</assistant:ModelingAssistantProvider>
diff --git a/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/src-gen/org/eclipse/papyrus/infra/gmfdiag/assistant/tests/AssistedElementTypeFilterTest.java b/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/src-gen/org/eclipse/papyrus/infra/gmfdiag/assistant/tests/AssistedElementTypeFilterTest.java
index 88dfd8893e7..cac460ceaaa 100644
--- a/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/src-gen/org/eclipse/papyrus/infra/gmfdiag/assistant/tests/AssistedElementTypeFilterTest.java
+++ b/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/src-gen/org/eclipse/papyrus/infra/gmfdiag/assistant/tests/AssistedElementTypeFilterTest.java
@@ -15,12 +15,9 @@ import static org.eclipse.papyrus.infra.gmfdiag.assistant.tests.ElementTypesUtil
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
-
import java.util.Arrays;
-
import junit.framework.TestCase;
import junit.textui.TestRunner;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
diff --git a/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/src-gen/org/eclipse/papyrus/infra/gmfdiag/assistant/tests/ModelingAssistantProviderTest.java b/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/src-gen/org/eclipse/papyrus/infra/gmfdiag/assistant/tests/ModelingAssistantProviderTest.java
index c54f45d5d29..cf66119a9db 100644
--- a/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/src-gen/org/eclipse/papyrus/infra/gmfdiag/assistant/tests/ModelingAssistantProviderTest.java
+++ b/tests/junit/plugins/infra/gmfdiag/assistant/org.eclipse.papyrus.infra.gmfdiag.assistant.tests/src-gen/org/eclipse/papyrus/infra/gmfdiag/assistant/tests/ModelingAssistantProviderTest.java
@@ -53,6 +53,7 @@ import org.hamcrest.CoreMatchers;
* <li>{@link org.eclipse.papyrus.infra.gmfdiag.assistant.ModelingAssistantProvider#getElementTypes() <em>Element Type</em>}</li>
* <li>{@link org.eclipse.papyrus.infra.gmfdiag.assistant.ModelingAssistantProvider#getClientContext() <em>Client Context</em>}</li>
* <li>{@link org.eclipse.papyrus.infra.gmfdiag.assistant.ModelingAssistantProvider#getExcludedElementTypes() <em>Excluded Element Type</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.assistant.ModelingAssistantProvider#getRelationshipTypes() <em>Relationship Type</em>}</li>
* </ul>
* </p>
* <p>
@@ -75,6 +76,7 @@ import org.hamcrest.CoreMatchers;
* </em>}</li>
* <li>{@link org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.IModelingAssistantProvider#getTypesForPopupBar(org.eclipse.core.runtime.IAdaptable) <em>Get Types For Popup Bar</em>}</li>
* <li>{@link org.eclipse.papyrus.infra.gmfdiag.assistant.ModelingAssistantProvider#getElementType(java.lang.String) <em>Get Element Type</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.gmfdiag.assistant.ModelingAssistantProvider#isRelationshipType(org.eclipse.gmf.runtime.emf.type.core.IElementType) <em>Is Relationship Type</em>}</li>
* </ul>
* </p>
*
@@ -216,6 +218,21 @@ public class ModelingAssistantProviderTest extends TestCase {
}
/**
+ * Tests the '{@link org.eclipse.papyrus.infra.gmfdiag.assistant.ModelingAssistantProvider#getRelationshipTypes() <em>Relationship Type</em>}' feature getter.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.papyrus.infra.gmfdiag.assistant.ModelingAssistantProvider#getRelationshipTypes()
+ * @generated NOT
+ */
+ public void testGetRelationshipTypes()
+ {
+ assertThat(getFixture().getRelationshipTypes(), hasItem(canonicalize(UMLElementTypes.USAGE)));
+ assertThat(getFixture().getRelationshipTypes(), hasItem(canonicalize(UMLElementTypes.GENERALIZATION)));
+ assertThat(getFixture().getRelationshipTypes(), not(hasItem(canonicalize(UMLElementTypes.CLASS))));
+ }
+
+ /**
* Tests the '{@link org.eclipse.gmf.runtime.common.core.service.IProvider#provides(org.eclipse.gmf.runtime.common.core.service.IOperation) <em>Provides</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -480,4 +497,19 @@ public class ModelingAssistantProviderTest extends TestCase {
assertThat(canonicalize(UMLElementTypes.CLASS), is(getFixture().getElementType("org.eclipse.papyrus.uml.Class")));
}
+ /**
+ * Tests the '{@link org.eclipse.papyrus.infra.gmfdiag.assistant.ModelingAssistantProvider#isRelationshipType(org.eclipse.gmf.runtime.emf.type.core.IElementType) <em>Is Relationship Type</em>}' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.papyrus.infra.gmfdiag.assistant.ModelingAssistantProvider#isRelationshipType(org.eclipse.gmf.runtime.emf.type.core.IElementType)
+ * @generated NOT
+ */
+ public void testIsRelationshipType__IElementType()
+ {
+ assertThat(getFixture().isRelationshipType(canonicalize(UMLElementTypes.USAGE)), is(true));
+ assertThat(getFixture().isRelationshipType(canonicalize(UMLElementTypes.GENERALIZATION)), is(true));
+ assertThat(getFixture().isRelationshipType(canonicalize(UMLElementTypes.CLASS)), is(false));
+ }
+
} // ModelingAssistantProviderTest

Back to the top