diff options
| author | Esteban Dugueperoux | 2016-02-08 14:25:28 +0000 |
|---|---|---|
| committer | Esteban DUGUEPEROUX | 2016-02-11 13:38:20 +0000 |
| commit | 92d285df85281ff155e8101c19091d196269d5e3 (patch) | |
| tree | 9736008f8aa729f623abe3d0e9a9153b3dc5a233 | |
| parent | 79a0b49a9d54c0f6850995724eae39b7752173ac (diff) | |
| download | org.eclipse.sirius-92d285df85281ff155e8101c19091d196269d5e3.tar.gz org.eclipse.sirius-92d285df85281ff155e8101c19091d196269d5e3.tar.xz org.eclipse.sirius-92d285df85281ff155e8101c19091d196269d5e3.zip | |
[486330] Update DiagramIntegrityTestCase to activate its viewpoint
- Update DiagramIntegrityTestCase to activate its viewpoint but without
creating representations
- Update API of SiriusTestCase to deprecate initViewpoint(String,
Session, EObject) since the last parameter is useless, and add
initViewpoint(String, Session, boolean) method to allow viewpoint
activation without creating representations.
Bug: 486330
Change-Id: I811cf9d2ff17964c492d00fdc829c847c987873c
Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr>
7 files changed, 75 insertions, 35 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index b21e91e61c..0df94a3b04 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -271,6 +271,17 @@ <code>IMemento</code> for editor restoration. </li> </ul> + <h4 id="Changesinorg.eclipse.sirius.tests.junit.support2">Changes in + <code>org.eclipse.sirius.tests.junit.support</code> + </h4> + <ul> + <li><span class="label label-success">Added</span> The method + <code>SiriusTestCase.initViewpoint(String, Session, boolean)</code> has been added to allow viewpoint activation without creating representations. + </li> + <li><span class="label label-warning">Deprecated</span> The method + <code>SiriusTestCase.initViewpoint(String, Session, EObject)</code> has been deprecated because the last parameter is useless to activate a viewpoint. + </li> + </ul> <h2 id="sirius3.1.0">Changes in Sirius 3.1.0</h2> <h3 id="UserVisibleChanges2">User-Visible Changes</h3> <ul> @@ -724,7 +735,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.support2">Changes in + <h4 id="Changesinorg.eclipse.sirius.tests.junit.support3">Changes in <code>org.eclipse.sirius.tests.junit.support</code> </h4> <ul> @@ -1660,7 +1671,7 @@ </ul> </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> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index a08924b392..a4bb19fac4 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -87,6 +87,11 @@ h4. Changes in @org.eclipse.sirius.tests.junit.support@ * <span class="label label-success">Added</span> The class @org.eclipse.sirius.tests.support.api.DefaultTestMemento@ has been created. It help to simulate a real @IMemento@ for editor restoration. +h4. Changes in @org.eclipse.sirius.tests.junit.support@ + +* <span class="label label-success">Added</span> The method @SiriusTestCase.initViewpoint(String, Session, boolean)@ has been added to allow viewpoint activation without creating representations. +* <span class="label label-warning">Deprecated</span> The method @SiriusTestCase.initViewpoint(String, Session, EObject)@ has been deprecated because the last parameter is useless to activate a viewpoint. + h2(#sirius3.1.0). Changes in Sirius 3.1.0 h3. User-Visible Changes 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 f203d7a950..481f99d141 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2009, 2016 THALES GLOBAL SERVICES 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 @@ -27,8 +27,6 @@ import java.util.List; import java.util.Map.Entry; import java.util.Set; -import junit.framework.TestCase; - import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -117,6 +115,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; +import junit.framework.TestCase; + /** * The main test case for viewpoint unit tests. * @@ -150,8 +150,8 @@ public abstract class SiriusTestCase extends TestCase { * The default session URI used when there is no session path passed to the * generic setup. */ - protected static final URI DEFAULT_MODELING_PROJECT_REPRESENTATIONS_FILE_URI = URI.createPlatformResourceURI(File.separator + SiriusTestCase.TEMPORARY_PROJECT_NAME + File.separator - + ModelingProject.DEFAULT_REPRESENTATIONS_FILE_NAME, true); + protected static final URI DEFAULT_MODELING_PROJECT_REPRESENTATIONS_FILE_URI = URI + .createPlatformResourceURI(File.separator + SiriusTestCase.TEMPORARY_PROJECT_NAME + File.separator + ModelingProject.DEFAULT_REPRESENTATIONS_FILE_NAME, true); private static final String DOT = "."; @@ -881,7 +881,7 @@ public abstract class SiriusTestCase extends TestCase { * the name of the viewpoint to initialize. */ protected final void initViewpoint(final String viewpointName) { - initViewpoint(viewpointName, session, semanticModel); + initViewpoint(viewpointName, session, true); } /** @@ -894,8 +894,28 @@ public abstract class SiriusTestCase extends TestCase { * @param alternateSemanticModel * the model to use to initialize the viewpoint * @since 1.1 + * @deprecated use + * {@link SiriusTestCase#initViewpoint(String, Session, boolean)} + * instead */ + @Deprecated protected final void initViewpoint(final String viewpointName, final Session alternateSession, final EObject alternateSemanticModel) { + initViewpoint(viewpointName, alternateSession, true); + } + + /** + * Initialize a viewpoint. + * + * @param viewpointName + * the name of the viewpoint to initialize. + * @param alternateSession + * the session to use to initialize the viewpoint + * @param initRepresentations + * true to init representations at viewpoint activation, false to + * not do it + * @since 1.1 + */ + protected final void initViewpoint(final String viewpointName, final Session alternateSession, final boolean initRepresentations) { Viewpoint localSessionViewpoint = null; for (final Viewpoint viewpoint : viewpoints) { if (viewpointName != null && viewpointName.equals(viewpoint.getName())) { @@ -904,9 +924,9 @@ public abstract class SiriusTestCase extends TestCase { } } if (localSessionViewpoint != null) { - Command changeSiriussSelectionCmd = new ChangeViewpointSelectionCommand(alternateSession, new ViewpointSelectionCallback(), Collections.singleton(localSessionViewpoint), - Collections.<Viewpoint> emptySet(), new NullProgressMonitor()); - alternateSession.getTransactionalEditingDomain().getCommandStack().execute(changeSiriussSelectionCmd); + Command changeViewpointsSelectionCmd = new ChangeViewpointSelectionCommand(alternateSession, new ViewpointSelectionCallback(), Collections.singleton(localSessionViewpoint), + Collections.<Viewpoint> emptySet(), initRepresentations, new NullProgressMonitor()); + alternateSession.getTransactionalEditingDomain().getCommandStack().execute(changeViewpointsSelectionCmd); } } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/DiagramIntegrityTestCase.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/DiagramIntegrityTestCase.java index 81e7ee62d6..7e088de50d 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/DiagramIntegrityTestCase.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/diagramintegrity/DiagramIntegrityTestCase.java @@ -27,7 +27,7 @@ public class DiagramIntegrityTestCase extends DocbookTestCase { EclipseTestsSupportHelper.INSTANCE.createProject(TEMPORARY_PROJECT_NAME); genericSetUp(SEMANTIC_MODEL_PATH, MODELER_PATH); - + initViewpoint(DOCKBOOK_VIEWPOINT_NAME, session, false); sessionModel = session.getSessionResource().getContents().get(0); INTERPRETER = session.getInterpreter(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionManagerListener2Tests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionManagerListener2Tests.java index 555b8f153e..0b8992b9e4 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionManagerListener2Tests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionManagerListener2Tests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 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 @@ -87,7 +87,7 @@ public class SessionManagerListener2Tests extends SiriusDiagramTestCase implemen genericSetUp(TEMPORARY_PROJECT_NAME + "/" + ZOOM_SEMANTIC_MODEL_NAME, MODELER_PATH, alternativeSessionResourcePath); alternateSession = session; alternateSemanticModel = alternateSession.getSemanticResources().iterator().next().getContents().get(0); - initViewpoint(DESIGN_VIEWPOINT_NAME, alternateSession, alternateSemanticModel); + initViewpoint(DESIGN_VIEWPOINT_NAME, alternateSession, true); TestsUtil.emptyEventsFromUIThread(); String sessionResourcePath = TEMPORARY_PROJECT_NAME + "/" + "session.aird"; @@ -137,8 +137,8 @@ public class SessionManagerListener2Tests extends SiriusDiagramTestCase implemen final DView view = analysis.getOwnedViews().get(0); assertFalse(view.getOwnedRepresentations().isEmpty()); - Command removeRepresentationCmd = RemoveCommand.create(session.getTransactionalEditingDomain(), view, ViewpointPackage.Literals.DVIEW__OWNED_REPRESENTATIONS, view.getOwnedRepresentations() - .get(0)); + Command removeRepresentationCmd = RemoveCommand.create(session.getTransactionalEditingDomain(), view, ViewpointPackage.Literals.DVIEW__OWNED_REPRESENTATIONS, + view.getOwnedRepresentations().get(0)); session.getTransactionalEditingDomain().getCommandStack().execute(removeRepresentationCmd); TestsUtil.synchronizationWithUIThread(); Job.getJobManager().join(SaveSessionJob.FAMILY, new NullProgressMonitor()); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionWorkspaceSyncTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionWorkspaceSyncTests.java index 1ded188eb9..8315e4c366 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionWorkspaceSyncTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionWorkspaceSyncTests.java @@ -80,8 +80,8 @@ public class SessionWorkspaceSyncTests extends SiriusDiagramTestCase implements changeSiriusUIPreference(SiriusUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE.name(), false); changeSiriusUIPreference(SiriusUIPreferencesKeys.PREF_SAVE_WHEN_NO_EDITOR.name(), false); - EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, PACKAGES_SEMANTIC_MODEL_FOLDER_PATH + PACKAGES_SEMANTIC_MODEL_NAME, TEMPORARY_PROJECT_NAME + "/" - + PACKAGES_SEMANTIC_MODEL_NAME); + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, PACKAGES_SEMANTIC_MODEL_FOLDER_PATH + PACKAGES_SEMANTIC_MODEL_NAME, + TEMPORARY_PROJECT_NAME + "/" + PACKAGES_SEMANTIC_MODEL_NAME); genericSetUp(TEMPORARY_PROJECT_NAME + "/" + PACKAGES_SEMANTIC_MODEL_NAME, MODELER_PATH); initViewpoint(DESIGN_VIEWPOINT_NAME); TestsUtil.emptyEventsFromUIThread(); @@ -346,7 +346,7 @@ public class SessionWorkspaceSyncTests extends SiriusDiagramTestCase implements assertNotNull("Alternate Session has not been well initialized", alternateSession); assertNotNull("Alternate Domain has not been well initialized", alternateSession.getTransactionalEditingDomain()); assertNotNull("Alternate semantic model has not been well initialized", alternateSemanticModel); - initViewpoint(DESIGN_VIEWPOINT_NAME, alternateSession, alternateSemanticModel); + initViewpoint(DESIGN_VIEWPOINT_NAME, alternateSession, true); TestsUtil.synchronizationWithUIThread(); // Save session 2 @@ -436,8 +436,8 @@ public class SessionWorkspaceSyncTests extends SiriusDiagramTestCase implements * reloading an aird should create a not undoable recording command to * set new analysis in session object */ - assertFalse("Reloading an aird should create a not undoable recording command to set new analysis in session object. So the command stack should not be undoable.", session - .getTransactionalEditingDomain().getCommandStack().canUndo()); + assertFalse("Reloading an aird should create a not undoable recording command to set new analysis in session object. So the command stack should not be undoable.", + session.getTransactionalEditingDomain().getCommandStack().canUndo()); /* editor should not be closed */ editor.setFocus(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/DocBookModeler.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/DocBookModeler.java index ee9c7496b3..2f9ccc042f 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/DocBookModeler.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/DocBookModeler.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 @@ -13,20 +13,24 @@ package org.eclipse.sirius.tests.unit.common; public interface DocBookModeler { String DOCBOOK_PLUGIN = "org.eclipse.sirius.tests.sample.docbook.design"; - + /** Path to the directory containing resources. */ String DIRECTORY_PATH = "/sample"; - + /** Path to the input model's description. */ - String SEMANTIC_MODEL_FILENAME = "simple.docbook"; - - String MODELER_FILENAME = "docbook.odesign"; - - /** session resource filename. */ - String SESSION_MODEL_FILENAME = "docbook.aird"; - - String SEMANTIC_MODEL_PATH = "/" + DOCBOOK_PLUGIN + DIRECTORY_PATH + "/" + SEMANTIC_MODEL_FILENAME; - String SESSION_PATH = "/" + DOCBOOK_PLUGIN + DIRECTORY_PATH + "/" + SESSION_MODEL_FILENAME; - String MODELER_PATH = "/" + DOCBOOK_PLUGIN + "/" + "model/" + MODELER_FILENAME; - + String SEMANTIC_MODEL_FILENAME = "simple.docbook"; + + String MODELER_FILENAME = "docbook.odesign"; + + /** session resource filename. */ + String SESSION_MODEL_FILENAME = "docbook.aird"; + + String SEMANTIC_MODEL_PATH = "/" + DOCBOOK_PLUGIN + DIRECTORY_PATH + "/" + SEMANTIC_MODEL_FILENAME; + + String SESSION_PATH = "/" + DOCBOOK_PLUGIN + DIRECTORY_PATH + "/" + SESSION_MODEL_FILENAME; + + String MODELER_PATH = "/" + DOCBOOK_PLUGIN + "/" + "model/" + MODELER_FILENAME; + + String DOCKBOOK_VIEWPOINT_NAME = "docbook1"; + } |
