Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorytanguy2011-06-15 12:28:13 +0000
committerytanguy2011-06-15 12:28:13 +0000
commitc3170b7373b16425fed181ead479a802d6dac5df (patch)
tree8beefeb3601fdf5e9c325b0000366c903825dc4c /tests
parent72ed79987d46c5dcfbb9537cb98adf980b206bea (diff)
downloadorg.eclipse.papyrus-c3170b7373b16425fed181ead479a802d6dac5df.tar.gz
org.eclipse.papyrus-c3170b7373b16425fed181ead479a802d6dac5df.tar.xz
org.eclipse.papyrus-c3170b7373b16425fed181ead479a802d6dac5df.zip
NEW - bug 348832: [Element Edit Service] JUnit tests the Element Edit Service
https://bugs.eclipse.org/bugs/show_bug.cgi?id=348832
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.classpath7
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.project28
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/META-INF/MANIFEST.MF10
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/about.html28
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/build.properties4
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/plugin.properties14
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/src/org/eclipse/papyrus/sysml/service/types/tests/registry/TestElementTypeRegistryContent.java210
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.classpath7
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.project28
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF9
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/about.html28
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties4
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/plugin.properties14
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/registry/TestElementTypeRegistryContent.java97
16 files changed, 504 insertions, 0 deletions
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.classpath b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.project b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.project
new file mode 100644
index 00000000000..b031b85f98b
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.sysml.service.types.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..632650e3ffb
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed Jun 15 11:30:47 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
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
new file mode 100644
index 00000000000..48564e6692b
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.service.types.tests
+Bundle-Version: 0.8.0.qualifier
+Bundle-Vendor: %providerName
+Fragment-Host: org.eclipse.papyrus.sysml.service.types;bundle-version="0.8.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.junit;bundle-version="4.8.2",
+ org.eclipse.papyrus.service.edit;bundle-version="0.8.0"
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/about.html b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/build.properties b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/build.properties
new file mode 100644
index 00000000000..41eb6ade2b4
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/plugin.properties b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/plugin.properties
new file mode 100644
index 00000000000..75f628673d6
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/plugin.properties
@@ -0,0 +1,14 @@
+#################################################################################
+# Copyright (c) 2011 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#
+# CEA LIST - Initial API and Implementation.
+#
+##################################################################################
+pluginName=Papyrus SysML Service Types Tests (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/src/org/eclipse/papyrus/sysml/service/types/tests/registry/TestElementTypeRegistryContent.java b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/src/org/eclipse/papyrus/sysml/service/types/tests/registry/TestElementTypeRegistryContent.java
new file mode 100644
index 00000000000..67a54f8bbb9
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.service.types.tests/src/org/eclipse/papyrus/sysml/service/types/tests/registry/TestElementTypeRegistryContent.java
@@ -0,0 +1,210 @@
+package org.eclipse.papyrus.sysml.service.types.tests.registry;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.ClientContextManager;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.sysml.allocations.AllocationsPackage;
+import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
+import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage;
+import org.eclipse.papyrus.sysml.modelelements.ModelelementsPackage;
+import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage;
+import org.eclipse.papyrus.sysml.requirements.RequirementsPackage;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class TestElementTypeRegistryContent {
+
+ private static final String PAPYRUS_CONTEXT_ID = "org.eclipse.papyrus.service.edit.TypeContext"; //$NON-NLS-1$
+
+ private static final String PAPYRUS_ELEMENT_TYPE_PREFIX = "org.eclipse.papyrus.sysml."; //$NON-NLS-1$
+
+ @Test
+ public void testRegistryContentForSysMLModelElements() {
+
+ // Iterate over SysML ModelElements sub-profile contents
+ Iterator<EObject> it = ModelelementsPackage.eINSTANCE.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = it.next();
+ if (eObject instanceof EClass) {
+
+ EClass eClass = (EClass) eObject;
+ assertTrue("No type found in Papyrus context for " + eClass.getName(),
+ ElementEditServiceUtils.getEditServiceProvider().isKnownElementType(PAPYRUS_ELEMENT_TYPE_PREFIX + eClass.getName()));
+ }
+ }
+ }
+
+ @Test
+ public void testRegistryContentForSysMLBlocks() {
+
+ // Iterate over SysML Blocks sub-profile contents
+ Iterator<EObject> it = BlocksPackage.eINSTANCE.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = it.next();
+ if (eObject instanceof EClass) {
+ EClass eClass = (EClass) eObject;
+
+ if ("DistributedProperty".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ if ("NestedConnectorEnd".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ if ("ParticipantProperty".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ if ("ConnectorProperty".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ if ("BindingConnector".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ if ("PropertySpecificType".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ assertTrue("No type found in Papyrus context for " + eClass.getName(),
+ ElementEditServiceUtils.getEditServiceProvider().isKnownElementType(PAPYRUS_ELEMENT_TYPE_PREFIX + eClass.getName()));
+ }
+ }
+ }
+
+ @Test
+ public void testRegistryContentForSysMLConstraints() {
+
+ // Iterate over SysML Constraints sub-profile contents
+ Iterator<EObject> it = ConstraintsPackage.eINSTANCE.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = it.next();
+ if (eObject instanceof EClass) {
+
+ EClass eClass = (EClass) eObject;
+ assertTrue("No type found in Papyrus context for " + eClass.getName(),
+ ElementEditServiceUtils.getEditServiceProvider().isKnownElementType(PAPYRUS_ELEMENT_TYPE_PREFIX + eClass.getName()));
+ }
+ }
+ }
+
+ @Test
+ public void testRegistryContentForSysMLRequirements() {
+
+ // Iterate over SysML Requirements sub-profile contents
+ Iterator<EObject> it = RequirementsPackage.eINSTANCE.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = it.next();
+ if (eObject instanceof EClass) {
+ EClass eClass = (EClass) eObject;
+
+ if ("TestCase".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ if ("RequirementRelated".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ assertTrue("No type found in Papyrus context for " + eClass.getName(),
+ ElementEditServiceUtils.getEditServiceProvider().isKnownElementType(PAPYRUS_ELEMENT_TYPE_PREFIX + eClass.getName()));
+ }
+ }
+ }
+
+ @Test
+ public void testRegistryContentForSysMLAllocations() {
+
+ // Iterate over SysML Allocations sub-profile contents
+ Iterator<EObject> it = AllocationsPackage.eINSTANCE.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = it.next();
+ if (eObject instanceof EClass) {
+ EClass eClass = (EClass) eObject;
+
+ if ("Allocated".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ if ("AllocateActivityPartition".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ assertTrue("No type found in Papyrus context for " + eClass.getName(),
+ ElementEditServiceUtils.getEditServiceProvider().isKnownElementType(PAPYRUS_ELEMENT_TYPE_PREFIX + eClass.getName()));
+ }
+ }
+ }
+
+ @Test
+ public void testRegistryContentForSysMLPortAndFlows() {
+
+ // Iterate over SysML PortAndFlows sub-profile contents
+ Iterator<EObject> it = PortandflowsPackage.eINSTANCE.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = it.next();
+ if (eObject instanceof EClass) {
+
+ EClass eClass = (EClass) eObject;
+ assertTrue("No type found in Papyrus context for " + eClass.getName(),
+ ElementEditServiceUtils.getEditServiceProvider().isKnownElementType(PAPYRUS_ELEMENT_TYPE_PREFIX + eClass.getName()));
+ }
+ }
+ }
+
+ @Test
+ public void testRegistryContentForSysMLAssociations() {
+
+ IClientContext context = ClientContextManager.getInstance().getClientContext(PAPYRUS_CONTEXT_ID);
+ if (context == null) {
+ fail("Papyrus IClientContext could not be found.");
+ }
+
+ IElementType associationBaseElementType = ElementTypeRegistry.getInstance().getElementType(UMLPackage.eINSTANCE.getAssociation(), context);
+ assertTrue("Incorrect id for base Association element type ("+associationBaseElementType.getId()+")", associationBaseElementType.getId().equals("org.eclipse.papyrus.uml.AssociationBase"));
+
+ IElementType associationElementType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.sysml.Association");
+ assertTrue("No ISpecializationType found for SysML Association in Papyrus context", ElementEditServiceUtils.getEditServiceProvider().isKnownElementType("org.eclipse.papyrus.sysml.Association"));
+ assertTrue("Incorrect kind of ElementType (ISpecializationType expected for "+ associationElementType.getId() +")", associationElementType instanceof ISpecializationType);
+ ISpecializationType associationSpecializationType = (ISpecializationType) associationElementType;
+ assertTrue("Incorrect specialization type hierarchy for "+ associationElementType.getId(), associationSpecializationType.isSpecializationOf(associationBaseElementType));
+
+// IElementType associationNoneElementType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.sysml.AssociationNone");
+// assertTrue("No ISpecializationType found for SysML Association in Papyrus context", ElementEditServiceUtils.getEditServiceProvider().isKnownElementType("org.eclipse.papyrus.sysml.AssociationNone"));
+// assertTrue("Incorrect kind of ElementType (ISpecializationType expected for "+ associationElementType.getId() +")", associationNoneElementType instanceof ISpecializationType);
+// ISpecializationType associationSpecializationType = (ISpecializationType) associationElementType;
+// assertTrue("Incorrect specialization type hierarchy for "+ associationElementType.getId(), associationSpecializationType.isSpecializationOf(associationBaseElementType));
+//
+// IElementType associationElementType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.sysml.Association");
+// assertTrue("No ISpecializationType found for SysML Association in Papyrus context", ElementEditServiceUtils.getEditServiceProvider().isKnownElementType("org.eclipse.papyrus.sysml.Association"));
+// assertTrue("Incorrect kind of ElementType (ISpecializationType expected for "+ associationElementType.getId() +")", associationElementType instanceof ISpecializationType);
+// ISpecializationType associationSpecializationType = (ISpecializationType) associationElementType;
+// assertTrue("Incorrect specialization type hierarchy for "+ associationElementType.getId(), associationSpecializationType.isSpecializationOf(associationBaseElementType));
+ }
+
+}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.classpath b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.project b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.project
new file mode 100644
index 00000000000..bb00c355cb3
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.service.types.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..63ea330d31d
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed Jun 15 11:24:40 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
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
new file mode 100644
index 00000000000..2cc6bbc8d2c
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.uml.service.types.tests
+Bundle-Version: 0.8.0.qualifier
+Bundle-Vendor: %providerName
+Fragment-Host: org.eclipse.papyrus.uml.service.types;bundle-version="0.8.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.junit;bundle-version="4.8.2"
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/about.html b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
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
new file mode 100644
index 00000000000..41eb6ade2b4
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/plugin.properties b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/plugin.properties
new file mode 100644
index 00000000000..15f85719208
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/plugin.properties
@@ -0,0 +1,14 @@
+#################################################################################
+# Copyright (c) 2011 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#
+# CEA LIST - Initial API and Implementation.
+#
+##################################################################################
+pluginName=Papyrus UML Service Types Tests (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/registry/TestElementTypeRegistryContent.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/registry/TestElementTypeRegistryContent.java
new file mode 100644
index 00000000000..d76e19753c6
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/registry/TestElementTypeRegistryContent.java
@@ -0,0 +1,97 @@
+package org.eclipse.papyrus.uml.service.types.tests.registry;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.ClientContextManager;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.uml.service.types.helper.DefaultEditHelper;
+import org.eclipse.papyrus.uml.standard.StandardPackage;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class TestElementTypeRegistryContent {
+
+ private static final String PAPYRUS_CONTEXT_ID = "org.eclipse.papyrus.service.edit.TypeContext"; //$NON-NLS-1$
+
+ private static final String PAPYRUS_ELEMENT_TYPE_PREFIX = "org.eclipse.papyrus.uml."; //$NON-NLS-1$
+
+ @Test
+ public void testRegistryContentForUML() {
+
+ IClientContext context = ClientContextManager.getInstance().getClientContext(PAPYRUS_CONTEXT_ID);
+ if (context == null) {
+ fail("Papyrus IClientContext could not be found.");
+ }
+
+ // Iterate over UML2 contents
+ Iterator<EObject> it = UMLPackage.eINSTANCE.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = it.next();
+ if (eObject instanceof EClass) {
+ EClass eClass = (EClass) eObject;
+ IElementType elementType = ElementTypeRegistry.getInstance().getElementType(eClass, context);
+
+ // An IElementType is supposed to be registered for any meta-class in the UML type service.
+ assertTrue("No IElementType registered for eClass ("+eClass.getName()+")", elementType != null);
+ // An IElementType is supposed to be registered for any meta-class in the UML type service.
+ assertTrue("Unexpected IElementType id ("+elementType.getId()+")", elementType.getId().startsWith(PAPYRUS_ELEMENT_TYPE_PREFIX));
+ // Ensure a correct base is used for Helper
+ assertTrue("Incorrect edit helper hierarchy for element type ("+elementType.getId()+")", elementType.getEditHelper() instanceof DefaultEditHelper);
+ }
+ }
+ }
+
+ @Test
+ public void testRegistryContentForUMLStandard() {
+
+ // Iterate over UML2 Standard profile contents
+ Iterator<EObject> it = StandardPackage.eINSTANCE.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = it.next();
+ if (eObject instanceof EClass) {
+ EClass eClass = (EClass) eObject;
+
+ if (!"Trace".equals(eClass.getName())) {
+ // Not implemented
+ continue;
+ }
+
+ assertTrue("No type found in Papyrus context for " + eClass.getName(),
+ ElementEditServiceUtils.getEditServiceProvider().isKnownElementType(PAPYRUS_ELEMENT_TYPE_PREFIX + eClass.getName()));
+
+ }
+ }
+ }
+
+ @Test
+ public void testRegistryContentForUMLAssociations() {
+
+ IClientContext context = ClientContextManager.getInstance().getClientContext(PAPYRUS_CONTEXT_ID);
+ if (context == null) {
+ fail("Papyrus IClientContext could not be found.");
+ }
+
+ IElementType associationBaseElementType = ElementTypeRegistry.getInstance().getElementType(UMLPackage.eINSTANCE.getAssociation(), context);
+ assertTrue("Incorrect id for base Association element type ("+associationBaseElementType.getId()+")", associationBaseElementType.getId().equals("org.eclipse.papyrus.uml.AssociationBase"));
+
+ IElementType associationElementType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Association");
+ assertTrue("No ISpecializationType found for UML Association in Papyrus context", ElementEditServiceUtils.getEditServiceProvider().isKnownElementType("org.eclipse.papyrus.uml.Association"));
+ assertTrue("Incorrect kind of ElementType (ISpecializationType expected for "+ associationElementType.getId() +")", associationElementType instanceof ISpecializationType);
+ ISpecializationType associationSpecializationType = (ISpecializationType) associationElementType;
+ assertTrue("Incorrect specialization type hierarchy for "+ associationElementType.getId(), associationSpecializationType.isSpecializationOf(associationBaseElementType));
+
+ }
+
+}

Back to the top