diff options
author | Christian W. Damus | 2021-04-15 18:15:47 +0000 |
---|---|---|
committer | Christian W. Damus | 2021-04-15 18:15:47 +0000 |
commit | d145d5056a9ad96ece16abe96a7d82357c2f150a (patch) | |
tree | 6e60e7cef54a40fc6ebbce395739bdae5a81bb02 /tests/junit | |
parent | 1f2269d8cd54aee92231d05fac6cd20e43b0da03 (diff) | |
download | org.eclipse.papyrus-d145d5056a9ad96ece16abe96a7d82357c2f150a.tar.gz org.eclipse.papyrus-d145d5056a9ad96ece16abe96a7d82357c2f150a.tar.xz org.eclipse.papyrus-d145d5056a9ad96ece16abe96a7d82357c2f150a.zip |
Bug 570716: [Tests] Sequence diagram validation test regression
- another test failure cause by Eclipse OCL 6.14's thread-local management
of environment factories. This time tests run fast enough that the
OCL environment for an editor of a previous test isn't collected by
the time the next test tries to set the environment, which results in
OCL balking at multiple concurrent environments and OCL being
unavailable to that test and all subsequent tests
Change-Id: Ice4c85d0edcaa061a2cf462dea97901133a11f23
Signed-off-by: Christian W. Damus <give.a.damus@gmail.com>
Diffstat (limited to 'tests/junit')
3 files changed, 52 insertions, 55 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF index e91e06aa706..9ff6423e9dc 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF @@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.emf.databinding;bundle-version="[1.5.0,2.0.0)", org.eclipse.papyrus.uml.diagram.sequence;bundle-version="[6.0.0,7.0.0)", org.eclipse.papyrus.uml.diagram.tests;bundle-version="[2.0.0,3.0.0)", org.eclipse.uml2.uml.editor;bundle-version="[5.5.0,6.0.0)", - org.junit;bundle-version="[4.13.0,5.0.0)" + org.junit;bundle-version="[4.13.0,5.0.0)", + org.eclipse.ocl.pivot;bundle-version="[1.14.0,2.0.0)" Export-Package: org.eclipse.papyrus.uml.diagram.sequence.tests Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/org.eclipse.papyrus.uml.diagram.sequence.tests.launch b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/org.eclipse.papyrus.uml.diagram.sequence.tests.launch index df27bdbc612..1df18e01fbf 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/org.eclipse.papyrus.uml.diagram.sequence.tests.launch +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/org.eclipse.papyrus.uml.diagram.sequence.tests.launch @@ -1,43 +1,44 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig"> -<booleanAttribute key="append.args" value="true"/> -<booleanAttribute key="askclear" value="false"/> -<booleanAttribute key="automaticAdd" value="true"/> -<booleanAttribute key="automaticValidate" value="false"/> -<stringAttribute key="bad_container_name" value="\org.eclipse.papyrus.uml.diagram.sequence.tests\junit.launcher"/> -<stringAttribute key="bootstrap" value=""/> -<stringAttribute key="checked" value="[NONE]"/> -<booleanAttribute key="clearConfig" value="true"/> -<booleanAttribute key="clearws" value="true"/> -<booleanAttribute key="clearwslog" value="false"/> -<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/> -<booleanAttribute key="default" value="true"/> -<booleanAttribute key="includeOptional" value="true"/> -<stringAttribute key="location" value="${workspace_loc}/../junit-sequence-workspace"/> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> -<listEntry value="/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/AllTests.java"/> -</listAttribute> -<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> -<listEntry value="1"/> -</listAttribute> -<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/> -<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> -<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> -<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> -<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.uml.diagram.sequence.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.uml.diagram.sequence.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="-Xms40m -Xmx2048m -Doomph.setup.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="false"/> -<booleanAttribute key="useCustomFeatures" value="false"/> -<booleanAttribute key="useDefaultConfig" value="true"/> -<booleanAttribute key="useDefaultConfigArea" value="false"/> -<booleanAttribute key="useProduct" value="true"/> + <booleanAttribute key="append.args" value="true"/> + <booleanAttribute key="askclear" value="false"/> + <booleanAttribute key="automaticAdd" value="true"/> + <booleanAttribute key="automaticValidate" value="false"/> + <stringAttribute key="bad_container_name" value="\org.eclipse.papyrus.uml.diagram.sequence.tests\junit.launcher"/> + <stringAttribute key="bootstrap" value=""/> + <stringAttribute key="checked" value="[NONE]"/> + <booleanAttribute key="clearConfig" value="true"/> + <booleanAttribute key="clearws" value="true"/> + <booleanAttribute key="clearwslog" value="false"/> + <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/> + <booleanAttribute key="default" value="true"/> + <booleanAttribute key="includeOptional" value="true"/> + <stringAttribute key="location" value="${workspace_loc}/../junit-sequence-workspace"/> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> + <listEntry value="/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/AllTests.java"/> + </listAttribute> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> + <listEntry value="1"/> + </listAttribute> + <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/> + <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> + <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> + <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> + <booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/> + <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-11"/> + <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.uml.diagram.sequence.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.uml.diagram.sequence.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="-Xms40m -Xmx2048m -Doomph.setup.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="false"/> + <booleanAttribute key="useCustomFeatures" value="false"/> + <booleanAttribute key="useDefaultConfig" value="true"/> + <booleanAttribute key="useDefaultConfigArea" value="false"/> + <booleanAttribute key="useProduct" value="true"/> </launchConfiguration> diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java index 2f3ffa930b0..611c901149d 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2018-2019 Christian W. Damus and others. + * Copyright (c) 2018-2021 Christian W. Damus, CEA LIST, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -11,6 +11,7 @@ * Contributors: * Christian W. Damus - Initial API and implementation * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 547864 (Remove useless tests) + * Christian W. Damus - bug 570716 * *****************************************************************************/ @@ -66,6 +67,7 @@ import org.eclipse.gef.requests.ChangeBoundsRequest; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory; +import org.eclipse.ocl.pivot.utilities.ThreadLocalExecutor; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.matchers.CommandMatchers; import org.eclipse.papyrus.junit.matchers.DiagramMatchers; @@ -92,7 +94,6 @@ import org.hamcrest.CoreMatchers; import org.hamcrest.CustomTypeSafeMatcher; import org.hamcrest.Matcher; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.RuleChain; @@ -133,19 +134,13 @@ public class CombinedFragmentRegressionTest extends AbstractPapyrusTest { } /** - * Before test initialization with preference initialization. - */ - @Before - public void init() { - UMLDiagramEditorPlugin.getInstance().getPreferenceStore().setValue(CustomDiagramGeneralPreferencePage.PREF_TRIGGER_ASYNC_VALIDATION, true); - } - - /** - * After test with preference modification. + * These tests rely on the OCL environment which since OCL 6.14 is maintained on a thread-local basis + * and can get broken when some test attempts to attach an environment factory for the thread when + * one is already attached. After that, no OCL validation works and tests fail. */ @After public void cleanUp() { - UMLDiagramEditorPlugin.getInstance().getPreferenceStore().setValue(CustomDiagramGeneralPreferencePage.PREF_TRIGGER_ASYNC_VALIDATION, false); + ThreadLocalExecutor.reset(); } /** @@ -854,7 +849,7 @@ public class CombinedFragmentRegressionTest extends AbstractPapyrusTest { // static Matcher<EObject> isDeleted() { - return new CustomTypeSafeMatcher<EObject>("is deleted") { + return new CustomTypeSafeMatcher<>("is deleted") { @Override protected boolean matchesSafely(EObject item) { return item.eResource() == null; @@ -870,7 +865,7 @@ public class CombinedFragmentRegressionTest extends AbstractPapyrusTest { * @return the geometry matcher */ static Matcher<Object> equalGeometry(Object geometry) { - return new CustomTypeSafeMatcher<Object>("equals " + geometry) { + return new CustomTypeSafeMatcher<>("equals " + geometry) { @Override protected boolean matchesSafely(Object item) { |