-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Duplicate
-
Affects Version/s: 6.0-HF12
-
Fix Version/s: None
-
Component/s: Core
How to reproduce:
- Create a Folder
- Create a File in it
- Create a version of the File
- Permanently delete the Folder
NXQL query SELECT * FROM File returns the version of the File
Unit tests showing the bug:
package org.nuxeo.ecm.core.test; import static org.junit.Assert.*; import org.junit.Test; import org.junit.runner.RunWith; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; import org.nuxeo.ecm.core.api.DocumentRef; import org.nuxeo.ecm.core.api.VersioningOption; import org.nuxeo.ecm.core.event.EventService; import org.nuxeo.ecm.core.versioning.VersioningService; import org.nuxeo.ecm.platform.test.PlatformFeature; import org.nuxeo.runtime.test.runner.Features; import org.nuxeo.runtime.test.runner.FeaturesRunner; import com.google.inject.Inject; @RunWith(FeaturesRunner.class) @Features({ PlatformFeature.class }) public class SUPNXP13808Test { @Inject protected CoreSession session; @Inject protected EventService eventService; @Test public void testSUPNXP13808_removeFile() { DocumentModel ws = session.createDocumentModel("Workspace"); ws.setPathInfo("/", "ws"); ws = session.createDocument(ws); // create a folder DocumentModel folder = session.createDocumentModel("Folder"); folder.setPathInfo(ws.getPathAsString(), "folder"); folder = session.createDocument(folder); // create a 'File' document DocumentModel file = session.createDocumentModel("File"); file.setPathInfo(folder.getPathAsString(), "file"); file = session.createDocument(file); DocumentRef fileRef = file.getRef(); // add version to created document file.setPropertyValue("dc:title", "a version"); file.putContextData(VersioningService.VERSIONING_OPTION, VersioningOption.MINOR); file = session.saveDocument(file); DocumentModelList files = session.query("SELECT * FROM File"); assertEquals(2, files.size()); // delete 'File' document session.removeDocument(fileRef); session.save(); eventService.waitForAsyncCompletion(); files = session.query("SELECT * FROM File"); assertEquals(0, files.size()); } @Test public void testSUPNXP13808_removeFolder() { DocumentModel ws = session.createDocumentModel("Workspace"); ws.setPathInfo("/", "ws"); ws = session.createDocument(ws); // create a folder DocumentModel folder = session.createDocumentModel("Folder"); folder.setPathInfo(ws.getPathAsString(), "folder"); folder = session.createDocument(folder); // create a 'File' document DocumentModel file = session.createDocumentModel("File"); file.setPathInfo(folder.getPathAsString(), "file"); file = session.createDocument(file); // add version to created document file.setPropertyValue("dc:title", "a version"); file.putContextData(VersioningService.VERSIONING_OPTION, VersioningOption.MINOR); file = session.saveDocument(file); DocumentModelList files = session.query("SELECT * FROM File"); assertEquals(2, files.size()); // delete 'Folder' document session.removeDocument(folder.getRef()); session.save(); eventService.waitForAsyncCompletion(); files = session.query("SELECT * FROM File"); assertEquals(0, files.size()); } }
- duplicates
-
NXP-14187 Remove orphan versions after a recursive delete
- Resolved