Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2016-06-07 09:53:17 -0400
committerCamille Letavernier2016-06-07 09:53:17 -0400
commit15f5add0ff77094d452d21c4695cca13f5c21ea9 (patch)
tree2e1ae3cd6a25a6542867d1849075f6b04395ecd4
parent309e20bb9e69b1e9e456a1876c37577966986eeb (diff)
downloadorg.eclipse.papyrus-15f5add0ff77094d452d21c4695cca13f5c21ea9.tar.gz
org.eclipse.papyrus-15f5add0ff77094d452d21c4695cca13f5c21ea9.tar.xz
org.eclipse.papyrus-15f5add0ff77094d452d21c4695cca13f5c21ea9.zip
Bug 495530: [Test] Test failure in TestDropStereotypedClass
https://bugs.eclipse.org/bugs/show_bug.cgi?id=495530 - Always clear the Expansion Registry before and after a Test, to ensure more deterministic behaviors Change-Id: Iaf8cff9e09af5b2967bcf654c6f4db829e955de9 Signed-off-by: Camille Letavernier <camille.letavernier@cea.fr>
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus ALL tests.launch90
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java23
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java25
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java23
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java22
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java21
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java9
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java19
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/LoadExpansionModel.java74
9 files changed, 182 insertions, 124 deletions
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus ALL tests.launch b/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus ALL tests.launch
index edd0e7d5934..003a1121a7d 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus ALL tests.launch
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/Papyrus ALL tests.launch
@@ -1,45 +1,45 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
-<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/Papyrus ALL tests"/>
-<booleanAttribute key="default" value="true"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<stringAttribute key="location" value="${workspace_loc}/../junit-all-workspace"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<mapAttribute key="org.eclipse.debug.core.environmentVariables">
-<mapEntry key="skip.long.junit.tests" value="false"/>
-</mapAttribute>
-<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"/>
-<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.tests.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.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.6 -Xms512m -Xmx1024m -DsuppressRawWhenUnchecked=true -XX:MaxPermSize=512M&#10;-XX:SoftRefLRUPolicyMSPerMB=100&#10;-Doomph.setup.skip=true&#10;-Doomph.setup.questionnaire.skip=true"/>
-<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="true"/>
-<booleanAttribute key="useCustomFeatures" value="false"/>
-<booleanAttribute key="useDefaultConfig" value="true"/>
-<booleanAttribute key="useDefaultConfigArea" value="true"/>
-<booleanAttribute key="useProduct" value="true"/>
-<stringAttribute key="yk-options" value="&#10;additional-options2=onexit\=snapshot&#10;"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<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/Papyrus ALL tests"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-all-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="skip.long.junit.tests" value="false"/>
+</mapAttribute>
+<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"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.tests.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.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.8 -Xms512m -Xmx1024m -DsuppressRawWhenUnchecked=true&#13;&#10;-XX:SoftRefLRUPolicyMSPerMB=100&#13;&#10;-Doomph.setup.skip=true&#13;&#10;-Doomph.setup.questionnaire.skip=true"/>
+<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="true"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<booleanAttribute key="useProduct" value="true"/>
+<stringAttribute key="yk-options" value="&#10;additional-options2=onexit\=snapshot&#10;"/>
+</launchConfiguration>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java
index ee8eb964cd1..622deab1cd6 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/AssistantUsage.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, 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
@@ -9,7 +9,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.tests;
@@ -43,7 +43,9 @@ import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart;
+import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
@@ -51,13 +53,13 @@ import org.osgi.framework.FrameworkUtil;
/**
* this Test is used to test if it is possible to add compartment
* see #Test T003-Add Child Label
- *
+ *
*
*/
public class AssistantUsage extends AbstractEditorTest {
/**
- *
+ *
*/
protected static final String NESTED_INTERFACE_LABEL = "Interface_Label";
@@ -76,15 +78,15 @@ public class AssistantUsage extends AbstractEditorTest {
}
/**
- *
+ *
*/
protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
/**
- *
+ *
*/
protected static final String CLASS_VISUALID = ClassEditPart.VISUAL_ID;
/**
- *
+ *
*/
protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
@@ -185,7 +187,6 @@ public class AssistantUsage extends AbstractEditorTest {
protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
@@ -211,4 +212,10 @@ public class AssistantUsage extends AbstractEditorTest {
protected Bundle getBundle() {
return FrameworkUtil.getBundle(getClass());
}
+
+ @After
+ @Before
+ public void clearExpansionRegistry() {
+ DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry().clear();
+ }
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java
index 9f899509eaa..6606dc2c5fc 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddBorderItem.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, 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
@@ -9,7 +9,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.tests;
@@ -30,7 +30,9 @@ import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart;
+import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
@@ -38,17 +40,17 @@ import org.osgi.framework.FrameworkUtil;
/**
* this Test is used to test if it is possible to add compartment
* see #Test T004-Add Border Item
- *
+ *
*
*/
public class ExpansionAddBorderItem extends AbstractEditorTest {
/**
- *
+ *
*/
protected static final String INTERFACE_BORDER_ITEM = "Interface_BorderItem";
/**
- *
+ *
*/
protected static final String NESTED_INTERFACE_LABEL = "Interface_Label";
@@ -67,15 +69,15 @@ public class ExpansionAddBorderItem extends AbstractEditorTest {
}
/**
- *
+ *
*/
protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
/**
- *
+ *
*/
protected static final String CLASS_VISUALID = ClassEditPart.VISUAL_ID;
/**
- *
+ *
*/
protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
@@ -116,7 +118,6 @@ public class ExpansionAddBorderItem extends AbstractEditorTest {
protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
@@ -142,4 +143,10 @@ public class ExpansionAddBorderItem extends AbstractEditorTest {
protected Bundle getBundle() {
return FrameworkUtil.getBundle(getClass());
}
+
+ @After
+ @Before
+ public void clearExpansionRegistry() {
+ DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry().clear();
+ }
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java
index 824ee28f388..d68e1c916c4 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddChildLabel.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, 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
@@ -9,7 +9,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.tests;
@@ -41,7 +41,9 @@ import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart;
+import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
@@ -49,13 +51,13 @@ import org.osgi.framework.FrameworkUtil;
/**
* this Test is used to test if it is possible to add compartment
* see #Test T003-Add Child Label
- *
+ *
*
*/
public class ExpansionAddChildLabel extends AbstractEditorTest {
/**
- *
+ *
*/
protected static final String NESTED_INTERFACE_LABEL = "Interface_Label";
@@ -74,15 +76,15 @@ public class ExpansionAddChildLabel extends AbstractEditorTest {
}
/**
- *
+ *
*/
protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
/**
- *
+ *
*/
protected static final String CLASS_VISUALID = ClassEditPart.VISUAL_ID;
/**
- *
+ *
*/
protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
@@ -156,7 +158,6 @@ public class ExpansionAddChildLabel extends AbstractEditorTest {
protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
@@ -182,4 +183,10 @@ public class ExpansionAddChildLabel extends AbstractEditorTest {
protected Bundle getBundle() {
return FrameworkUtil.getBundle(getClass());
}
+
+ @After
+ @Before
+ public void clearExpansionRegistry() {
+ DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry().clear();
+ }
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java
index deb748f197a..8d9216a30ab 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartment.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, 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
@@ -9,7 +9,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.tests;
@@ -33,7 +33,9 @@ import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart;
+import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
@@ -41,7 +43,7 @@ import org.osgi.framework.FrameworkUtil;
/**
* this Test is used to test if it is possible to add compartment
* see #Test T002-Add a compartment
- *
+ *
*
*/
public class ExpansionAddCompartment extends AbstractEditorTest {
@@ -61,15 +63,15 @@ public class ExpansionAddCompartment extends AbstractEditorTest {
}
/**
- *
+ *
*/
protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
/**
- *
+ *
*/
protected static final String CLASS_VISUALID = ClassEditPart.VISUAL_ID;
/**
- *
+ *
*/
protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
@@ -127,7 +129,6 @@ public class ExpansionAddCompartment extends AbstractEditorTest {
protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
@@ -153,4 +154,11 @@ public class ExpansionAddCompartment extends AbstractEditorTest {
protected Bundle getBundle() {
return FrameworkUtil.getBundle(getClass());
}
+
+ @After
+ @Before
+ public void clearExpansionRegistry() {
+ DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry().clear();
+ }
+
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java
index a9c82f77726..b27eedcb214 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddCompartmentWithKind.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, 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
@@ -9,7 +9,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.tests;
@@ -33,7 +33,9 @@ import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart;
+import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
@@ -41,7 +43,7 @@ import org.osgi.framework.FrameworkUtil;
/**
* this Test is used to test if it is possible to add compartment
* see #Test T006-Add Compartment with Kind
- *
+ *
*
*/
public class ExpansionAddCompartmentWithKind extends AbstractEditorTest {
@@ -61,15 +63,15 @@ public class ExpansionAddCompartmentWithKind extends AbstractEditorTest {
}
/**
- *
+ *
*/
protected static final String CLASS_DIAGRAM_TYPE = "Class Diagram";
/**
- *
+ *
*/
protected static final String CLASS_VISUALID = ClassEditPart.VISUAL_ID;
/**
- *
+ *
*/
protected static final String IMPLEMENTED_INTERFACES_HINT = "Implemented Interfaces";
@@ -127,7 +129,6 @@ public class ExpansionAddCompartmentWithKind extends AbstractEditorTest {
protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
@@ -153,4 +154,10 @@ public class ExpansionAddCompartmentWithKind extends AbstractEditorTest {
protected Bundle getBundle() {
return FrameworkUtil.getBundle(getClass());
}
+
+ @After
+ @Before
+ public void clearExpansionRegistry() {
+ DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry().clear();
+ }
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java
index 94e246d1635..62e9e30f16c 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionAddLink.java
@@ -42,7 +42,9 @@ import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.eclipse.papyrus.infra.types.core.registries.ElementTypeConfigurationTypeRegistry;
import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
@@ -136,7 +138,6 @@ public class ExpansionAddLink extends AbstractEditorTest {
protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
Assert.assertEquals("Size ot the map children must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
@@ -162,4 +163,10 @@ public class ExpansionAddLink extends AbstractEditorTest {
protected Bundle getBundle() {
return FrameworkUtil.getBundle(getClass());
}
+
+ @After
+ @Before
+ public void clearExpansionRegistry() {
+ DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry().clear();
+ }
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java
index a27f71ba811..816af6e54ec 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/ExpansionDropElements.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, 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
@@ -9,7 +9,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.tests;
@@ -45,7 +45,9 @@ import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Element;
+import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
@@ -53,7 +55,7 @@ import org.osgi.framework.FrameworkUtil;
/**
* this Test is used to test if it is possible to drop element from the model explorer
* see #Test T006-Drop of Elements
- *
+ *
*
*/
public class ExpansionDropElements extends AbstractEditorTest {
@@ -116,7 +118,7 @@ public class ExpansionDropElements extends AbstractEditorTest {
Assert.assertEquals("the compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPartMyClass.getNotationView().getType());
DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
- ArrayList<Element> list = new ArrayList<Element>();
+ ArrayList<Element> list = new ArrayList<>();
list.add(nestedInterface);
dropObjectsRequest.setObjects(list);
dropObjectsRequest.setLocation(new Point(40, 40));
@@ -173,7 +175,7 @@ public class ExpansionDropElements extends AbstractEditorTest {
Assert.assertEquals("the compartment must have the type " + IMPLEMENTED_INTERFACES_HINT, IMPLEMENTED_INTERFACES_HINT, compartmentEdiPartMyOtherClass.getNotationView().getType());
DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
- ArrayList<Element> list = new ArrayList<Element>();
+ ArrayList<Element> list = new ArrayList<>();
list.add(nestedInterface);
dropObjectsRequest.setObjects(list);
dropObjectsRequest.setLocation(new Point(40, 40));
@@ -203,7 +205,6 @@ public class ExpansionDropElements extends AbstractEditorTest {
protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
@@ -229,4 +230,10 @@ public class ExpansionDropElements extends AbstractEditorTest {
protected Bundle getBundle() {
return FrameworkUtil.getBundle(getClass());
}
+
+ @After
+ @Before
+ public void clearExpansionRegistry() {
+ DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry().clear();
+ }
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/LoadExpansionModel.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/LoadExpansionModel.java
index 0cf61a4fef8..0f77e10c875 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/LoadExpansionModel.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/tests/LoadExpansionModel.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2015 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
@@ -8,7 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.tests;
@@ -17,7 +17,9 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionSingleton;
import org.eclipse.papyrus.infra.gmfdiag.common.expansion.DiagramExpansionsRegistry;
import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
/**
@@ -25,61 +27,67 @@ import org.junit.Test;
* see #Test T001-Load ExpansionModel
*
*/
-public class LoadExpansionModel extends AbstractPapyrusTest{
+public class LoadExpansionModel extends AbstractPapyrusTest {
@Test
public void init_DiagramExpansionRegistry() {
- DiagramExpansionsRegistry diagramExpansionsRegistry= DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
+ DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
diagramExpansionsRegistry.clear();
- Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size());
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
}
-
+
@Test
public void load_DiagramExpansion() {
- DiagramExpansionsRegistry diagramExpansionsRegistry= loadXMIExpansionModel("NullExpansion.xmi");
- Assert.assertEquals("Size ot the registry must be equals to 1",1,diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size());
-
+ DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("NullExpansion.xmi");
+ Assert.assertEquals("Size ot the registry must be equals to 1", 1, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
+
}
-
+
@Test
public void load_BadDiagramExpansion() {
DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("BadContextExpansion.xmi");
-
- //This model is not valid so it is not loaded
- Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size());
+
+ // This model is not valid so it is not loaded
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
}
-
+
@Test
public void load_BadProviderDiagramExpansion() {
DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("BadProviderForExpansion.xmi");
-
- //This model is not valid so it is not loaded
- Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size());
+
+ // This model is not valid so it is not loaded
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
}
+
@Test
public void load_BadelementTypeDiagramExpansion() {
DiagramExpansionsRegistry diagramExpansionsRegistry = loadXMIExpansionModel("BadElementTypeForExpansion.xmi");
-
- //This model is not valid so it is not loaded
- Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size());
+
+ // This model is not valid so it is not loaded
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
}
protected DiagramExpansionsRegistry loadXMIExpansionModel(String filename) {
- DiagramExpansionsRegistry diagramExpansionsRegistry= DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
- diagramExpansionsRegistry.clear();
- Assert.assertEquals("Size ot the registry must be equals to 0",0,diagramExpansionsRegistry.getDiagramExpansions().size());
- Assert.assertEquals("Size ot the map childreen must be equals to 0",0,diagramExpansionsRegistry.mapChildreen.size());
+ DiagramExpansionsRegistry diagramExpansionsRegistry = DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry();
+ Assert.assertEquals("Size ot the registry must be equals to 0", 0, diagramExpansionsRegistry.getDiagramExpansions().size());
+ Assert.assertEquals("Size ot the map childreen must be equals to 0", 0, diagramExpansionsRegistry.mapChildreen.size());
URI badContextExpansion = URI.createPlatformPluginURI("org.eclipse.papyrus.infra.gmfdiag.common.tests", true);
- badContextExpansion=badContextExpansion.appendSegment("models");
- badContextExpansion=badContextExpansion.appendSegment(filename);
-
+ badContextExpansion = badContextExpansion.appendSegment("models");
+ badContextExpansion = badContextExpansion.appendSegment(filename);
+
diagramExpansionsRegistry.loadExpansion(badContextExpansion);
return diagramExpansionsRegistry;
}
-
+
+ @After
+ @Before
+ public void clearExpansionRegistry() {
+ DiagramExpansionSingleton.getInstance().getDiagramExpansionRegistry().clear();
+ }
+
}

Back to the top