Search in sources :

Example 11 with FileSystemItemFactory

use of org.nuxeo.drive.service.FileSystemItemFactory in project nuxeo-drive-server by nuxeo.

the class TestDriveVersioning method testSyncRootVersioning.

@Test
public void testSyncRootVersioning() throws Exception {
    // Expect no versions initially
    // Cannot use DocumentModel#getVersionLabel since it relies on the uid schema not held by the Folder type
    assertTrue(session.getVersions(syncRootFolder.getRef()).isEmpty());
    // Wait for the versioning delay and update the synchronization root
    Thread.sleep(VERSIONING_DELAY);
    FileSystemItemFactory defaultSyncRootFolderItemFactory = ((FileSystemItemAdapterServiceImpl) fileSystemItemAdapterService).getFileSystemItemFactory("defaultSyncRootFolderItemFactory");
    FolderItem syncRootFolderItem = (FolderItem) defaultSyncRootFolderItemFactory.getFileSystemItem(syncRootFolder);
    syncRootFolderItem.rename("syncRootRenamed");
    syncRootFolder = session.getDocument(syncRootFolder.getRef());
    // Expect no versions since the "versioning-delay" policy doesn't apply to folderish documents
    assertTrue(session.getVersions(syncRootFolder.getRef()).isEmpty());
}
Also used : DefaultFileSystemItemFactory(org.nuxeo.drive.service.impl.DefaultFileSystemItemFactory) FileSystemItemFactory(org.nuxeo.drive.service.FileSystemItemFactory) FolderItem(org.nuxeo.drive.adapter.FolderItem) FileSystemItemAdapterServiceImpl(org.nuxeo.drive.service.impl.FileSystemItemAdapterServiceImpl) Test(org.junit.Test)

Aggregations

FileSystemItemFactory (org.nuxeo.drive.service.FileSystemItemFactory)11 Test (org.junit.Test)8 FileSystemItemAdapterServiceImpl (org.nuxeo.drive.service.impl.FileSystemItemAdapterServiceImpl)8 FolderItem (org.nuxeo.drive.adapter.FolderItem)7 DefaultFileSystemItemFactory (org.nuxeo.drive.service.impl.DefaultFileSystemItemFactory)7 FileSystemItem (org.nuxeo.drive.adapter.FileSystemItem)6 DocumentModel (org.nuxeo.ecm.core.api.DocumentModel)5 NuxeoDriveContribException (org.nuxeo.drive.adapter.NuxeoDriveContribException)3 FileItem (org.nuxeo.drive.adapter.FileItem)2 TopLevelFolderItemFactory (org.nuxeo.drive.service.TopLevelFolderItemFactory)2 DefaultSyncRootFolderItemFactory (org.nuxeo.drive.service.impl.DefaultSyncRootFolderItemFactory)2 DefaultTopLevelFolderItemFactory (org.nuxeo.drive.service.impl.DefaultTopLevelFolderItemFactory)2 FileSystemItemFactoryDescriptor (org.nuxeo.drive.service.impl.FileSystemItemFactoryDescriptor)2 FileSystemItemFactoryWrapper (org.nuxeo.drive.service.impl.FileSystemItemFactoryWrapper)2 CloseableCoreSession (org.nuxeo.ecm.core.api.CloseableCoreSession)2 StringBlob (org.nuxeo.ecm.core.api.impl.blob.StringBlob)2 ArrayList (java.util.ArrayList)1 ScrollFileSystemItemList (org.nuxeo.drive.adapter.ScrollFileSystemItemList)1 CollectionSyncRootFolderItem (org.nuxeo.drive.adapter.impl.CollectionSyncRootFolderItem)1 VirtualFolderItemFactory (org.nuxeo.drive.service.VirtualFolderItemFactory)1