diff options
| author | Laurent Redor | 2016-05-10 08:03:13 +0000 |
|---|---|---|
| committer | Maxime Porhel | 2016-05-10 13:24:25 +0000 |
| commit | e4fd6945a5cbc9ec4e0cfdccfeb719be4a967ea5 (patch) | |
| tree | c61cf18e956e51cfd9037ebb5312ee00d2d8d0b1 | |
| parent | e1b51a3cd90fba6a98e841a7e876ad3c95f15015 (diff) | |
| download | org.eclipse.sirius-e4fd6945a5cbc9ec4e0cfdccfeb719be4a967ea5.tar.gz org.eclipse.sirius-e4fd6945a5cbc9ec4e0cfdccfeb719be4a967ea5.tar.xz org.eclipse.sirius-e4fd6945a5cbc9ec4e0cfdccfeb719be4a967ea5.zip | |
[489416] Add test to reveal the problem
New tests are KO without the fix [1].
[1]
http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=b81b53cf852ab0e53169684eedfab83b54ea9a0b
Bug: 489416
Change-Id: I5e184dc926daf0a6b6fcd8b8b151a9e923a15d08
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
4 files changed, 76 insertions, 12 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index accbb52640..bccb24c0a2 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -454,6 +454,17 @@ <code>org.eclipse.sirius.editor</code>) still depends on PDE (and thus indirectly the JDT too). </li> </ul> + <h4 id="Changesinorg.eclipse.sirius.tests.junit.support">Changes in + <code>org.eclipse.sirius.tests.junit.support</code> + </h4> + <ul> + <li><span class="label label-success">Added</span> The methods + <code>initLoggers()</code> and + <code>disposeLoggers()</code> of class + <code>org.eclipse.sirius.tests.support.api.SiriusTestCase</code> have now a protected visibility (instead of private) to allow subclasses to use this logger without all the + <code>genericSetUp</code> behavior. + </li> + </ul> <h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support">Changes in <code>org.eclipse.sirius.tests.swtbot.support</code> </h4> @@ -503,7 +514,7 @@ <code>org.eclipse.sirius.ui.business.api.session.SessionEditorInput.getStatus()</code> has been added to have the status about session opening, i.e. if it has been correctly opened, cancelled or an exception has occurred. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.tests.junit.support">Changes in + <h4 id="Changesinorg.eclipse.sirius.tests.junit.support2">Changes in <code>org.eclipse.sirius.tests.junit.support</code> </h4> <ul> @@ -512,7 +523,7 @@ <code>IMemento</code> for editor restoration. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.tests.junit.support2">Changes in + <h4 id="Changesinorg.eclipse.sirius.tests.junit.support3">Changes in <code>org.eclipse.sirius.tests.junit.support</code> </h4> <ul> @@ -976,7 +987,7 @@ <code>RefreshPlan</code> in parameter to have more informations to say if children must be synchronized. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.tests.junit.support3">Changes in + <h4 id="Changesinorg.eclipse.sirius.tests.junit.support4">Changes in <code>org.eclipse.sirius.tests.junit.support</code> </h4> <ul> @@ -1912,7 +1923,7 @@ </ul> </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.tests.junit.support4">Changes in + <h4 id="Changesinorg.eclipse.sirius.tests.junit.support5">Changes in <code>org.eclipse.sirius.tests.junit.support</code> </h4> <ul> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index 76ac1bf627..fffba72969 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -121,6 +121,10 @@ h4. Changes in @org.eclipse.sirius.ui@ * <span class="label label-info">Modified</span> @org.eclipse.sirius.ui.tools.api.properties.SiriusExtensiblePropertySource@ has been modified to use @SiriusExtensiblePropertyDescriptor@ to provide not editable properties view when the object, selected from the Model Explorer view, cannot be modified. * <span class="label label-danger">Removed</span> The @org.eclipse.sirius.ui@, and thus the whole @org.eclipse.sirius.runtime@ feature no longer depends on the JDT (technically the dependency towards @org.eclipse.jdt.core@ has been removed). If you need the JDT Core in your environment, you will need to add the dependency explicitly. The Sirius specification environment (@org.eclipse.sirius.editor@) still depends on PDE (and thus indirectly the JDT too). +h4. Changes in @org.eclipse.sirius.tests.junit.support@ + +* <span class="label label-success">Added</span> The methods @initLoggers()@ and @disposeLoggers()@ of class @org.eclipse.sirius.tests.support.api.SiriusTestCase@ have now a protected visibility (instead of private) to allow subclasses to use this logger without all the @genericSetUp@ behavior. + h4. Changes in @org.eclipse.sirius.tests.swtbot.support@ * <span class="label label-success">Added</span> The method @getTreeItem(final SWTBotTreeItem[], final String)@ has been added in @org.eclipse.sirius.tests.swtbot.support.utils@ to retrieve recursively a @SWTBotTreeItem@ in a @SWTBotTreeItem@ array. diff --git a/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/SiriusTestCase.java b/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/SiriusTestCase.java index ce8a328dac..f06394f768 100644 --- a/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/SiriusTestCase.java +++ b/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/SiriusTestCase.java @@ -575,9 +575,9 @@ public abstract class SiriusTestCase extends TestCase { } /** - * Initialize the log listener + * Initialize the log listener. */ - private void initLoggers() { + protected void initLoggers() { logListener = new ILogListener() { @Override @@ -610,9 +610,9 @@ public abstract class SiriusTestCase extends TestCase { } /** - * Dispose the log listener + * Dispose the log listener. */ - private void disposeLoggers() { + protected void disposeLoggers() { if (logListener != null) { Platform.removeLogListener(logListener); } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/service/ServiceInterpreterTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/service/ServiceInterpreterTests.java index c6c30b06f4..c138eb6b6d 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/service/ServiceInterpreterTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/service/ServiceInterpreterTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2016 THALES GLOBAL SERVICES. * 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 @@ -12,8 +12,6 @@ package org.eclipse.sirius.tests.unit.common.interpreter.service; import java.util.Collections; -import junit.framework.TestCase; - import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EcoreFactory; @@ -24,13 +22,15 @@ import org.eclipse.sirius.diagram.DEdge; import org.eclipse.sirius.diagram.DiagramFactory; import org.eclipse.sirius.diagram.EdgeStyle; import org.eclipse.sirius.ecore.design.service.EcoreSamplePlugin; +import org.eclipse.sirius.tests.support.api.SiriusTestCase; +import org.eclipse.sirius.tools.api.command.ICommandFactory; /** * A Test case for the {@link ServiceInterpreter}. * * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a> */ -public class ServiceInterpreterTests extends TestCase { +public class ServiceInterpreterTests extends SiriusTestCase { private IInterpreter interpreter; @@ -262,7 +262,51 @@ public class ServiceInterpreterTests extends TestCase { // Check fail("EvaluationException should be thrown"); } catch (EvaluationException e) { + } + } + /** + * Test that when an invalid path of javaExtension is used for mtl file, + * this path is ignored (not considered as import). The invalid path is a + * path with ".mtl". It does not respect the documentation + * (http://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html + * #acceleo). + */ + public void testAddImportWithInvalidPathContainintPoint() { + // Initialize error/warning log and uncaught exception handlers + initLoggers(); + boolean oldIsWarningCatchActive = isWarningCatchActive(); + setWarningCatchActive(true); + try { + // Add an invalid mlt path containing a point + interpreter.addImport("org::eclipse::sirius::test::a3Querries.mtl"); + // Test + checkServiceInterpreterEvaluationWithSpecificServiceExpression(false); + assertFalse("Problem concerning Java extension path: " + getWarningLoggersMessage(), doesAWarningOccurs()); + } finally { + setWarningCatchActive(oldIsWarningCatchActive); + disposeLoggers(); + } + } + + /** + * Test that when a path of javaExtension corresonds to an mtl file, this + * path is ignored, not considered as import by interpreter. + */ + public void testAddImportWithPathOfMtlFile() { + // Initialize error/warning log and uncaught exception handlers + initLoggers(); + boolean oldIsWarningCatchActive = isWarningCatchActive(); + setWarningCatchActive(true); + try { + // Add a path corresponding to an mlt file + interpreter.addImport("org::eclipse::sirius::test::a3Querries"); + // Test + checkServiceInterpreterEvaluationWithSpecificServiceExpression(false); + assertFalse("Problem concerning Java extension path: " + getWarningLoggersMessage(), doesAWarningOccurs()); + } finally { + setWarningCatchActive(oldIsWarningCatchActive); + disposeLoggers(); } } @@ -271,4 +315,9 @@ public class ServiceInterpreterTests extends TestCase { interpreter = null; super.tearDown(); } + + @Override + protected ICommandFactory getCommandFactory() { + return null; + } } |
