Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Fasani2016-07-05 13:01:10 +0000
committerLaurent Fasani2016-07-05 13:46:42 +0000
commitd5807d87855665f2c21e093cce23c466e00ab1c8 (patch)
treee1a5285363d1836191d9a86f2d3d8aeabcef3a62
parentb928bd8ecfd6fd763e3155d17376fdafe3fa915d (diff)
downloadorg.eclipse.sirius-d5807d87855665f2c21e093cce23c466e00ab1c8.tar.gz
org.eclipse.sirius-d5807d87855665f2c21e093cce23c466e00ab1c8.tar.xz
org.eclipse.sirius-d5807d87855665f2c21e093cce23c466e00ab1c8.zip
[481846] Fix ResourceVersionMismatchTest
* Change test to make sure the aird or vsm are migrated at the beginning of the test. Bug: 481846 Change-Id: I585436cf08324f5dd2ea5dd7fc3ad9c690fb5bf9 Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/ResourceVersionMismatchTest.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/ResourceVersionMismatchTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/ResourceVersionMismatchTest.java
index 156fa69c2a..8c73b0845e 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/ResourceVersionMismatchTest.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/ResourceVersionMismatchTest.java
@@ -210,9 +210,19 @@ public class ResourceVersionMismatchTest extends SiriusTestCase {
}
private void setupFileVersionMismatch(boolean setupInvalidVSM, boolean setupInvalidMainAird, boolean setupInvalidReferencedAird) {
- // Session creation
+ // If the aird or vsm need to be migrated, then, at save, the migration
+ // version is set at the last one.
+ // So, to avoid that the changed version (done below) gets overridden we
+ // make sure the model does not need to be migrated.
Session session = SessionManager.INSTANCE.getSession(sessionResourceURI, new NullProgressMonitor());
session.open(new NullProgressMonitor());
+ session.save(new NullProgressMonitor());
+ Viewpoint viewpoint = session.getSelectedViewpoints(false).iterator().next();
+ saveVSM(viewpoint.eResource());
+ session.close(new NullProgressMonitor());
+
+ session = SessionManager.INSTANCE.getSession(sessionResourceURI, new NullProgressMonitor());
+ session.open(new NullProgressMonitor());
TransactionalEditingDomain domain = session.getTransactionalEditingDomain();
CommandStack commandStack = domain.getCommandStack();
@@ -226,10 +236,8 @@ public class ResourceVersionMismatchTest extends SiriusTestCase {
Command changeVersionCmd = SetCommand.create(domain, group, DescriptionPackage.Literals.GROUP__VERSION, newVersion.toString());
assertTrue(changeVersionCmd.canExecute());
commandStack.execute(changeVersionCmd);
- try {
- group.eResource().save(null);
- } catch (IOException e) {
- }
+
+ saveVSM(group.eResource());
}
if (setupInvalidMainAird) {
@@ -256,6 +264,14 @@ public class ResourceVersionMismatchTest extends SiriusTestCase {
session.close(new NullProgressMonitor());
}
+ private void saveVSM(Resource resource) {
+ try {
+ resource.save(null);
+ } catch (IOException e) {
+ fail("The save of the viewpoint " + ODESIGN_MODEL_FILENAME + " failed.");
+ }
+ }
+
@Override
protected void tearDown() throws Exception {
if (defaultUiCallback != null) {

Back to the top