@Test public void getCourseFromCacheOrLoad_getNotExisting() { RepositoryEntry notExistingRepositoryEntry = mock(RepositoryEntry.class); when(notExistingRepositoryEntry.getResourceableId()).thenReturn(new Long(100)); ICourse publicCourse = notificationCourseAccessManager.getCourseFromCacheOrLoad(notExistingRepositoryEntry); assertNull(publicCourse); }
ICourse getCourseFromCacheOrLoad(RepositoryEntry courseRepositoryEntry) { ICourse course = repositoryEntryToCourseCache.get(courseRepositoryEntry.getResourceableId()); if (course == null) { OLATResourceable oLATResourceable = courseRepositoryEntry.getOlatResource(); if (oLATResourceable != null) { course = CourseFactory.loadCourse(oLATResourceable); repositoryEntryToCourseCache.put(courseRepositoryEntry.getResourceableId(), course); } } return course; }
NotificationCourseAccessManager implements CourseAccessManager { ICourse getCourseFromCacheOrLoad(RepositoryEntry courseRepositoryEntry) { ICourse course = repositoryEntryToCourseCache.get(courseRepositoryEntry.getResourceableId()); if (course == null) { OLATResourceable oLATResourceable = courseRepositoryEntry.getOlatResource(); if (oLATResourceable != null) { course = CourseFactory.loadCourse(oLATResourceable); repositoryEntryToCourseCache.put(courseRepositoryEntry.getResourceableId(), course); } } return course; } }
NotificationCourseAccessManager implements CourseAccessManager { ICourse getCourseFromCacheOrLoad(RepositoryEntry courseRepositoryEntry) { ICourse course = repositoryEntryToCourseCache.get(courseRepositoryEntry.getResourceableId()); if (course == null) { OLATResourceable oLATResourceable = courseRepositoryEntry.getOlatResource(); if (oLATResourceable != null) { course = CourseFactory.loadCourse(oLATResourceable); repositoryEntryToCourseCache.put(courseRepositoryEntry.getResourceableId(), course); } } return course; } NotificationCourseAccessManager(); }
NotificationCourseAccessManager implements CourseAccessManager { ICourse getCourseFromCacheOrLoad(RepositoryEntry courseRepositoryEntry) { ICourse course = repositoryEntryToCourseCache.get(courseRepositoryEntry.getResourceableId()); if (course == null) { OLATResourceable oLATResourceable = courseRepositoryEntry.getOlatResource(); if (oLATResourceable != null) { course = CourseFactory.loadCourse(oLATResourceable); repositoryEntryToCourseCache.put(courseRepositoryEntry.getResourceableId(), course); } } return course; } NotificationCourseAccessManager(); @Override void execute(); }
NotificationCourseAccessManager implements CourseAccessManager { ICourse getCourseFromCacheOrLoad(RepositoryEntry courseRepositoryEntry) { ICourse course = repositoryEntryToCourseCache.get(courseRepositoryEntry.getResourceableId()); if (course == null) { OLATResourceable oLATResourceable = courseRepositoryEntry.getOlatResource(); if (oLATResourceable != null) { course = CourseFactory.loadCourse(oLATResourceable); repositoryEntryToCourseCache.put(courseRepositoryEntry.getResourceableId(), course); } } return course; } NotificationCourseAccessManager(); @Override void execute();  }