| Summary: | Problem with InMemoryResourceImpl and IsModifiedSavingPolicy | ||
|---|---|---|---|
| Product: | [Modeling] Sirius | Reporter: | Laurent Redor <laurent.redor> |
| Component: | Core | Assignee: | Esteban DUGUEPEROUX <esteban.dugueperoux> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | esteban.dugueperoux, florian.barbin, pierre-charles.david |
| Version: | 3.1.0 | Keywords: | triaged |
| Target Milestone: | 4.0.0M5 | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: |
https://git.eclipse.org/r/64483 https://git.eclipse.org/r/64485 https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=1c90b4a92fc288537c2df689afe243ad8ddbf2e8 https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=97e94f0306b1ec1194f707d5bfd472e54d13f082 https://bugs.eclipse.org/bugs/show_bug.cgi?id=497559 |
||
| Whiteboard: | |||
A idea of fix, will be to replace:
resourcetoSave.getURI().isFile() || resourcetoSave.getURI().isPlatformResource()
by
!ResourceSetSync.isReadOnly(resourcetoSave)
in
org.eclipse.sirius.business.internal.session.IsModifiedSavingPolicy.computeResourcesToSave(...).new Predicate() {...}.apply(Resource)
as it is done before.
New Gerrit change created: https://git.eclipse.org/r/64483 New Gerrit change created: https://git.eclipse.org/r/64485 Proposed fix and tests update has been pushed on Gerrit through 2 gerrits. see previous comments. Gerrit change https://git.eclipse.org/r/64483 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=1c90b4a92fc288537c2df689afe243ad8ddbf2e8 Gerrit change https://git.eclipse.org/r/64485 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=97e94f0306b1ec1194f707d5bfd472e54d13f082 Fixed on master. The test TransientSessionTests.testDiagramWithTransientSession passed on JUnit master Available in Sirius 4.0.0. |
When a session is saved, the InMemoryResourceImpl resources of this session kept their isModified status to true. A simple modification of TransientSessionTests reveals the problem: diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/TransientSessionTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/TransientSessionTests.java index 0354d80..f47be92 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/TransientSessionTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/TransientSessionTests.java @@ -132,6 +132,7 @@ ISaveablePart saveablePart = diagramEditor; assertEquals("With a transient session adding a EClass should, the session become dirty ", SessionStatus.DIRTY, session.getStatus()); assertTrue("With a transient session adding a EClass should, the editor become dirty ", saveablePart.isDirty()); + assertTrue("The resource status is wrong for a transient session. It should be modified after modification.", session.getSessionResource().isModified()); // Save on diagramEditor saveablePart.doSave(new NullProgressMonitor()); @@ -139,6 +140,7 @@ assertEquals("With a transient session the save should be allowed", SessionStatus.SYNC, session.getStatus()); assertFalse("With a transient session, saving the editor, it become no dirty ", saveablePart.isDirty()); + assertFalse("The resource status is wrong for a transient session. It should be \"not modified\" after a save.", session.getSessionResource().isModified()); DialectUIManager.INSTANCE.closeEditor(diagramEditor, true); TestsUtil.synchronizationWithUIThread();