Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorrschnekenbu2011-04-29 09:18:48 +0000
committerrschnekenbu2011-04-29 09:18:48 +0000
commit7d0406e22f6ee8e59d91e2cc474434d7175cc9cc (patch)
tree2a81b0d383ee262f04235fc2c83d7491875db73f /tests
parentb80f024dd9f4133a4488aef17eda96bfe1f24b1b (diff)
downloadorg.eclipse.papyrus-7d0406e22f6ee8e59d91e2cc474434d7175cc9cc.tar.gz
org.eclipse.papyrus-7d0406e22f6ee8e59d91e2cc474434d7175cc9cc.tar.xz
org.eclipse.papyrus-7d0406e22f6ee8e59d91e2cc474434d7175cc9cc.zip
Move the plugin from incoming folder to its final destination folder
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.classpath7
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.project28
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/META-INF/MANIFEST.MF11
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/about.html28
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/build.properties10
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/fragment.properties12
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/fragment.xml15
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/debug.gifbin0 -> 348 bytes
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test1.extendedtypes15
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.di17
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.notation39
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.uml8
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/org.eclipse.papyrus.extendedtypes.tests.launch40
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/AllTests.java27
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ExtendedEditHelperAdviceTests.java214
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ExtendedTypesRegistryTests.java128
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ITestConstants.java53
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/preferences/ExtendedTypesPreferencesTests.java103
19 files changed, 763 insertions, 0 deletions
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.classpath b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.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/core/org.eclipse.papyrus.extendedtypes.tests/.project b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.project
new file mode 100644
index 00000000000..6488a57fe49
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.extendedtypes.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/core/org.eclipse.papyrus.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..25668b8f4f0
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Oct 29 11:46:50 CEST 2010
+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/core/org.eclipse.papyrus.extendedtypes.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..fc77f62103c
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %fragmentName
+Bundle-SymbolicName: org.eclipse.papyrus.extendedtypes.tests;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Vendor: %providerName
+Fragment-Host: org.eclipse.papyrus.extendedtypes;bundle-version="0.8.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.junit,
+ org.eclipse.papyrus.uml.service.types;bundle-version="0.7.1"
+Export-Package: org.eclipse.papyrus.extendedtypes
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/about.html b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.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/core/org.eclipse.papyrus.extendedtypes.tests/build.properties b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/build.properties
new file mode 100644
index 00000000000..8f2ae069083
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/build.properties
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ fragment.xml,\
+ icons/,\
+ model/,\
+ org.eclipse.papyrus.extendedtypes.tests.launch,\
+ fragment.properties,\
+ about.html
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/fragment.properties b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/fragment.properties
new file mode 100644
index 00000000000..51e0c9e75aa
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/fragment.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2010 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
+###############################################################################
+fragmentName=Papyrus enhanced types metamodel plugin tests(Incubation)
+providerName=Eclipse.org
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/fragment.xml b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/fragment.xml
new file mode 100644
index 00000000000..474fd5681bb
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/fragment.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<fragment>
+ <extension
+ point="org.eclipse.papyrus.extendedtypes.extendedTypesSetConfiguration">
+ <configuration
+ description="Test - Model for Extended Element Type Set"
+ icon="icons/debug.gif"
+ name="Test1 Model for Extended Element Type Set"
+ path="model/Test1.extendedtypes"
+ id="org.eclipse.papyrus.extendedtypes.tests.test1">
+ </configuration>
+ </extension>
+
+</fragment>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/debug.gif b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/debug.gif
new file mode 100644
index 00000000000..ac5431fa311
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/debug.gif
Binary files differ
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test1.extendedtypes b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test1.extendedtypes
new file mode 100644
index 00000000000..cea39dc66b8
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test1.extendedtypes
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<extendedtypes:ExtendedElementTypeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/core/queries/0.7" xmlns:applystereotypeactionconfiguration="http://www.eclipse.org/papyrus/diagram/types/applystereotypeactionconfiguration/0.7" xmlns:extendedtypes="http://www.eclipse.org/papyrus/diagram/types/extendedtypes/0.7" id="org.eclipse.papyrus.extendedtypes.tests.test1">
+ <elementType name="TestClass1ExtendedElementType " id="org.eclipse.papyrus.extendedtypes.tests.Class1" preValidation="configuration:ModiscoQueryConfiguration ../../org.eclipse.papyrus.core.queries.test/resources/IsNameLongerThanQueryConfiguration1.configuration#/">
+ <iconEntry iconPath="/icons/full/obj16/Class.gif" bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Class</specializedTypesID>
+ </elementType>
+ <elementType name="TestClassInPackageExtendedElementType " id="org.eclipse.papyrus.extendedtypes.tests.ClassInPackageOnly" preValidation="configuration:ModiscoQueryConfiguration ../../org.eclipse.papyrus.core.queries.test/resources/IsNameLongerThanQueryConfiguration1.configuration#/ configuration:ModiscoQueryConfiguration ../../org.eclipse.papyrus.core.queries.test/resources/IsStrictInstanceOfPackage.configuration#/">
+ <iconEntry iconPath="/icons/full/obj16/Class.gif" bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Class</specializedTypesID>
+ </elementType>
+ <elementType name="TestClassInModelExtendedElementType " id="org.eclipse.papyrus.extendedtypes.tests.ClassInModelOnly" preValidation="configuration:ModiscoQueryConfiguration ../../org.eclipse.papyrus.core.queries.test/resources/IsStrictInstanceOfModel.configuration#/ configuration:ModiscoQueryConfiguration ../../org.eclipse.papyrus.core.queries.test/resources/IsNameLongerThanQueryConfiguration1.configuration#/">
+ <iconEntry iconPath="/icons/full/obj16/Class.gif" bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Class</specializedTypesID>
+ </elementType>
+</extendedtypes:ExtendedElementTypeSet>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.di b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.di
new file mode 100644
index 00000000000..65f88a8052c
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.di
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ASCII"?>
+<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmi:id="_YCELMP1VEd-WkaQf4YgINA">
+ <pageList xmi:id="_YCELMf1VEd-WkaQf4YgINA">
+ <availablePage xmi:id="_YCg3IP1VEd-WkaQf4YgINA">
+ <emfPageIdentifier href="model.notation#_X_rlkP1VEd-WkaQf4YgINA"/>
+ </availablePage>
+ </pageList>
+ <sashModel xmi:id="_YCELMv1VEd-WkaQf4YgINA" currentSelection="_YCELNP1VEd-WkaQf4YgINA">
+ <windows xmi:id="_YCELM_1VEd-WkaQf4YgINA">
+ <children xsi:type="di:TabFolder" xmi:id="_YCELNP1VEd-WkaQf4YgINA">
+ <children xmi:id="_YCg3If1VEd-WkaQf4YgINA">
+ <emfPageIdentifier href="model.notation#_X_rlkP1VEd-WkaQf4YgINA"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.notation b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.notation
new file mode 100644
index 00000000000..6780a566229
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.notation
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xmi:id="_X_rlkP1VEd-WkaQf4YgINA" type="PapyrusUMLClassDiagram" name="Main" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_b3oukP1VEd-WkaQf4YgINA" type="2007" fontHeight="8" lineColor="0">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_b41BYP1VEd-WkaQf4YgINA" source="ShadowFigure">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_b41BYf1VEd-WkaQf4YgINA" key="ShadowFigure_Value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_b4-yYP1VEd-WkaQf4YgINA" source="displayNameLabelIcon">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_b4-yYf1VEd-WkaQf4YgINA" key="displayNameLabelIcon_value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_b4-yYv1VEd-WkaQf4YgINA" source="QualifiedName">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_b4-yY_1VEd-WkaQf4YgINA" key="QualifiedNameDepth" value="1000"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_b5H8UP1VEd-WkaQf4YgINA" type="5026"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_b5H8Uf1VEd-WkaQf4YgINA" type="7016">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_b5H8Uv1VEd-WkaQf4YgINA"/>
+ </children>
+ <element xmi:type="uml:Package" href="model.uml#_b1QI8P1VEd-WkaQf4YgINA"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_b3oukf1VEd-WkaQf4YgINA" x="91" y="133" width="173" height="144"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_dHWqAf1VEd-WkaQf4YgINA" type="2007" fontHeight="8" lineColor="0">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_dHWqA_1VEd-WkaQf4YgINA" source="ShadowFigure">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_dHWqBP1VEd-WkaQf4YgINA" key="ShadowFigure_Value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_dHWqBf1VEd-WkaQf4YgINA" source="displayNameLabelIcon">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_dHWqBv1VEd-WkaQf4YgINA" key="displayNameLabelIcon_value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_dHWqB_1VEd-WkaQf4YgINA" source="QualifiedName">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_dHgbAP1VEd-WkaQf4YgINA" key="QualifiedNameDepth" value="1000"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_dHgbAf1VEd-WkaQf4YgINA" type="5026"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_dHgbAv1VEd-WkaQf4YgINA" type="7016">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dHgbA_1VEd-WkaQf4YgINA"/>
+ </children>
+ <element xmi:type="uml:Package" href="model.uml#_dHWqAP1VEd-WkaQf4YgINA"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dHWqAv1VEd-WkaQf4YgINA" x="392" y="127" width="228" height="183"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_X_rlkf1VEd-WkaQf4YgINA"/>
+ <element xmi:type="uml:Model" href="model.uml#_X66aUf1VEd-WkaQf4YgINA"/>
+</notation:Diagram>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.uml b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.uml
new file mode 100644
index 00000000000..acc9d86ef26
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.uml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xmi:id="_X66aUf1VEd-WkaQf4YgINA" name="Model">
+ <packageImport xmi:id="_X66aUv1VEd-WkaQf4YgINA">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Package" xmi:id="_b1QI8P1VEd-WkaQf4YgINA" name="P1"/>
+ <packagedElement xmi:type="uml:Package" xmi:id="_dHWqAP1VEd-WkaQf4YgINA" name="Package 2"/>
+</uml:Model>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/org.eclipse.papyrus.extendedtypes.tests.launch b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/org.eclipse.papyrus.extendedtypes.tests.launch
new file mode 100644
index 00000000000..c293afa2eb1
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/org.eclipse.papyrus.extendedtypes.tests.launch
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/diagram/extendedtypes/AllTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.extendedtypes.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.extendedtypes.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/AllTests.java
new file mode 100644
index 00000000000..9da5797da12
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/AllTests.java
@@ -0,0 +1,27 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.extendedtypes;
+
+import org.eclipse.papyrus.extendedtypes.preferences.ExtendedTypesPreferencesTests;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+
+/**
+ * All tests for this fragment
+ */
+@RunWith(Suite.class)
+@SuiteClasses({ ExtendedTypesRegistryTests.class, ExtendedEditHelperAdviceTests.class, ExtendedTypesPreferencesTests.class })
+public class AllTests {
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ExtendedEditHelperAdviceTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ExtendedEditHelperAdviceTests.java
new file mode 100644
index 00000000000..70ef1958b9c
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ExtendedEditHelperAdviceTests.java
@@ -0,0 +1,214 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.extendedtypes;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Test class for extended edit helper advice
+ */
+public class ExtendedEditHelperAdviceTests implements ITestConstants {
+
+ /** test class1 element type */
+ private static IElementType class1ElementType;
+
+ /** test class in package element type */
+ private static IElementType classInPackageElementType;
+
+ /** test class in model element type */
+ private static IElementType classInModelElementType;
+
+ /** class1 configuration element type */
+ private static ExtendedElementTypeConfiguration class1ElementTypeConfiguration;
+
+ /** class in package configuration element type */
+ private static ExtendedElementTypeConfiguration classInPackageElementTypeConfiguration;
+
+ /** class in model configuration element type */
+ private static ExtendedElementTypeConfiguration classInModelElementTypeConfiguration;
+
+ /** extended edit helper advice for class1 */
+ private static ExtendedEditHelperAdvice extendedClass1EditHelperAdvice;
+
+ /** extended edit helper advice for class in package */
+ private static ExtendedEditHelperAdvice extendedClassInPackageEditHelperAdvice;
+
+ /** extended edit helper advice for class in model */
+ private static ExtendedEditHelperAdvice extendedClassInModelEditHelperAdvice;
+
+ /** package with short name */
+ private static org.eclipse.uml2.uml.Package shortNamePackage;
+
+ /** package with long name */
+ private static org.eclipse.uml2.uml.Package longNamePackage;
+
+ /** model with short Name */
+ private static Package shortNameModel;
+
+ /** model with long name */
+ private static Package longNameModel;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ // create the configuration passes as argument
+ class1ElementType = ExtendedTypesRegistry.getInstance().getType(CLASS1_TEST_TYPE_ID);
+ assertNotNull("Class1 element type should not be null", class1ElementType);
+ classInPackageElementType = ExtendedTypesRegistry.getInstance().getType(CLASS_IN_PACKAGE_TEST_TYPE_ID);
+ assertNotNull("Class in package element type should not be null", classInPackageElementType);
+ classInModelElementType = ExtendedTypesRegistry.getInstance().getType(CLASS_IN_MODEL_TEST_TYPE_ID);
+ assertNotNull("Class in model element type should not be null", classInModelElementType);
+
+ ExtendedElementTypeSet set = ExtendedTypesRegistry.getInstance().getExtendedElementTypeSet(TEST1_CONFIGURATION_SET_ID, TEST1_MODEL_PATH, org.eclipse.papyrus.extendedtypes.Activator.PLUGIN_ID);
+ assertNotNull("extended type set should not be null", set);
+ for(ExtendedElementTypeConfiguration configuration : set.getElementType()) {
+ if(CLASS1_TEST_TYPE_CONFIGURATION_ID.equals(configuration.getId())) {
+ class1ElementTypeConfiguration = configuration;
+ } else if(CLASS_IN_PACKAGE_TEST_TYPE_CONFIGURATION_ID.equals(configuration.getId())) {
+ classInPackageElementTypeConfiguration = configuration;
+ } else if(CLASS_IN_MODEL_TEST_TYPE_CONFIGURATION_ID.equals(configuration.getId())) {
+ classInModelElementTypeConfiguration = configuration;
+ }
+ }
+ assertNotNull("extended type configuration should not be null", class1ElementTypeConfiguration);
+ assertNotNull("extended type configuration should not be null", classInPackageElementTypeConfiguration);
+ assertNotNull("extended type configuration should not be null", classInModelElementTypeConfiguration);
+ extendedClass1EditHelperAdvice = new ExtendedEditHelperAdvice();
+ extendedClassInPackageEditHelperAdvice = new ExtendedEditHelperAdvice();
+ extendedClassInModelEditHelperAdvice = new ExtendedEditHelperAdvice();
+
+ // create Test Model
+ Model model1 = UMLFactory.eINSTANCE.createModel();
+ model1.setName("Model1");
+ shortNamePackage = model1.createNestedPackage("P");
+ longNamePackage = model1.createNestedPackage("veryLongPackage");
+ shortNameModel = model1.createNestedPackage("tinyM", UMLPackage.eINSTANCE.getModel());
+ longNameModel = model1.createNestedPackage("veryLongModel", UMLPackage.eINSTANCE.getModel());
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ class1ElementType = null;
+ class1ElementTypeConfiguration = null;
+ extendedClass1EditHelperAdvice = null;
+ shortNamePackage = null;
+ longNamePackage = null;
+ shortNameModel = null;
+ longNameModel = null;
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.extendedtypes.ExtendedEditHelperAdvice#ExtendedEditHelperAdvice(org.eclipse.papyrus.extendedtypes.ExtendedElementTypeConfiguration)}
+ * .
+ */
+ @Test
+ public final void testExtendedEditHelperAdvice() {
+ assertNotNull("edit helper advice should not be null", extendedClass1EditHelperAdvice);
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.extendedtypes.ExtendedEditHelperAdvice#approveRequest(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest)}
+ * .
+ */
+ @Test
+ public final void testApproveRequestIEditCommandRequest() {
+ // get the request: create a class on the test packages
+
+ // simple test: test if it the name of the container is long or not enough
+ CreateElementRequest inShortPackageCreateRequest = new CreateElementRequest(shortNamePackage, class1ElementType);
+ boolean resultShort = extendedClass1EditHelperAdvice.approveRequest(inShortPackageCreateRequest);
+ assertTrue("request should always be approved", resultShort);
+
+ // simple test: test if it the name of the container is long or not enough
+ CreateElementRequest inLongPackageCreateRequest = new CreateElementRequest(longNamePackage, class1ElementType);
+ boolean resultLong = extendedClass1EditHelperAdvice.approveRequest(inLongPackageCreateRequest);
+ assertTrue("request should always be approved", resultLong);
+
+ // advanced tests: 2 queries at the same time (test true&false; false&false, false&true, true&true)
+ // false & false
+ CreateElementRequest requestShortPackageModel = new CreateElementRequest(shortNamePackage, classInModelElementType);
+ boolean shortPackageModel = extendedClassInModelEditHelperAdvice.approveRequest(requestShortPackageModel);
+ assertTrue("request should always be approved", shortPackageModel);
+
+ // true & false
+ CreateElementRequest requestLongPackageModel = new CreateElementRequest(longNamePackage, classInModelElementType);
+ boolean longPackageModel = extendedClassInModelEditHelperAdvice.approveRequest(requestLongPackageModel);
+ assertTrue("request should always be approved", longPackageModel);
+
+ // false & true
+ CreateElementRequest requestShortPackagePackage = new CreateElementRequest(shortNamePackage, classInPackageElementType);
+ boolean shortPackagePackage = extendedClassInPackageEditHelperAdvice.approveRequest(requestShortPackagePackage);
+ assertTrue("request should always be approved", shortPackagePackage);
+
+ // true & true
+ CreateElementRequest requestlongPackagePackage = new CreateElementRequest(longNamePackage, classInPackageElementType);
+ boolean longPackagePackage = extendedClassInPackageEditHelperAdvice.approveRequest(requestlongPackagePackage);
+ assertTrue("request should always be approved", longPackagePackage);
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.extendedtypes.ExtendedEditHelperAdvice#getBeforeCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest)}
+ * .
+ */
+ @Test
+ public final void testGetBeforeCreateCommandCreateElementRequest() {
+ // not test here for now...
+ }
+
+ /**
+ * Test method for
+ * {@link org.eclipse.papyrus.extendedtypes.ExtendedEditHelperAdvice#getAfterCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest)}
+ * .
+ */
+ @Test
+ public final void testGetAfterCreateCommandCreateElementRequest() {
+ // test in {oep}.diagram.extendedtypes.uml.tests fragment
+ }
+
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ExtendedTypesRegistryTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ExtendedTypesRegistryTests.java
new file mode 100644
index 00000000000..1288c6321b9
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ExtendedTypesRegistryTests.java
@@ -0,0 +1,128 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.extendedtypes;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Tests for {@link ExtendedTypesRegistry}
+ */
+public class ExtendedTypesRegistryTests implements ITestConstants {
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.extendedtypes.ExtendedTypesRegistry#getInstance()}.
+ */
+ @Test
+ public final void testGetInstance() {
+ Assert.assertNotNull("The singleton instance should not be null", ExtendedTypesRegistry.getInstance());
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.extendedtypes.ExtendedTypesRegistry#loadExtendedTypeSets()}.
+ */
+ @Test
+ public final void testLoadExtendedTypeSets() {
+ List<ExtendedElementTypeSet> result = ExtendedTypesRegistry.getInstance().loadExtendedTypeSets();
+
+
+ assertNotNull("The list of extended type sets should not be null after loading", result);
+ assertTrue("The list of extended type sets should not be empty after loading", result.size() > 0);
+
+ boolean found = false;
+ for(ExtendedElementTypeSet set : result) {
+ if(ExtendedTypeSetName_Test1.equals(set.getId())) {
+ found = true;
+ }
+ }
+ assertTrue("The list should contain Extended Type Set from Test1: " + ExtendedTypeSetName_Test1, found);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.extendedtypes.ExtendedTypesRegistry#createResourceSet()}.
+ */
+ @Test
+ public final void testCreateResourceSet() {
+ ResourceSet set = ExtendedTypesRegistry.getInstance().createResourceSet();
+ assertNotNull("Resource set should not be null", set);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.extendedtypes.ExtendedTypesRegistry#getExtendedElementTypeSet(java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public final void testGetExtendedElementTypeSet() {
+ ExtendedElementTypeSet set = ExtendedTypesRegistry.getInstance().getExtendedElementTypeSet(TEST1_CONFIGURATION_SET_ID, TEST1_MODEL_PATH, Activator.PLUGIN_ID);
+ assertNotNull("Element type model file set should be found", set);
+
+ ExtendedElementTypeSet set2 = ExtendedTypesRegistry.getInstance().getExtendedElementTypeSet("null", NO_FILE, Activator.PLUGIN_ID);
+ assertNull("Element type model file set should not be found", set2);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.extendedtypes.ExtendedTypesRegistry#getType(java.lang.String)}.
+ */
+ @Test
+ public final void testGetType() {
+ IElementType classType = ExtendedTypesRegistry.getInstance().getType(UMLElementTypes.CLASS.getId());
+ assertNotNull("element Type for class should be found", classType);
+
+ IElementType extendedClassType = ExtendedTypesRegistry.getInstance().getType(CLASS1_TEST_TYPE_ID);
+ assertNotNull("element Type for class should be found", extendedClassType);
+
+ IElementType noType = ExtendedTypesRegistry.getInstance().getType(NO_TYPE);
+ assertNull("element Type for class should not be found", noType);
+ }
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ITestConstants.java b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ITestConstants.java
new file mode 100644
index 00000000000..0ccf3ceb232
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/ITestConstants.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.extendedtypes;
+
+
+/**
+ * Constants for test classes
+ */
+public interface ITestConstants {
+
+ /** element type id for test1::Class1 */
+ public static final String CLASS1_TEST_TYPE_ID = "org.eclipse.papyrus.extendedtypes.tests.Class1";
+
+ /** element type id for test1::ClassInPackage */
+ public static final String CLASS_IN_PACKAGE_TEST_TYPE_ID = "org.eclipse.papyrus.extendedtypes.tests.ClassInPackageOnly";
+
+ /** element type id for test1::ClassInModel */
+ public static final String CLASS_IN_MODEL_TEST_TYPE_ID = "org.eclipse.papyrus.extendedtypes.tests.ClassInModelOnly";
+
+
+ /** name of the extended type set in Test1 */
+ public final static String ExtendedTypeSetName_Test1 = "org.eclipse.papyrus.extendedtypes.tests.test1";
+
+ /** path to a non existing file */
+ public static final String NO_FILE = "no_file";
+
+ /** path to a right model file */
+ public static final String TEST1_MODEL_PATH = "/model/Test1.extendedtypes";
+
+ /** identifier of the extende type set configuration */
+ public static final String TEST1_CONFIGURATION_SET_ID = "org.eclipse.papyrus.extendedtypes.tests.test1";
+
+ /** no type identifier */
+ public static final String NO_TYPE = "no_type";
+
+ /** configuration name for test1::Class1 */
+ public static final String CLASS1_TEST_TYPE_CONFIGURATION_ID = "org.eclipse.papyrus.extendedtypes.tests.Class1";
+
+ /** configuration name for test1::Class1 */
+ public static final String CLASS_IN_PACKAGE_TEST_TYPE_CONFIGURATION_ID = CLASS_IN_PACKAGE_TEST_TYPE_ID;
+
+ /** configuration name for test1::Class1 */
+ public static final String CLASS_IN_MODEL_TEST_TYPE_CONFIGURATION_ID = CLASS_IN_MODEL_TEST_TYPE_ID;
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/preferences/ExtendedTypesPreferencesTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/preferences/ExtendedTypesPreferencesTests.java
new file mode 100644
index 00000000000..bf8c0743be5
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/extendedtypes/preferences/ExtendedTypesPreferencesTests.java
@@ -0,0 +1,103 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.extendedtypes.preferences;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.XMLMemento;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Test class for {@link ExtendedTypesPreferences}
+ */
+public class ExtendedTypesPreferencesTests extends ExtendedTypesPreferences {
+
+ /** id of the extended type set for tests */
+ private final static String EXTENDED_TYPES_TEST_ID = "testExtendedTypes";
+
+ /**
+ * @throws java.lang.Exception
+ * exception thrown in case of issues
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ * exception thrown in case of issues
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ * exception thrown in case of issues
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ * exception thrown in case of issues
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test for local definitions of Palette in preferences
+ */
+ @Test
+ public final void testLocalRedefinitions() {
+ // 1. saves the root memento
+ XMLMemento rootMemento = getLocalRedefinitions();
+ IMemento[] extendedTypesRedefinitions = rootMemento.getChildren(EXTENDED_TYPES_REDEFINITION);
+
+ int initialLength = extendedTypesRedefinitions.length;
+
+ // 2. test add
+ // be sure not already existing
+ String path = getExtendedTypesRedefinition(EXTENDED_TYPES_TEST_ID);
+ assertNull("There should be no test extendedTypes yet", path);
+
+ registerLocalRedefinition(EXTENDED_TYPES_TEST_ID, "testAdd.xml");
+
+ int newLength = initialLength + 1;
+ XMLMemento newMemento = getLocalRedefinitions();
+ IMemento[] newPaletteRedefinitions = newMemento.getChildren(EXTENDED_TYPES_REDEFINITION);
+ assertTrue("There should be " + newLength + " elements, currently " + newPaletteRedefinitions.length, newLength == newPaletteRedefinitions.length);
+ String newPath = getExtendedTypesRedefinition(EXTENDED_TYPES_TEST_ID);
+ assertEquals("There should be a new path for the extendedTypes id", "testAdd.xml", newPath);
+
+ // 3. test remove
+ unregisterLocalRedefinition(EXTENDED_TYPES_TEST_ID);
+ newMemento = getLocalRedefinitions();
+ newPaletteRedefinitions = newMemento.getChildren(EXTENDED_TYPES_REDEFINITION);
+ assertTrue("There should be " + newLength + " elements", newPaletteRedefinitions.length == initialLength);
+ newPath = getExtendedTypesRedefinition(EXTENDED_TYPES_TEST_ID);
+ assertNull("There should be no path for the extendedTypes id", newPath);
+
+ }
+}

Back to the top