protected void testMigrateDL(long folderId) throws Exception { FileEntry fileEntry = addFileEntry( folderId, RandomTestUtil.randomString() + ".txt", ContentTypes.TEXT_PLAIN, RandomTestUtil.randomBytes(TikaSafeRandomizerBumper.INSTANCE)); _convertProcess.convert(); DLFileEntry dlFileEntry = (DLFileEntry) fileEntry.getModel(); DLContentLocalServiceUtil.getContent( dlFileEntry.getCompanyId(), DLFolderConstants.getDataRepositoryId( dlFileEntry.getRepositoryId(), dlFileEntry.getFolderId()), dlFileEntry.getName()); }
@Test public void testMigrateMB() throws Exception { MBMessage mbMessage = addMBMessageAttachment(); _convertProcess.convert(); DLFileEntry dlFileEntry = getDLFileEntry(mbMessage); String title = dlFileEntry.getTitle(); Assert.assertTrue(title.endsWith(".docx")); DLContentLocalServiceUtil.getContent( dlFileEntry.getCompanyId(), DLFolderConstants.getDataRepositoryId( dlFileEntry.getRepositoryId(), dlFileEntry.getFolderId()), dlFileEntry.getName()); }
protected void testMigrateAndCheckOldRepositoryFiles(Boolean delete) throws Exception { _convertProcess.setParameterValues(new String[] {_CLASS_NAME_DB_STORE, delete.toString()}); FileEntry rootFileEntry = addFileEntry( DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, RandomTestUtil.randomString() + ".txt", ContentTypes.TEXT_PLAIN, RandomTestUtil.randomBytes(TikaSafeRandomizerBumper.INSTANCE)); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId(), TestPropsValues.getUserId()); Folder folder = DLAppServiceUtil.addFolder( _group.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, RandomTestUtil.randomString(), RandomTestUtil.randomString(), serviceContext); FileEntry folderFileEntry = addFileEntry( folder.getFolderId(), "liferay.jpg", ContentTypes.IMAGE_JPEG, FileUtil.getBytes(getClass(), "dependencies/liferay.jpg")); ImageProcessorUtil.generateImages(null, folderFileEntry.getFileVersion()); _convertProcess.convert(); DLFileEntry rootDLFileEntry = (DLFileEntry) rootFileEntry.getModel(); Assert.assertNotEquals( delete, _sourceStore.hasFile( rootDLFileEntry.getCompanyId(), rootDLFileEntry.getDataRepositoryId(), rootDLFileEntry.getName())); DLFileEntry folderDLFileEntry = (DLFileEntry) folderFileEntry.getModel(); Assert.assertNotEquals( delete, _sourceStore.hasDirectory( folderDLFileEntry.getCompanyId(), DLPreviewableProcessor.REPOSITORY_ID, DLPreviewableProcessor.THUMBNAIL_PATH)); Assert.assertNotEquals( delete, _sourceStore.hasFile( folderDLFileEntry.getCompanyId(), folderDLFileEntry.getDataRepositoryId(), folderDLFileEntry.getName())); DLContentLocalServiceUtil.getContent( folderDLFileEntry.getCompanyId(), DLFolderConstants.getDataRepositoryId( folderDLFileEntry.getRepositoryId(), folderDLFileEntry.getFolderId()), folderDLFileEntry.getName()); DLContentLocalServiceUtil.getContent( rootDLFileEntry.getCompanyId(), DLFolderConstants.getDataRepositoryId( rootDLFileEntry.getRepositoryId(), rootDLFileEntry.getFolderId()), rootDLFileEntry.getName()); }