@Test void initialize(@XWikiTempDir File configDirectory) throws IOException, InitializationException { assertEquals(new File(new File("."), "store/file").getCanonicalFile(), filesystemStoreTools.getStoreRootDirectory()); verify(this.environment, times(1)).getPermanentDirectory(); when(config.getDirectory()).thenReturn(configDirectory); when(config.cleanOnStartup()).thenReturn(true); filesystemStoreTools.initialize(); assertEquals(configDirectory, filesystemStoreTools.getStoreRootDirectory()); verify(this.environment, times(1)).getPermanentDirectory(); verify(this.config, times(2)).cleanOnStartup(); assertEquals(String.format("Using filesystem store directory [%s]", configDirectory.toString()), logCapture.getMessage(1)); }
@Override public void initialize() throws InitializationException { File fileStorageDirectory = this.config.getDirectory(); if (fileStorageDirectory == null) { File storeDirectory = new File(this.environment.getPermanentDirectory(), "store"); fileStorageDirectory = new File(storeDirectory, FileSystemStoreUtils.HINT); } try { this.storeRootDirectory = fileStorageDirectory.getCanonicalFile(); } catch (IOException e) { throw new InitializationException("Invalid permanent directory", e); } this.logger.info("Using filesystem store directory [{}]", this.storeRootDirectory); if (this.config.cleanOnStartup()) { final File dir = this.storeRootDirectory; new Thread(() -> deleteEmptyDirs(dir, 0)).start(); } }
FilesystemStoreTools implements Initializable { @Override public void initialize() throws InitializationException { File fileStorageDirectory = this.config.getDirectory(); if (fileStorageDirectory == null) { File storeDirectory = new File(this.environment.getPermanentDirectory(), "store"); fileStorageDirectory = new File(storeDirectory, FileSystemStoreUtils.HINT); } try { this.storeRootDirectory = fileStorageDirectory.getCanonicalFile(); } catch (IOException e) { throw new InitializationException("Invalid permanent directory", e); } this.logger.info("Using filesystem store directory [{}]", this.storeRootDirectory); if (this.config.cleanOnStartup()) { final File dir = this.storeRootDirectory; new Thread(() -> deleteEmptyDirs(dir, 0)).start(); } } }
FilesystemStoreTools implements Initializable { @Override public void initialize() throws InitializationException { File fileStorageDirectory = this.config.getDirectory(); if (fileStorageDirectory == null) { File storeDirectory = new File(this.environment.getPermanentDirectory(), "store"); fileStorageDirectory = new File(storeDirectory, FileSystemStoreUtils.HINT); } try { this.storeRootDirectory = fileStorageDirectory.getCanonicalFile(); } catch (IOException e) { throw new InitializationException("Invalid permanent directory", e); } this.logger.info("Using filesystem store directory [{}]", this.storeRootDirectory); if (this.config.cleanOnStartup()) { final File dir = this.storeRootDirectory; new Thread(() -> deleteEmptyDirs(dir, 0)).start(); } } FilesystemStoreTools(final File storageDir, final LockProvider lockProvider);  FilesystemStoreTools(); }
FilesystemStoreTools implements Initializable { @Override public void initialize() throws InitializationException { File fileStorageDirectory = this.config.getDirectory(); if (fileStorageDirectory == null) { File storeDirectory = new File(this.environment.getPermanentDirectory(), "store"); fileStorageDirectory = new File(storeDirectory, FileSystemStoreUtils.HINT); } try { this.storeRootDirectory = fileStorageDirectory.getCanonicalFile(); } catch (IOException e) { throw new InitializationException("Invalid permanent directory", e); } this.logger.info("Using filesystem store directory [{}]", this.storeRootDirectory); if (this.config.cleanOnStartup()) { final File dir = this.storeRootDirectory; new Thread(() -> deleteEmptyDirs(dir, 0)).start(); } } FilesystemStoreTools(final File storageDir, final LockProvider lockProvider);  FilesystemStoreTools(); @Override void initialize(); File getBackupFile(final File storageFile); File getTempFile(final File storageFile); DeletedAttachmentFileProvider getDeletedAttachmentFileProvider(final AttachmentReference attachment,
        final long index); DeletedDocumentContentFileProvider getDeletedDocumentFileProvider(DocumentReference documentReference,
        long index); File getStoreRootDirectory(); AttachmentFileProvider getAttachmentFileProvider(final AttachmentReference attachmentReference); File getAttachmentDir(final AttachmentReference attachmentReference); File getDeletedAttachmentDir(final AttachmentReference attachment, final long index); File getDeletedDocumentContentDir(final DocumentReference documentReference, final long index); File getWikiDir(String wikiId); File getDocumentContentDir(final DocumentReference documentReference); ReadWriteLock getLockForFile(final File toLock); }
FilesystemStoreTools implements Initializable { @Override public void initialize() throws InitializationException { File fileStorageDirectory = this.config.getDirectory(); if (fileStorageDirectory == null) { File storeDirectory = new File(this.environment.getPermanentDirectory(), "store"); fileStorageDirectory = new File(storeDirectory, FileSystemStoreUtils.HINT); } try { this.storeRootDirectory = fileStorageDirectory.getCanonicalFile(); } catch (IOException e) { throw new InitializationException("Invalid permanent directory", e); } this.logger.info("Using filesystem store directory [{}]", this.storeRootDirectory); if (this.config.cleanOnStartup()) { final File dir = this.storeRootDirectory; new Thread(() -> deleteEmptyDirs(dir, 0)).start(); } } FilesystemStoreTools(final File storageDir, final LockProvider lockProvider);  FilesystemStoreTools(); @Override void initialize(); File getBackupFile(final File storageFile); File getTempFile(final File storageFile); DeletedAttachmentFileProvider getDeletedAttachmentFileProvider(final AttachmentReference attachment,
        final long index); DeletedDocumentContentFileProvider getDeletedDocumentFileProvider(DocumentReference documentReference,
        long index); File getStoreRootDirectory(); AttachmentFileProvider getAttachmentFileProvider(final AttachmentReference attachmentReference); File getAttachmentDir(final AttachmentReference attachmentReference); File getDeletedAttachmentDir(final AttachmentReference attachment, final long index); File getDeletedDocumentContentDir(final DocumentReference documentReference, final long index); File getWikiDir(String wikiId); File getDocumentContentDir(final DocumentReference documentReference); ReadWriteLock getLockForFile(final File toLock); static final String DOCUMENT_LOCALES_DIR_NAME; static final String ATTACHMENTS_DIR_NAME; static final String DELETED_ATTACHMENTS_DIR_NAME; static final String DELETED_DOCUMENTS_DIR_NAME; }