summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-05-12 10:19:51 (EDT)
committerBenoit Maggi2014-05-28 08:34:52 (EDT)
commit9bf0946b7237fff8bfd9632ff399fa7b504d7592 (patch)
tree121749c71887e0cdbe34ff2bcf176a26e01e5555
parentd8a87ba9d8b961682f37d5bd042a2e35f4df1141 (diff)
downloadorg.eclipse.papyrus-9bf0946b7237fff8bfd9632ff399fa7b504d7592.zip
org.eclipse.papyrus-9bf0946b7237fff8bfd9632ff399fa7b504d7592.tar.gz
org.eclipse.papyrus-9bf0946b7237fff8bfd9632ff399fa7b504d7592.tar.bz2
Bug 431629 - [model-explorer] Copy-paste enters into an infinite looprefs/changes/70/26370/3
that causes memory overflow and crash when a package imports a container package - create plugin for tests with a test on a recursive model - Stock already visited namespace to avoid loop on recusive call Change-Id: I5599073fff8b20bd99cf9b6c8610e25afffaf253 Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--features/papyrus-tests-features/org.eclipse.papyrus.tests.uml.tools.feature/feature.xml109
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NameResolutionHelper.java333
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF123
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java305
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/.classpath7
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/.project28
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/META-INF/MANIFEST.MF20
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/about.html28
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/build.properties6
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/plugin.properties2
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.di2
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.notation2
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.uml9
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/Activator.java71
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/tests/AllTests.java27
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/tests/NameResolutionHelperTest.java71
17 files changed, 723 insertions, 427 deletions
diff --git a/features/papyrus-tests-features/org.eclipse.papyrus.tests.uml.tools.feature/feature.xml b/features/papyrus-tests-features/org.eclipse.papyrus.tests.uml.tools.feature/feature.xml
index cdbad9d..b690efd 100644
--- a/features/papyrus-tests-features/org.eclipse.papyrus.tests.uml.tools.feature/feature.xml
+++ b/features/papyrus-tests-features/org.eclipse.papyrus.tests.uml.tools.feature/feature.xml
@@ -1,55 +1,56 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><feature id="org.eclipse.papyrus.tests.uml.tools.feature" label="Papyrus UML Tools tests feature" provider-name="Eclipse Modeling Project" version="1.0.0.qualifier">
-
-<copyright url="http://www.eclipse.org/legal/epl-v10.html">
- 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
- </copyright>
-
- <license url="license.html">
- Eclipse Foundation Software User Agreement
-March 17, 2005
-
-Usage Of Content
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.
-
-Applicable Licenses
-Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program" will mean the Content.
-
-Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS modules ("Modules") and made available as downloadable archives ("Downloads").
-
-Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
-Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java" ARchive) in a directory named "plugins".
-A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins and/or Fragments associated with that Feature.
-Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
-The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module including, but not limited to the following locations:
-
-The top-level (root) directory
-Plug-in and Fragment directories
-Inside Plug-ins and Fragments packaged as JARs
-Sub-directories of the directory named "src" of certain Plug-ins
-Feature directories
-Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in that directory.
-
-THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):
-
-Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)
-Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)
-Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)
-IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)
-Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)
-Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.
-
-Cryptography
-Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted.
-
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
- </license>
-
- <plugin download-size="0" id="org.eclipse.papyrus.uml.tools.tests" install-size="0" unpack="false" version="0.0.0"/>
-
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><feature id="org.eclipse.papyrus.tests.uml.tools.feature" label="Papyrus UML Tools tests feature" provider-name="Eclipse Modeling Project" version="1.0.0.qualifier">
+
+<copyright url="http://www.eclipse.org/legal/epl-v10.html">
+ 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
+ </copyright>
+
+ <license url="license.html">
+ Eclipse Foundation Software User Agreement
+March 17, 2005
+
+Usage Of Content
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.
+
+Applicable Licenses
+Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program" will mean the Content.
+
+Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS modules ("Modules") and made available as downloadable archives ("Downloads").
+
+Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
+Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java" ARchive) in a directory named "plugins".
+A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins and/or Fragments associated with that Feature.
+Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
+The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module including, but not limited to the following locations:
+
+The top-level (root) directory
+Plug-in and Fragment directories
+Inside Plug-ins and Fragments packaged as JARs
+Sub-directories of the directory named "src" of certain Plug-ins
+Feature directories
+Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in that directory.
+
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):
+
+Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)
+Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)
+Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)
+IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)
+Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)
+Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.
+
+Cryptography
+Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted.
+
+Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
+ </license>
+
+ <plugin download-size="0" id="org.eclipse.papyrus.uml.tools.tests" install-size="0" unpack="false" version="0.0.0"/>
+ <plugin download-size="0" id="org.eclipse.papyrus.uml.tools.utils.tests" install-size="0" unpack="false" version="0.0.0"/>
+
</feature> \ No newline at end of file
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NameResolutionHelper.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NameResolutionHelper.java
index 09710b2..0875161 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NameResolutionHelper.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NameResolutionHelper.java
@@ -1,160 +1,173 @@
-/*****************************************************************************
- * Copyright (c) 2012 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:
- * Arnaud Cuccuru (CEA LIST) - Initial API and implementation
- * Vincent Lorenzo (CEA LIST)
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.tools.utils;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.resource.UMLResource;
-
-
-public class NameResolutionHelper {
-
- protected Namespace scope;
-
- protected EClass filter;
-
- protected Map<String, List<NamedElement>> allNames;
-
- public NameResolutionHelper(Namespace scope, EClass filter) {
- this.scope = scope;
- this.filter = filter;
- }
-
- public List<NamedElement> getNamedElements(String name) {
- if(this.allNames == null) {
- this.allNames = new HashMap<String, List<NamedElement>>();
- this.computeAllNames();
- }
- List<NamedElement> namedElements = this.allNames.get(name);
- return namedElements != null ? namedElements : new ArrayList<NamedElement>();
- }
-
- /**
- * TODO
- */
- protected void computeAllNames() {
-
- // compute names directly available in the scope
- computeNames("", scope, true);
-
- // compute names related to enclosing namepaces of scope
- Namespace enclosingNamespace = scope.getNamespace();
- String prefix = "";
- while(enclosingNamespace != null) {
-// prefix += enclosingNamespace.getName() + NamedElementUtil.QUALIFIED_NAME_SEPARATOR;
- prefix="";
- computeNames(prefix, enclosingNamespace, false);
- enclosingNamespace = enclosingNamespace.getNamespace();
- }
-
- // Compute names related to the root context model
- Namespace model = scope.getModel();
- if(model==null){
- model = scope;
- }
- if(filter != null) {
- if(filter.isSuperTypeOf(model.eClass())) {
- List<NamedElement> l = this.allNames.get(model.getName());
- if(l == null) { // i.e. no names have already been resolved in enclosed namespaces
- l = new ArrayList<NamedElement>();
- l.add(model);
- this.allNames.put(model.getName(), l);
- }
- }
- } else {
- List<NamedElement> l = this.allNames.get(model.getName());
- if(l == null) { // i.e. no names have already been resolved in enclosed namespaces
- l = new ArrayList<NamedElement>();
- l.add(model);
- this.allNames.put(model.getName(), l);
- }
- }
- computeNames(model.getName() + "::", model, false);
-
- // Build names corresponding to other available UML resources in the workspace
- List<Resource> resources = new ArrayList<Resource>(scope.eResource().getResourceSet().getResources());//we duplicate the resource to avoid concurrent modification
- for(Resource resource : resources) {
- if(resource != scope.eResource() && resource instanceof UMLResource) {
- UMLResource umlResource = (UMLResource)resource;
- Model root = null;
- for(Iterator<EObject> i = umlResource.getAllContents(); i.hasNext() && root == null;) {
- EObject next = i.next();
- if(next instanceof Model)
- root = (Model)next;
- }
- if(root != null) {
- if(filter != null) {
- if(filter.isSuperTypeOf(root.eClass())) {
- List<NamedElement> l = this.allNames.get(root.getName());
- if(l == null) { // i.e. no names have already been resolved in enclosed namespaces
- l = new ArrayList<NamedElement>();
- l.add(root);
- this.allNames.put(root.getName(), l);
- }
- }
- } else {
- List<NamedElement> l = this.allNames.get(root.getName());
- if(l == null) { // i.e. no names have already been resolved in enclosed namespaces
- l = new ArrayList<NamedElement>();
- l.add(root);
- this.allNames.put(root.getName(), l);
- }
- }
- computeNames(root.getName() + NamedElementUtil.QUALIFIED_NAME_SEPARATOR, root, false);
- }
- }
- }
- }
-
-
- /**
- * TODO
- */
- protected void computeNames(String prefix, Namespace scope, boolean ignoreAlreadyFoundNames) {
- Set<String> preExistingKeys;
- if(ignoreAlreadyFoundNames)
- preExistingKeys = new HashSet<String>();
- else
- preExistingKeys = this.allNames.keySet();
- // iterates members of the scope
- for(NamedElement member : scope.getMembers()) {
- List<String> memberNames = scope.getNamesOfMember(member);
- // iterates other names given to the current member in the context of this scope
- for(String memberName : memberNames) {
- // Checks if the name must be considered or not
- if(!preExistingKeys.contains(prefix + memberName)) {
- List<NamedElement> l = this.getNamedElements(prefix + memberName);
- l.add(member);
- this.allNames.put(prefix + memberName, l);
- }
- if(member instanceof Namespace) { // Recursive call on the current member
- computeNames(prefix + memberName + NamedElementUtil.QUALIFIED_NAME_SEPARATOR, (Namespace)member, true);
- }
- }
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Arnaud Cuccuru (CEA LIST) - Initial API and implementation
+ * Vincent Lorenzo (CEA LIST)
+ * Benoit Maggi (CEA LIST) - Bug 431629 Patch to avoid loop on imported packages
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.tools.utils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.resource.UMLResource;
+
+
+public class NameResolutionHelper {
+
+ protected Namespace scope;
+
+ protected EClass filter;
+
+ protected Map<String, List<NamedElement>> allNames;
+
+ public NameResolutionHelper(Namespace scope, EClass filter) {
+ this.scope = scope;
+ this.filter = filter;
+ }
+
+ public List<NamedElement> getNamedElements(String name) {
+ if(this.allNames == null) {
+ this.allNames = new HashMap<String, List<NamedElement>>();
+ this.computeAllNames();
+ }
+ List<NamedElement> namedElements = this.allNames.get(name);
+ return namedElements != null ? namedElements : new ArrayList<NamedElement>();
+ }
+
+ /**
+ * TODO
+ */
+ protected void computeAllNames() {
+
+ // compute names directly available in the scope
+ computeNames("", scope, true);
+
+ // compute names related to enclosing namepaces of scope
+ Namespace enclosingNamespace = scope.getNamespace();
+ String prefix = "";
+ while(enclosingNamespace != null) {
+// prefix += enclosingNamespace.getName() + NamedElementUtil.QUALIFIED_NAME_SEPARATOR;
+ prefix="";
+ computeNames(prefix, enclosingNamespace, false);
+ enclosingNamespace = enclosingNamespace.getNamespace();
+ }
+
+ // Compute names related to the root context model
+ Namespace model = scope.getModel();
+ if(model==null){
+ model = scope;
+ }
+ if(filter != null) {
+ if(filter.isSuperTypeOf(model.eClass())) {
+ List<NamedElement> l = this.allNames.get(model.getName());
+ if(l == null) { // i.e. no names have already been resolved in enclosed namespaces
+ l = new ArrayList<NamedElement>();
+ l.add(model);
+ this.allNames.put(model.getName(), l);
+ }
+ }
+ } else {
+ List<NamedElement> l = this.allNames.get(model.getName());
+ if(l == null) { // i.e. no names have already been resolved in enclosed namespaces
+ l = new ArrayList<NamedElement>();
+ l.add(model);
+ this.allNames.put(model.getName(), l);
+ }
+ }
+ computeNames(model.getName() + NamedElementUtil.QUALIFIED_NAME_SEPARATOR, model, false);
+
+ // Build names corresponding to other available UML resources in the workspace
+ List<Resource> resources = new ArrayList<Resource>(scope.eResource().getResourceSet().getResources());//we duplicate the resource to avoid concurrent modification
+ for(Resource resource : resources) {
+ if(resource != scope.eResource() && resource instanceof UMLResource) {
+ UMLResource umlResource = (UMLResource)resource;
+ Model root = null;
+ for(Iterator<EObject> i = umlResource.getAllContents(); i.hasNext() && root == null;) {
+ EObject next = i.next();
+ if(next instanceof Model)
+ root = (Model)next;
+ }
+ if(root != null) {
+ if(filter != null) {
+ if(filter.isSuperTypeOf(root.eClass())) {
+ List<NamedElement> l = this.allNames.get(root.getName());
+ if(l == null) { // i.e. no names have already been resolved in enclosed namespaces
+ l = new ArrayList<NamedElement>();
+ l.add(root);
+ this.allNames.put(root.getName(), l);
+ }
+ }
+ } else {
+ List<NamedElement> l = this.allNames.get(root.getName());
+ if(l == null) { // i.e. no names have already been resolved in enclosed namespaces
+ l = new ArrayList<NamedElement>();
+ l.add(root);
+ this.allNames.put(root.getName(), l);
+ }
+ }
+ computeNames(root.getName() + NamedElementUtil.QUALIFIED_NAME_SEPARATOR, root, false);
+ }
+ }
+ }
+ }
+
+ /**
+ * TODO
+ */
+ protected void computeNames(String prefix, Namespace scope, boolean ignoreAlreadyFoundNames) {
+ computeNames(prefix,scope,ignoreAlreadyFoundNames, new HashSet<Namespace>()) ;
+ }
+
+ /**
+ *
+ * @param prefix
+ * @param scope
+ * @param ignoreAlreadyFoundNames
+ * @param alreadyComputedNamespace list of already visited Namespace to avoid loop on imported packages
+ */
+ protected void computeNames(String prefix, Namespace scope, boolean ignoreAlreadyFoundNames, Set<Namespace> alreadyComputedNamespace) {
+ alreadyComputedNamespace.add(scope);
+ Set<String> preExistingKeys;
+ if(ignoreAlreadyFoundNames)
+ preExistingKeys = new HashSet<String>();
+ else
+ preExistingKeys = this.allNames.keySet();
+ // iterates members of the scope
+ for(NamedElement member : scope.getMembers()) {
+ List<String> memberNames = scope.getNamesOfMember(member);
+ // iterates other names given to the current member in the context of this scope
+ for(String memberName : memberNames) {
+ // Checks if the name must be considered or not
+ if(!preExistingKeys.contains(prefix + memberName)) {
+ List<NamedElement> l = this.getNamedElements(prefix + memberName);
+ l.add(member);
+ this.allNames.put(prefix + memberName, l);
+ }
+ if(member instanceof Namespace && ! alreadyComputedNamespace.contains(member)) { // avoid loop on imported packages
+ // Recursive call on the current member
+ computeNames(prefix + memberName + NamedElementUtil.QUALIFIED_NAME_SEPARATOR, (Namespace)member, false , alreadyComputedNamespace);
+ }
+ }
+ }
+ }
+}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
index 2758bab..428e5e9 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
@@ -1,62 +1,63 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.service.types;bundle-version="1.0.0",
- org.eclipse.papyrus.sysml.service.types;bundle-version="1.0.0",
- org.eclipse.papyrus.sysml.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.diagram.clazz.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.bundles.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.views.modelexplorer.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.modelexplorer.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.activity.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.deployment.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.component.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.usecase.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.dnd.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.diagram.stereotypeproperty.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.diagram.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
- org.eclipse.papyrus.sysml.diagram.blockdefinition;bundle-version="1.0.0",
- org.eclipse.papyrus.sysml.diagram.internalblock;bundle-version="1.0.0",
- org.eclipse.papyrus.sysml.diagram.requirement.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.sysml.modelexplorer;bundle-version="1.0.0",
- org.eclipse.papyrus.customization.properties.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.services.labelprovider.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.timing.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.editor.integration.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.search.tests;bundle-version="1.0.0",
- org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.uml.tools.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.nattable.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.sysml.nattable.requirement.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.nattable.views.editor.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.nattable.model.editor.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.sequence.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.interactionoverview.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.composite.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.css.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.extendedtypes.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.tools.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.wizards.tests;bundle-version="1.0.0",
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.service.types;bundle-version="1.0.0",
+ org.eclipse.papyrus.sysml.service.types;bundle-version="1.0.0",
+ org.eclipse.papyrus.sysml.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.diagram.clazz.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.bundles.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.views.modelexplorer.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.modelexplorer.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.activity.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.deployment.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.component.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.usecase.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.dnd.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.diagram.stereotypeproperty.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.diagram.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
+ org.eclipse.papyrus.sysml.diagram.blockdefinition;bundle-version="1.0.0",
+ org.eclipse.papyrus.sysml.diagram.internalblock;bundle-version="1.0.0",
+ org.eclipse.papyrus.sysml.diagram.requirement.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.sysml.modelexplorer;bundle-version="1.0.0",
+ org.eclipse.papyrus.customization.properties.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.services.labelprovider.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.timing.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.editor.integration.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.search.tests;bundle-version="1.0.0",
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.uml.tools.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.tools.utils.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.nattable.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.sysml.nattable.requirement.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.nattable.views.editor.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.nattable.model.editor.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.sequence.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.interactionoverview.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.composite.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.css.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.extendedtypes.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.tools.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.wizards.tests;bundle-version="1.0.0",
org.eclipse.papyrus.uml.modelrepair;bundle-version="1.0.0",
- org.eclipse.papyrus.diagram.profile.tests;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.services.controlmode.tests;bundle-version="1.0.0"
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.0.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.tests.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
+ org.eclipse.papyrus.diagram.profile.tests;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.services.controlmode.tests;bundle-version="1.0.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.tests.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.tests
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
index 8d8d267..51c3851 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
@@ -1,152 +1,153 @@
-/*****************************************************************************
- * Copyright (c) 2010, 2014 CEA LIST and others.
- *
- * 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
- * Christian W. Damus (CEA) - bugs 402525, 323802, 431953, 433310, 434993
- *
- *****************************************************************************/
-package org.eclipse.papyrus.tests;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.papyrus.tests.launcher.FragmentTestSuiteClass;
-import org.eclipse.papyrus.tests.launcher.ITestSuiteClass;
-import org.eclipse.papyrus.tests.launcher.PluginTestSuiteClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.model.InitializationError;
-
-
-/**
- * Test class for all tests for Papyrus
- */
-@RunWith(AllTests.AllTestsRunner.class)
-public class AllTests {
-
- public static final List<ITestSuiteClass> suiteClasses;
- /** list of classes to launch */
- static {
- suiteClasses = new ArrayList<ITestSuiteClass>();
-
- /* **************** plugins *********************** */
- /* developper */
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.bundles.tests.AllTests.class));
-
- /* core */
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.core.tests.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.core.sasheditor.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.core.sasheditor.tests.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass("org.eclipse.papyrus.infra.core.sasheditor.di", "org.eclipse.papyrus.infra.core.sasheditor.di.tests.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.services.resourceloading.Activator.PLUGIN_ID, "org.eclipse.papyrus.core.resourceloading.tests.AllTests"));
-
- /* infra */
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.tools.tests.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.services.edit.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.services.edit.tests.suites.AllTests"));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.labelprovider.tests.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.tests.AllTests"));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.extendedtypes.tests.AllTests.class));
- // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.openelement.tests.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.commands.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.gmfdiag.commands.tests.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.common.Activator.ID, "org.eclipse.papyrus.infra.gmfdiag.common.tests.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.readonly.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.readonly.tests.AllTests"));
-
- /* views */
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.views.modelexplorer.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.customization.properties.tests.AllTests.class));
-
- /* integration */
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.editor.integration.tests.AllTests.class));
-
- /* search */
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.search.tests.suites.AllTests.class));
-
- /* css */
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.css.tests.tests.AllTests.class));
-
- /* control mode */
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.controlmode.tests.AllTests.class));
-
- if(System.getProperty("no.SysML.tests") == null) {
- // SysML tests
- suiteClasses.addAll(AllSysMLTests.suiteClasses);
- }
-
- /* uml */
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.diagram.common.Activator.ID, "org.eclipse.papyrus.diagram.common.tests.AllTests"));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.service.types.Activator.PLUGIN_ID, "org.eclipse.papyrus.uml.service.types.tests.suites.AllTests"));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.modelexplorer.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.dnd.tests.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.tools.tests.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.diagram.stereotypeproperty.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.wizards.AllTests.class));
- suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.modelrepair.Activator.PLUGIN_ID, "org.eclipse.papyrus.uml.modelrepair.tests.AllTests"));
-
- /* uml diagrams */
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.diagram.clazz.test.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.activity.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.deployment.test.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.component.test.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.timing.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.usecase.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.composite.test.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.diagram.profile.tests.AllTests.class));
- //suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.sequence.tests.AllTests.class)); //Disabled. They currently do not run on Hudson
- // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.interactionoverview.tests.AllTests.class)); //Disabled. They currently do not run on Hudson
- //
-
- //nattable tests
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.nattable.tests.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.nattable.requirement.tests.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.nattable.views.tests.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.nattable.model.editor.tests.tests.AllTests.class));
-
-
- //end
- }
-
- /**
- * Finds and runs tests.
- */
- public static class AllTestsRunner extends Suite {
-
- /**
- * Constructor.
- *
- * @param clazz
- * the suite class � AllTests2
- * @throws InitializationError
- * if there's a problem
- * @throws org.junit.runners.model.InitializationError
- */
- public AllTestsRunner(final Class<?> clazz) throws InitializationError {
- super(clazz, getSuites());
- }
- }
-
- /**
- * Returns the list of test classes
- *
- * @return the list of test classes
- */
- private static Class<?>[] getSuites() {
- // retrieve all test suites.
- final Collection<Class<?>> suites = new ArrayList<Class<?>>();
- for(final ITestSuiteClass testSuiteClass : suiteClasses) {
- final Class<?> class_ = testSuiteClass.getMainTestSuiteClass();
- if(class_ != null) {
- suites.add(class_);
- } else {
- System.err.println(testSuiteClass + " does not give a correct test suite class");
- }
- }
- return suites.toArray(new Class<?>[]{});
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2014 CEA LIST and others.
+ *
+ * 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
+ * Christian W. Damus (CEA) - bugs 402525, 323802, 431953, 433310, 434993
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.tests;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.papyrus.tests.launcher.FragmentTestSuiteClass;
+import org.eclipse.papyrus.tests.launcher.ITestSuiteClass;
+import org.eclipse.papyrus.tests.launcher.PluginTestSuiteClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.model.InitializationError;
+
+
+/**
+ * Test class for all tests for Papyrus
+ */
+@RunWith(AllTests.AllTestsRunner.class)
+public class AllTests {
+
+ public static final List<ITestSuiteClass> suiteClasses;
+ /** list of classes to launch */
+ static {
+ suiteClasses = new ArrayList<ITestSuiteClass>();
+
+ /* **************** plugins *********************** */
+ /* developper */
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.bundles.tests.AllTests.class));
+
+ /* core */
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.core.tests.AllTests"));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.core.sasheditor.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.core.sasheditor.tests.AllTests"));
+ suiteClasses.add(new FragmentTestSuiteClass("org.eclipse.papyrus.infra.core.sasheditor.di", "org.eclipse.papyrus.infra.core.sasheditor.di.tests.AllTests"));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.services.resourceloading.Activator.PLUGIN_ID, "org.eclipse.papyrus.core.resourceloading.tests.AllTests"));
+
+ /* infra */
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.tools.tests.AllTests.class));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.services.edit.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.services.edit.tests.suites.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.labelprovider.tests.AllTests.class));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.tests.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.extendedtypes.tests.AllTests.class));
+ // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.openelement.tests.AllTests.class));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.commands.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.gmfdiag.commands.tests.AllTests"));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.common.Activator.ID, "org.eclipse.papyrus.infra.gmfdiag.common.tests.AllTests"));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.readonly.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.readonly.tests.AllTests"));
+
+ /* views */
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.views.modelexplorer.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.customization.properties.tests.AllTests.class));
+
+ /* integration */
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.editor.integration.tests.AllTests.class));
+
+ /* search */
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.search.tests.suites.AllTests.class));
+
+ /* css */
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.gmfdiag.css.tests.tests.AllTests.class));
+
+ /* control mode */
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.controlmode.tests.AllTests.class));
+
+ if(System.getProperty("no.SysML.tests") == null) {
+ // SysML tests
+ suiteClasses.addAll(AllSysMLTests.suiteClasses);
+ }
+
+ /* uml */
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.diagram.common.Activator.ID, "org.eclipse.papyrus.diagram.common.tests.AllTests"));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.service.types.Activator.PLUGIN_ID, "org.eclipse.papyrus.uml.service.types.tests.suites.AllTests"));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.modelexplorer.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.dnd.tests.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.tools.tests.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.tools.utils.tests.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.diagram.stereotypeproperty.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.wizards.AllTests.class));
+ suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.modelrepair.Activator.PLUGIN_ID, "org.eclipse.papyrus.uml.modelrepair.tests.AllTests"));
+
+ /* uml diagrams */
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.diagram.clazz.test.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.activity.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.deployment.test.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.component.test.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.timing.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.usecase.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.composite.test.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.diagram.profile.tests.AllTests.class));
+ //suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.sequence.tests.AllTests.class)); //Disabled. They currently do not run on Hudson
+ // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.interactionoverview.tests.AllTests.class)); //Disabled. They currently do not run on Hudson
+ //
+
+ //nattable tests
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.nattable.tests.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.nattable.requirement.tests.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.nattable.views.tests.tests.AllTests.class));
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.nattable.model.editor.tests.tests.AllTests.class));
+
+
+ //end
+ }
+
+ /**
+ * Finds and runs tests.
+ */
+ public static class AllTestsRunner extends Suite {
+
+ /**
+ * Constructor.
+ *
+ * @param clazz
+ * the suite class � AllTests2
+ * @throws InitializationError
+ * if there's a problem
+ * @throws org.junit.runners.model.InitializationError
+ */
+ public AllTestsRunner(final Class<?> clazz) throws InitializationError {
+ super(clazz, getSuites());
+ }
+ }
+
+ /**
+ * Returns the list of test classes
+ *
+ * @return the list of test classes
+ */
+ private static Class<?>[] getSuites() {
+ // retrieve all test suites.
+ final Collection<Class<?>> suites = new ArrayList<Class<?>>();
+ for(final ITestSuiteClass testSuiteClass : suiteClasses) {
+ final Class<?> class_ = testSuiteClass.getMainTestSuiteClass();
+ if(class_ != null) {
+ suites.add(class_);
+ } else {
+ System.err.println(testSuiteClass + " does not give a correct test suite class");
+ }
+ }
+ return suites.toArray(new Class<?>[]{});
+ }
+
+}
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/.classpath b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.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/tools/org.eclipse.papyrus.uml.tools.utils.tests/.project b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/.project
new file mode 100644
index 0000000..4a69e79
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.tools.utils.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/tools/org.eclipse.papyrus.uml.tools.utils.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..af0f20f
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+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/tools/org.eclipse.papyrus.uml.tools.utils.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5ed20fd
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.0.0",
+ org.eclipse.emf.transaction;bundle-version="1.4.0",
+ org.eclipse.papyrus.uml.tools.utils,
+ org.eclipse.papyrus.infra.core
+Export-Package: org.eclipse.papyrus.uml.tools.utils.tests,
+ org.eclipse.papyrus.uml.tools.utils.tests.tests
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.uml.tools.utils.tests.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.uml.tools.utils.tests
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/about.html b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/about.html
new file mode 100644
index 0000000..d35d5ae
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.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/tools/org.eclipse.papyrus.uml.tools.utils.tests/build.properties b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/build.properties
new file mode 100644
index 0000000..9cbab3c
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/plugin.properties b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/plugin.properties
new file mode 100644
index 0000000..def3783
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/plugin.properties
@@ -0,0 +1,2 @@
+providerName = Eclipse Modeling Project
+pluginName = Tests for Uml Tools Utils (Incubation) \ No newline at end of file
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.di b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.di
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.notation b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.notation
new file mode 100644
index 0000000..bf9abab
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.notation
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.uml b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.uml
new file mode 100644
index 0000000..bd32237
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/resources/recursiveModelImport.uml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_Yma9gNtvEeOVmoNVH1bTpw" name="model">
+ <packagedElement xmi:type="uml:Package" xmi:id="_a8CxENtvEeOVmoNVH1bTpw" name="Package1">
+ <packagedElement xmi:type="uml:Package" xmi:id="_0FezUNtyEeOVmoNVH1bTpw" name="Package2">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_cnAZ4Nt2EeOVmoNVH1bTpw" importedPackage="_a8CxENtvEeOVmoNVH1bTpw"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_SQ9TcNtzEeOVmoNVH1bTpw" name="Class1"/>
+ </packagedElement>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/Activator.java b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/Activator.java
new file mode 100644
index 0000000..f86fb09
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/Activator.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.tools.utils.tests;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.tools.utils.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/tests/AllTests.java b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/tests/AllTests.java
new file mode 100644
index 0000000..885694b
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/tests/AllTests.java
@@ -0,0 +1,27 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.tools.utils.tests.tests;
+
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ NameResolutionHelperTest.class
+
+})
+public class AllTests {
+ //Test suite
+}
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/tests/NameResolutionHelperTest.java b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/tests/NameResolutionHelperTest.java
new file mode 100644
index 0000000..b2d24f2
--- /dev/null
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils.tests/src/org/eclipse/papyrus/uml/tools/utils/tests/tests/NameResolutionHelperTest.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.tools.utils.tests.tests;
+
+import java.util.List;
+
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.eclipse.papyrus.uml.tools.utils.NameResolutionHelper;
+import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
+import org.eclipse.papyrus.uml.tools.utils.tests.Activator;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class NameResolutionHelperTest extends AbstractEditorTest {
+
+ public static final String RESOURCES_PATH = "resources/"; //$NON-NLS-1$
+
+ public static final String MODEL_NAME = "recursiveModelImport"; //$NON-NLS-1$
+
+ public final static String PACKAGE1_NAME = "Package1"; //$NON-NLS-1$
+
+ public final static String PACKAGE2_NAME = "Package2"; //$NON-NLS-1$
+
+ public final static String CLASS1_NAME = "Class1"; //$NON-NLS-1$
+
+ public static final String PROJECT_NAME = "NameResolutionHelperTest"; //$NON-NLS-1$
+
+ @Before
+ public void initModelForCutTest() {
+ try {
+ initModel(PROJECT_NAME, MODEL_NAME, Activator.getDefault().getBundle());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ protected String getSourcePath() {
+ return RESOURCES_PATH;
+ }
+
+ /**
+ * Check NameResolution on a recursive model
+ */
+ @Test
+ public void recursiveImportPackage() {
+ Package rootUMLModel = getRootUMLModel();
+ Assert.assertNotNull("RootModel is null", rootUMLModel); //$NON-NLS-1$
+ org.eclipse.uml2.uml.Package package1 = (org.eclipse.uml2.uml.Package)rootUMLModel.getPackagedElement(PACKAGE1_NAME);
+ Assert.assertNotNull("The package 1 is not present", package1); //$NON-NLS-1$
+ NameResolutionHelper nameResolutionHelper = new NameResolutionHelper(package1, null);
+ List<NamedElement> namedElements = nameResolutionHelper.getNamedElements(PACKAGE1_NAME + NamedElementUtil.QUALIFIED_NAME_SEPARATOR + PACKAGE2_NAME + NamedElementUtil.QUALIFIED_NAME_SEPARATOR + CLASS1_NAME);
+ Assert.assertNotNull("NamedElements is null", namedElements); //$NON-NLS-1$
+ Assert.assertFalse("NamedElements is empty", namedElements.isEmpty()); //$NON-NLS-1$
+ }
+
+}