Esempio n. 1
0
 /**
  * Returns the internal glossary folder.
  *
  * @param res
  * @return
  */
 @Override
 public OlatRootFolderImpl getGlossaryRootFolder(final OLATResourceable res) {
   final OlatRootFolderImpl resRoot =
       FileResourceManager.getInstance().getFileResourceRootImpl(res);
   if (resRoot == null) {
     return null;
   }
   VFSItem glossaryRoot = resRoot.resolve(INTERNAL_FOLDER_NAME);
   if (glossaryRoot == null) {
     // Glossary has been imported but not yet renamed to the internal folder.
     // This is ugly but no other way to do since the add resource callback
     // somehow does not provide this hook?
     final VFSItem unzipped = resRoot.resolve(FileResourceManager.ZIPDIR);
     if (unzipped == null) {
       // Should not happen, but since we have no unzipped folder we better
       // continue with an empty glossary than crashing
       resRoot.createChildContainer(INTERNAL_FOLDER_NAME);
     } else {
       // We do not use the unzipped folder anymore, this was only for import.
       // We rename it to the internal glossary folder and use it from now on
       unzipped.rename(INTERNAL_FOLDER_NAME);
     }
     glossaryRoot = resRoot.resolve(INTERNAL_FOLDER_NAME);
   }
   return (OlatRootFolderImpl) glossaryRoot;
 }
Esempio n. 2
0
 private CourseEnvironment createMockCourseEnvironment() {
   mockCourseEnvironment = mock(CourseEnvironment.class);
   OlatRootFolderImpl baseContainer = mock(OlatRootFolderImpl.class);
   when(mockCourseEnvironment.getCourseBaseContainer()).thenReturn(baseContainer);
   when(baseContainer.getRelPath()).thenReturn(basePath);
   return mockCourseEnvironment;
 }
Esempio n. 3
0
 private File getFolder(final String folderPath) {
   final OlatRootFolderImpl vfsContainer = new OlatRootFolderImpl(folderPath, null);
   final File fFolderRoot = vfsContainer.getBasefile();
   return fFolderRoot;
 }